From 327041c3abaa67ac0a90d4e4ff375a9521224e77 Mon Sep 17 00:00:00 2001 From: Denis Istratov Date: Fri, 24 May 2024 00:22:56 +0300 Subject: [PATCH] Update DataForm.cs --- sql2/Forms/DataForm.cs | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/sql2/Forms/DataForm.cs b/sql2/Forms/DataForm.cs index 82c696a..6cd9a4c 100644 --- a/sql2/Forms/DataForm.cs +++ b/sql2/Forms/DataForm.cs @@ -59,16 +59,21 @@ namespace PaymentLogs { try { - Payment payment = new Payment + if(row.Cells.Count > 1) { - Id = Convert.ToInt32(row.Cells["id"].Value), - FCs = row.Cells["fcs"].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); + Payment payment = new Payment + { + Id = Convert.ToInt32(row.Cells["id"].Value), + FCs = row.Cells["fcs"].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);