This commit is contained in:
redtea committed 2024-05-24 10:16:10 +03:00
1 parent aa078f0c4f
commit b206856c1d
2 files changed
+54 -1

No files matched your search

+3
View File
@@ -81,6 +81,7 @@
this.textBox1.Name = "textBox1"; this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(366, 26); this.textBox1.Size = new System.Drawing.Size(366, 26);
this.textBox1.TabIndex = 2; this.textBox1.TabIndex = 2;
this.textBox1.TextChanged += new System.EventHandler(this.textBox1_TextChanged);
// //
// button1 // button1
// //
@@ -91,6 +92,7 @@
this.button1.TabIndex = 3; this.button1.TabIndex = 3;
this.button1.Text = "Поиск"; this.button1.Text = "Поиск";
this.button1.UseVisualStyleBackColor = true; this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
// //
// label2 // label2
// //
@@ -141,6 +143,7 @@
this.toolStripButton1.Name = "toolStripButton1"; this.toolStripButton1.Name = "toolStripButton1";
this.toolStripButton1.Size = new System.Drawing.Size(121, 29); this.toolStripButton1.Size = new System.Drawing.Size(121, 29);
this.toolStripButton1.Text = "Обновить"; this.toolStripButton1.Text = "Обновить";
this.toolStripButton1.Click += new System.EventHandler(this.toolStripButton1_Click);
// //
// toolStripSeparator2 // toolStripSeparator2
// //
+51 -1
View File
@@ -14,6 +14,7 @@ namespace PaymentLogs
{ {
public partial class DataForm : Form public partial class DataForm : Form
{ {
public DataForm() public DataForm()
{ {
InitializeComponent(); InitializeComponent();
@@ -59,7 +60,7 @@ namespace PaymentLogs
{ {
try try
{ {
if(row.Cells.Count > 1) if(row.Cells.Count > 1 && row.Cells["id"].Value != null)
{ {
Payment payment = new Payment Payment payment = new Payment
{ {
@@ -85,5 +86,54 @@ namespace PaymentLogs
} }
Program.PaymentRepository.Save(); 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);
}
} }
} }