Update DataForm.cs

This commit is contained in:
redtea committed 2024-05-24 00:22:56 +03:00
1 parent 75fa716046
commit 327041c3ab
1 file changed
+14 -9
+14 -9
View File
@@ -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);