public bool SavePaymentDetails(PaymentReceiptDetails result) { PaymentReceiptDetailsLibrary library = new PaymentReceiptDetailsLibrary(ConfigurationHelper.GetsmARTDBContextConnectionString()); if (result.Apply_Amount > 0) { library.Add(result); } return(true); }
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); }