Setup and forms
This commit is contained in:
1 parent
aed55f44f9
commit
eee7548fc8
47 files changed
+2837
-8138
No files matched your search
@@ -0,0 +1,149 @@
|
||||
using MySqlX.XDevAPI.Relational;
|
||||
using PaymentLogs.Domain;
|
||||
using PaymentLogs.Forms;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace PaymentLogs
|
||||
{
|
||||
public partial class DataForm : Form
|
||||
{
|
||||
|
||||
public DataForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
}
|
||||
|
||||
private void Form1_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
dataGridView1.Columns.Add("id", "Номер");
|
||||
dataGridView1.Columns.Add("fcs", "ФИО");
|
||||
dataGridView1.Columns.Add("course", "Курс");
|
||||
dataGridView1.Columns.Add("course_price", "Цена");
|
||||
dataGridView1.Columns.Add("paid", "Оплачено");
|
||||
dataGridView1.Columns.Add("debt", "Долг");
|
||||
foreach (Payment payment in Program.PaymentRepository.All())
|
||||
{
|
||||
dataGridView1.Rows.Add(payment.Id.ToString(), payment.FCs.ToString(), Program.CourseRepository.Get(payment.CourseId).Name,
|
||||
payment.CoursePrice.ToString(), payment.Paid.ToString(), payment.Debt.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
private void toolStripSplitButton1_ButtonClick(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void toolStripButton3_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void toolStripButton2_Click(object sender, EventArgs e)
|
||||
{
|
||||
foreach (DataGridViewRow row in dataGridView1.Rows)
|
||||
{
|
||||
try
|
||||
{
|
||||
if(row.Cells.Count > 1 && row.Cells["id"].Value != null)
|
||||
{
|
||||
Payment payment = new Payment
|
||||
{
|
||||
Id = Convert.ToInt32(row.Cells["id"].Value),
|
||||
FCs = row.Cells["fcs"].Value.ToString(),
|
||||
CourseId = Program.CourseRepository.ByName(row.Cells["course"].Value.ToString()).Id,
|
||||
CoursePrice = Convert.ToInt32(row.Cells["course_price"].Value),
|
||||
Paid = Convert.ToInt32(row.Cells["paid"].Value),
|
||||
Debt = Convert.ToInt32(row.Cells["debt"].Value)
|
||||
};
|
||||
Program.PaymentRepository.Update(payment.Id, payment);
|
||||
}
|
||||
|
||||
|
||||
} catch(NullReferenceException ignored)
|
||||
{
|
||||
Console.WriteLine(ignored.Message);
|
||||
} catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex.Message);
|
||||
}
|
||||
|
||||
}
|
||||
Program.PaymentRepository.Save();
|
||||
}
|
||||
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
string FCsText = textBox1.Text;
|
||||
string CourseText = textBox2.Text;
|
||||
List<List<string>> filtredList = new List<List<string>>();
|
||||
foreach (DataGridViewRow row in dataGridView1.Rows)
|
||||
{
|
||||
try
|
||||
{
|
||||
if(row.Cells["fcs"].Value == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
string FCs = row.Cells["fcs"].Value.ToString();
|
||||
string course = row.Cells["course"].Value.ToString();
|
||||
if (((FCs.Equals(FCsText)) && (course.Equals(CourseText))) )
|
||||
{
|
||||
List<string> list = new List<string>
|
||||
{ row.Cells["id"].Value.ToString(), row.Cells["fcs"].Value.ToString(),
|
||||
row.Cells["course"].Value.ToString(), row.Cells["course_price"].Value.ToString(),
|
||||
row.Cells["paid"].Value.ToString(), row.Cells["debt"].Value.ToString() };
|
||||
|
||||
filtredList.Add(list);
|
||||
}
|
||||
}
|
||||
catch(Exception ignored)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
dataGridView1.Rows.Clear();
|
||||
foreach (List<String> args in filtredList)
|
||||
{
|
||||
dataGridView1.Rows.Add(args[0], args[1], args[2], args[3], args[4], args[5]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void textBox1_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void toolStripButton1_Click(object sender, EventArgs e)
|
||||
{
|
||||
dataGridView1.Rows.Clear();
|
||||
Form1_Load(null, null);
|
||||
}
|
||||
|
||||
private void button2_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void button3_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user