public ServiceResult <PaymentReceipt> initialize(PaymentReceipt receipt) { ServiceResult <PaymentReceipt> result = new ServiceResult <PaymentReceipt>(); ServiceResult <LendingReceipt> lendingReceiptInitializationResult = new LendingReceiptService().initialize(receipt.lendingReceipt); if (!lendingReceiptInitializationResult.isOk()) { result.status = ServiceStatus.FAILED; result.messages = lendingReceiptInitializationResult.messages; result.model = receipt; return(result); } receipt.lendingReceipt = lendingReceiptInitializationResult.model; foreach (LendingReceiptDetail detail in receipt.lendingReceipt.details) { receipt.paymentAmount += detail.id.book.price; } receipt.isActive = true; result.model = receipt; return(result); }
public string insertPaymentReceipt(PaymentReceipt paymentReceipt) { string result; result = allRecord("I", paymentReceipt); return(result); }
private async Task InvokeInvoiceSP(InvoiceRequestData invoiceData, PaymentReceipt receipt) { await _dbCtx.Database.OpenConnectionAsync(); var connection = _dbCtx.Database.GetDbConnection(); var command = connection.CreateCommand(); command.CommandType = CommandType.StoredProcedure; command.CommandText = "SP_Save_Invoice"; command.Parameters.Add(new MySqlParameter("selectedIdReceipt", invoiceData.IdReceipt)); command.Parameters.Add(new MySqlParameter("selectedYear", invoiceData.Year)); command.Parameters.Add(new MySqlParameter("customerName", invoiceData.CustomerName)); command.Parameters.Add(new MySqlParameter("customerFiscalCode", invoiceData.CustomerFiscalCode)); command.Parameters.Add(new MySqlParameter("customerAddress", invoiceData.CustomerAddress)); command.Parameters.Add(new MySqlParameter("costAmount", receipt.PaymentReceiptDetails.Sum(x => x.CostAmount))); command.Parameters.Add(new MySqlParameter("issuedBy", new Guid(_claimPrincipal.Value.Identity.Name))); command.Parameters.Add(new MySqlParameter("paymentType", invoiceData.PaymentType)); command.Parameters.Add(new MySqlParameter("paymentDescription", invoiceData.Description)); var res = (int?)command.ExecuteScalar(); await _dbCtx.Database.CloseConnectionAsync(); if (res.HasValue) { var desc = "No error description avaialle"; if (res.Value == 1062) { desc = "Duplicate invoice number!!"; } throw new Exception($"Unable to create ad store invoice number. ERR-NO={res} {desc}"); } }
public async Task <IActionResult> PutPaymentReceipt([FromRoute] int id, [FromBody] PaymentReceipt paymentReceipt) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != paymentReceipt.Id) { return(BadRequest()); } _context.Entry(paymentReceipt).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PaymentReceiptExists(id)) { return(NotFound()); } else { throw; } } return(Ok(_context.PaymentReceipts.Find(id))); }
public static PaymentReceiptDto ToDto(this PaymentReceipt e) { if (e == null) { return(null); } var res = new PaymentReceiptDto(); res.Id = e.Id; res.IdCustomer = e.IdCustomer; res.PaymentDate = e.PaymentDate; res.IssueDate = e.IssueDate; res.ReceiptPath = e.ReceiptPath; res.CostAmount = e.CostAmount; res.Name = e.Name; res.Description = e.Description; res.Customer = e.Customer.ToDto(false); res.InvoiceNumber = e.InvoiceNumber; res.PaymentReceiptDetails = e.PaymentReceiptDetails.OrderByDescending(x => x.XCreateDate).Select(x => x.ToDto()).ToArray(); res.CustomerAddress = e.CustomerAddress; res.CustomerFiscalCode = e.CustomerFiscalCode; res.CustomerName = e.CustomerName; res.CreditNote = e.CreditNotes.Count() > 0 ? e.CreditNotes.ToArray()[0].ToDto() : null; res.IssuedBy = e.IssuedBy; res.Owner = e.Owner != null?e.Owner.ToDto() : null; res.PaymentType = e.PaymentType; return(res); }
public string updatePaymentReceipt(PaymentReceipt paymentReceipt) { string result; result = allRecord("U", paymentReceipt); return(result); }
public Document Generate(PaymentReceipt receipt) { Dictionary<string, object> datasource = new Dictionary<string, object>(); datasource.Add("UniqueNumber", receipt.Sequence); datasource.Add("金額", receipt.Amount); datasource.Add("截止日", GetDisplayDateString(receipt.Expiration)); datasource.Add("虛擬帳號", receipt.VirtualAccount); //datasource.Add("姓名", GetValueOrEmpty(receipt.Extensions, "姓名")); //datasource.Add("班級", GetValueOrEmpty(receipt.Extensions, "班級")); //datasource.Add("座號", GetValueOrEmpty(receipt.Extensions, "座號")); //datasource.Add("學號", GetValueOrEmpty(receipt.Extensions, "學號")); //datasource.Add("科別名稱", GetValueOrEmpty(receipt.Extensions, "科別名稱")); datasource.Add("超商條碼一", Utilities.CreateBarCode(GetValueOrEmpty(receipt.Codes, "Shop1"))); datasource.Add("超商條碼二", Utilities.CreateBarCode(GetValueOrEmpty(receipt.Codes, "Shop2"))); datasource.Add("超商條碼三", Utilities.CreateBarCode(GetValueOrEmpty(receipt.Codes, "Shop3"))); datasource.Add("郵局條碼一", Utilities.CreateBarCode(GetValueOrEmpty(receipt.Codes, "Post1"))); datasource.Add("郵局條碼二", Utilities.CreateBarCode(GetValueOrEmpty(receipt.Codes, "Post2"))); datasource.Add("郵局條碼三", Utilities.CreateBarCode(GetValueOrEmpty(receipt.Codes, "Post3"))); //datasource.Add("繳款明細", GetPaymentItemsString(receipt.Extensions)); datasource.Add("繳款明細", "校車收費"); AddCustomeMergeField(datasource, receipt.Extensions); Document payForm = Template.Clone(); payForm.MailMerge.MergeField += new Aspose.Words.Reporting.MergeFieldEventHandler(MailMerge_MergeField); payForm.MailMerge.Execute(new List<string>(datasource.Keys).ToArray(), new List<object>(datasource.Values).ToArray()); payForm.MailMerge.MergeField -= new Aspose.Words.Reporting.MergeFieldEventHandler(MailMerge_MergeField); return payForm; }
public LendingForm() { InitializeComponent(); this.paymentReceipt = new PaymentReceipt(); this.paymentReceipt.lendingReceipt = new LendingReceipt(); this.paymentReceipt.paymentAmount = 0; this.paymentReceipt.debtAmount = 0; }
public Task PrintAsync(PaymentReceipt receipt, int numberOfCopies = 1) { if (!_printer.IsEnabled()) { InitializeAsync(); } bool success = true; try { _printer.StartPrinting(); for (int i = 0; i < numberOfCopies; i++) { //send receipt to the printer, line by line foreach (var line in receipt.Lines) { if (string.IsNullOrEmpty(line.TextRight)) { if (!_printer.Print(line.Text, (int)line.Size, (int)line.Weight, (int)line.Alignment, receipt.SignatureUrl)) { success = false; } } else { //special case field and value alignment, if (!_printer.PrintFieldValue(line.Text, line.TextRight, (int)line.Size, (int)line.Weight)) { success = false; } } } //cut the receipt - can be a partial cut if (receipt.CutPercentage > 0) { if (!_printer.Cut(receipt.CutPercentage)) { success = false; } } } } catch (Exception ex) { // Eating exception so that message does not needs to be shown //throw new PrinterLayerException(PrinterError.Unexpected, ex); } finally { _printer.StopPrinting(); } return(Task.FromResult <bool>(success)); // to avoid warning }
public static void PaymentSumarry(Payment payment, User user, User receiver, Pool poolObj) { PaymentReceipt paymentReceipt = GeneratePaymentReceipt(payment); PaymentReceipt debitorPaymentReceipt = PaymentReceiptDebitor(paymentReceipt, user); Startup.PaymentReceiptServiceObj.AddReceipt(debitorPaymentReceipt, user); PaymentReceipt creditorPaymentReceipt = PaymentReceiptCreditor(paymentReceipt, receiver); Startup.PaymentReceiptServiceObj.AddReceipt(creditorPaymentReceipt, receiver); poolObj = UpdateJsonFile(poolObj); }
public void SetNotificationWasSentTest_AssesReturnedResult(bool notificationWasSet, bool expectedResultSucceeded) { //Arrange PaymentReceipt paymentReceipt = new PaymentReceipt(new ValueObjects.Money(5), Guid.NewGuid().ToString()); //Act var result = paymentReceipt.SetNotificationWasSent(notificationWasSet); bool actualResultSucceeded = result.Succeeded; //Assert Assert.Equal(expectedResultSucceeded, actualResultSucceeded); }
public async Task Print(List <string> lines, int numberOfCopies = 1, string signature = null) { var receipt = new PaymentReceipt(); receipt.SignatureUrl = signature ?? string.Empty; foreach (var line in lines) { receipt.AddLine(line); } await PrintAsync(receipt, numberOfCopies); }
public void SetNotificationWasSentTest_AssessPropertyHasChanged(bool notificationWasSet, bool expectedNotificationPropertyValue) { //Arrange PaymentReceipt paymentReceipt = new PaymentReceipt(new ValueObjects.Money(8), Guid.NewGuid().ToString()); //Act var result = paymentReceipt.SetNotificationWasSent(notificationWasSet); bool actualNotificationPropertyValue = paymentReceipt.NotificationWasSent; //Assert Assert.Equal(expectedNotificationPropertyValue, actualNotificationPropertyValue); }
public static int addPaymentReceipt(PaymentReceipt pamentR) { try { int i = accountDetailsProvider.addPaymentReceipt(pamentR); return(i); } catch (Exception ex) { throw ex; } }
private void AddPayment(Settlement settlement, IEnumerable <SettlementDetails> settlementDetails) { // Add Payment //PaymentReceiptLibrary paymentLibrary = new PaymentReceiptLibrary(ConfigurationHelper.GetsmARTDBContextConnectionString()); PaymentReceipt payment = new PaymentReceipt(); payment.Transaction_Type = "Payment"; payment.Transaction_Mode = "Cash"; payment.Transaction_Date = DateTime.Now; payment.Transaction_Status = "Closed"; payment.Cash_Amount = settlement.Amount; payment.Bank_Amount = 0; payment.Cash_Drawer = "1"; payment.Check_Wire_Transfer = "1"; payment.Created_By = HttpContext.User.Identity.Name; payment.Created_Date = DateTime.Now; payment.Active_Ind = true; payment.Updated_By = HttpContext.User.Identity.Name; payment.Last_Updated_Date = DateTime.Now; payment.Party = new Party() { ID = settlement.Scale.Party_ID.ID }; payment.Account_Name = new Bank(); payment.Net_Amt = settlement.Amount; payment.Payment_Receipt_Type = "Tickets"; PaymentController payCont = new PaymentController(); payment = payCont.SavePayment(payment); //payment = paymentLibrary.Add(payment); // Add Payment Details PaymentReceiptDetails paymentDetails = new PaymentReceiptDetails(); paymentDetails.PaymentReceipt = new PaymentReceipt() { ID = payment.ID }; paymentDetails.Apply_Amount = settlement.Amount;; paymentDetails.Balance_Amount = 0; paymentDetails.Paid_In_Full = true; paymentDetails.Settlement = new Settlement() { ID = settlement.ID }; paymentDetails.Created_By = HttpContext.User.Identity.Name; paymentDetails.Created_Date = DateTime.Now; paymentDetails.Active_Ind = true; paymentDetails.Updated_By = HttpContext.User.Identity.Name; paymentDetails.Last_Updated_Date = DateTime.Now; payCont.SavePaymentDetails(paymentDetails); }
public ServiceResult <PaymentReceipt> validate(PaymentReceipt receipt) { ServiceResult <PaymentReceipt> result = new ServiceResult <PaymentReceipt>(); if (receipt.debtAmount < 0) { result.status = ServiceStatus.INVALID; result.messages.Add("debtAmount", "Debt amount cannot be negative"); } if (receipt.paymentAmount < 0) { result.status = ServiceStatus.INVALID; result.messages.Add("paymentAmount", "Payment amount cannot be negative"); } if (receipt.debtAmount > receipt.paymentAmount) { result.status = ServiceStatus.INVALID; result.messages.Add("debtAmount", "Debt amount cannot be greater than payment amount"); } EmployeeService employeeService = new EmployeeService(); ServiceResult <Employee> employeeValidation = employeeService.validate(receipt.employee); if (!employeeValidation.isOk()) { result.status = ServiceStatus.INVALID; foreach (String key in employeeValidation.messages.Keys) { result.messages.Add($"employee_{key}", employeeValidation.messages[key]); } } LendingReceiptService lendingReceiptService = new LendingReceiptService(); ServiceResult <LendingReceipt> lendingReceiptValidation = lendingReceiptService.validate(receipt.lendingReceipt); if (!lendingReceiptValidation.isOk()) { result.status = ServiceStatus.INVALID; foreach (String key in lendingReceiptValidation.messages.Keys) { result.messages.Add($"lendingReceipt_{key}", lendingReceiptValidation.messages[key]); } } result.model = receipt; return(result); }
public ActionResult updatePaymentReceipt([FromBody] PaymentReceipt payment) { var result = paymentReceipt.updatePaymentReceipt(payment); if (result == null) { return(NotFound()); } else { return(Ok(result)); } }
public DataRow mapDataRow(Model model, DataRow row) { PaymentReceipt receipt = (PaymentReceipt)model; row["id"] = receipt.id; row["debt_amount"] = receipt.debtAmount; row["payment_amount"] = receipt.paymentAmount; row["employee_id"] = receipt.employee.id; row["lending_receipt_id"] = receipt.lendingReceipt.id; row["is_active"] = receipt.isActive; return(row); }
public SqlCommand createUpdateCommand(Model model, String tableName, SqlConnection connection) { PaymentReceipt receipt = (PaymentReceipt)model; String sql = $"UPDATE {tableName} SET debt_amount = @debtAmount, payment_amount = @paymentAmount, employee_id = @employeeId, lending_receipt_id = @lendingReceiptId, is_active = @isActive WHERE id = @id"; SqlCommand updateCommand = new SqlCommand(string.Format(sql), connection); updateCommand.Parameters.AddWithValue("@id", receipt.id); updateCommand.Parameters.AddWithValue("@debtAmount", receipt.debtAmount); updateCommand.Parameters.AddWithValue("@paymentAmount", receipt.paymentAmount); updateCommand.Parameters.AddWithValue("@employeeId", receipt.employee.id); updateCommand.Parameters.AddWithValue("@lendingReceiptId", receipt.lendingReceipt.id); updateCommand.Parameters.AddWithValue("@isActive", receipt.isActive); return(updateCommand); }
public bool deletePatientReceipt(int ReceiptID) { int count = 0; using (Entities.Entities ctx = new Entities.Entities()) { PaymentReceipt recipt = ctx.PaymentReceipts.Find(ReceiptID); if (recipt == null) { return(false); } ctx.PaymentReceipts.Remove(recipt); count = ctx.SaveChanges(); } return(count > 0 ? true : false); }
public SqlCommand createInsertCommand(Model model, String tableName, SqlConnection connection) { PaymentReceipt receipt = (PaymentReceipt)model; String sql = $"INSERT INTO {tableName} ([id], [debt_amount], [payment_amount], [employee_id], [lending_receipt_id], [is_active]) " + "VALUES (@id, @debtAmount, @paymentAmount, @employeeId, @lendingReceiptId, @isActive);"; SqlCommand insertCommand = new SqlCommand(string.Format(sql), connection); insertCommand.Parameters.AddWithValue("@id", receipt.id); insertCommand.Parameters.AddWithValue("@debtAmount", receipt.debtAmount); insertCommand.Parameters.AddWithValue("@paymentAmount", receipt.paymentAmount); insertCommand.Parameters.AddWithValue("@employeeId", receipt.employee.id); insertCommand.Parameters.AddWithValue("@lendingReceiptId", receipt.lendingReceipt.id); insertCommand.Parameters.AddWithValue("@isActive", receipt.isActive); return(insertCommand); }
public async Task <InvoiceStatus> getPaymentReceipt(Message message, CancellationToken cancellationToken) { var invoiceStatus = message.Content as InvoiceStatus; switch (invoiceStatus?.Status) { case InvoiceStatusStatus.Cancelled: await _sender.SendMessageAsync("Tudo bem, n�o precisa pagar nada.", message.From, cancellationToken); break; case InvoiceStatusStatus.Completed: await _sender.SendMessageAsync("Obrigado pelo seu pagamento, mas como isso � apenas um teste, voc� pode pedir o ressarcimento do valor pago ao PagSeguro. Em todo caso, segue o seu recibo:", message.From, cancellationToken); var paymentReceipt = new PaymentReceipt { Currency = "BLR", Total = 10, Items = new[] { new InvoiceItem { Currency = "BRL", Unit = 10, Description = "Item 1", Quantity = 1, Total = 10 } }, }; await _sender.SendMessageAsync(paymentReceipt, message.From, cancellationToken); break; case InvoiceStatusStatus.Refunded: await _sender.SendMessageAsync("Pronto. O valor que voc� me pagou j� foi ressarcido pelo PagSeguro!", message.From, cancellationToken); break; } return(invoiceStatus); }
public Task PrintAsync(PaymentReceipt receipt, int numberOfCopies = 1) { bool success = true; try { _printUtility.Print(string.Join("\n", receipt.Lines.Select(c => c.Text)), (short)numberOfCopies, string.Empty, receipt.SignatureUrl); } catch (Exception ex) { throw new PrinterLayerException(PrinterError.Unexpected, ex); } if (!success) { throw new PrinterLayerException(PrinterError.Unexpected, null); } return(Task.FromResult <bool>(success)); // to avoid warning }
public static PaymentReceipt ToEntity(this PaymentReceiptEditDto e) { if (e == null) { return(null); } var res = new PaymentReceipt(); res.Id = e.Id; res.IdCustomer = e.IdCustomer; res.PaymentDate = e.PaymentDate; res.IssueDate = e.IssueDate; res.ReceiptPath = e.ReceiptPath; //res.CostAmount = e.CostAmount; res.Name = e.Name; res.Description = e.Description; res.PaymentType = e.PaymentType; return(res); }
public bool addNewPatientReceipt(PaymentReceiptViewModel paymentRecieptViewModel) { int count = 0; using (Entities.Entities ctx = new Entities.Entities()) { PaymentReceipt paymentRercieptEntity = ctx.PaymentReceipts.Create(); paymentRercieptEntity.UserID = paymentRecieptViewModel.UserID; paymentRercieptEntity.ClinicID = paymentRecieptViewModel.ClinicID; paymentRercieptEntity.Amount = paymentRecieptViewModel.Amount; paymentRercieptEntity.Date = DateTime.Now; paymentRercieptEntity.PatientID = paymentRecieptViewModel.PatientID; paymentRercieptEntity.DoctorID = paymentRecieptViewModel.doctorID; ctx.PaymentReceipts.Add(paymentRercieptEntity); count = ctx.SaveChanges(); } return(count > 0 ? true : false); }
public DatabaseOperationResult insert(PaymentReceipt receipt) { using (TransactionScope transactionScope = new TransactionScope()) { DatabaseOperationResult result = new DatabaseOperationResult(); DatabaseOperationResult lendingReceiptInsertionResult = dao.insert(receipt.lendingReceipt, typeof(LendingReceipt)); if (!lendingReceiptInsertionResult.isOk()) { result.status = ServiceStatus.INVALID; result.message = "Operation failed when trying to insert Lending Receipt"; return(result); } DatabaseOperationResult paymentReceiptInsertionResult = dao.insert(receipt, typeof(PaymentReceipt)); if (!paymentReceiptInsertionResult.isOk()) { result.status = ServiceStatus.INVALID; result.message = "Operation failed when trying to insert Payment Receipt"; return(result); } DatabaseOperationResult lendingDetailsInsertionResult; foreach (LendingReceiptDetail detail in receipt.lendingReceipt.details) { lendingDetailsInsertionResult = dao.insert(detail, typeof(LendingReceiptDetail)); if (!lendingDetailsInsertionResult.isOk()) { result.status = ServiceStatus.INVALID; result.message = "Operation failed when trying to insert Lending details"; return(result); } } transactionScope.Complete(); return(result); } }
public static int addPaymentReceipt(PaymentReceipt pamentR) { using (var Conn = new SqlConnection(_connectionString)) { SqlHandler sqlH = new SqlHandler(); SqlTransaction trans = null; try { Conn.Open(); trans = Conn.BeginTransaction(); List <KeyValuePair <string, object> > parameter = new List <KeyValuePair <string, object> >(); parameter.Add(new KeyValuePair <string, object>("@paymentReceiptId", pamentR.paymentReceiptId)); parameter.Add(new KeyValuePair <string, object>("@financialYearID", pamentR.financialYearID)); parameter.Add(new KeyValuePair <string, object>("@accountId", pamentR.accountId)); parameter.Add(new KeyValuePair <string, object>("@receiptDate", pamentR.receiptDate)); parameter.Add(new KeyValuePair <string, object>("@crAmount", pamentR.crAmount)); parameter.Add(new KeyValuePair <string, object>("@paymentType", pamentR.paymentType)); parameter.Add(new KeyValuePair <string, object>("@bankName", pamentR.bankName)); parameter.Add(new KeyValuePair <string, object>("@bankId", pamentR.bankId)); parameter.Add(new KeyValuePair <string, object>("@chequeNo_refNo", pamentR.chequeNo_refNo)); parameter.Add(new KeyValuePair <string, object>("@chequeDate", pamentR.chequeDate)); parameter.Add(new KeyValuePair <string, object>("@naration", pamentR.naration)); parameter.Add(new KeyValuePair <string, object>("@addedBy", pamentR.addedBy)); parameter.Add(new KeyValuePair <string, object>("@addedOn", pamentR.addedOn)); parameter.Add(new KeyValuePair <string, object>("@isOpeningBalance", pamentR.isOpeningBalance)); parameter.Add(new KeyValuePair <string, object>("@nextPayementDate", pamentR.nextPayementDate)); int i = sqlH.ExecuteNonQueryTM("[dbo].[Usp_addPaymentReceipt]", parameter, Conn, trans); trans.Commit(); return(i); } catch (Exception ex) { if (trans != null) { trans.Rollback(); } throw ex; } finally { Conn.Close(); } } }
public int PostReceipt(PaymentReceipt model) { if (model.PaidAmount <= 0) { return(0); } model.RegistrationID = _db.Registrations.GetRegID_ByUserName(User.Identity.Name); model.ReceiptSN = _db.SellingPaymentReceipts.GetReceiptSN(); var receipt = _db.SellingPaymentReceipts.dueCollection(model); if (receipt == null) { return(0); } _db.SaveChanges(); _db.Vendors.UpdatePaidDue(model.VendorID); var status = _db.SaveChanges(); return(status != 0 ? receipt.ReceiptID : status); }
public PaymentReceiptPresentViewModel getPaymentReceiptDetails(int ReceiptID) { PaymentReceiptPresentViewModel reciptpresentViewModel; using (Entities.Entities ctx = new Entities.Entities()) { PaymentReceipt recipt = ctx.PaymentReceipts.Find(ReceiptID); if (recipt == null) { return(null); } reciptpresentViewModel = new PaymentReceiptPresentViewModel(); reciptpresentViewModel.receiptID = recipt.ReceiptID; reciptpresentViewModel.receiptAmount = recipt.Amount; reciptpresentViewModel.ReviceDate = recipt.Date; reciptpresentViewModel.reciverName = ctx.AspNetUsers.Where(x => x.Id == recipt.UserID).FirstOrDefault().UserName; } return(reciptpresentViewModel); }
private void submitLendingButton_Click(object sender, EventArgs e) { this.paymentReceipt.lendingReceipt.details = this.lendingDetails; ServiceResult <PaymentReceipt> result = paymentReceiptService.initialize(this.paymentReceipt); if (!result.isOk()) { this.renderErrors(result.messages); return; } this.paymentReceipt = result.model; result = paymentReceiptService.validate(this.paymentReceipt); if (!result.isOk()) { this.renderErrors(result.messages); return; } DatabaseOperationResult insertResult = paymentReceiptService.insert(this.paymentReceipt); if (!insertResult.isOk()) { return; } this.paymentReceipt = new PaymentReceipt(); this.renderBookSet(); this.customerModel = new Customer(); this.renderCustomerModel(); this.itemSetClearButton_Click(sender, e); this.employeeSet_SelectedIndexChanged(this.employeeSet, e); }
public Model mapModel(DataRow row) { PaymentReceipt receipt = new PaymentReceipt(); if (row == null) { return(receipt); } BaseDAO dao = Program.dao; receipt.id = row.Field <int>("id"); receipt.debtAmount = row.Field <Double>("debt_amount"); receipt.paymentAmount = row.Field <Double>("payment_amount"); receipt.employee = dao.getList <Employee>(typeof(Employee)) .Where(employee => employee.id == row.Field <int>("employee_id")) .FirstOrDefault(); receipt.lendingReceipt = dao.getList <LendingReceipt>(typeof(LendingReceipt)) .Where(lendingReceipt => lendingReceipt.id == row.Field <int>("lending_receipt_id")) .FirstOrDefault(); receipt.isActive = row.Field <bool>("is_active"); return(receipt); }