public static Payment CreatePayment(DateTime entryDate, DateTime transactionDate, int processedToPartyRoleId, int processedByPartyRoleId, decimal totalAmount, PaymentType paymentType, PaymentMethodType paymentMethodType, SpecificPaymentType specificPaymentType, string paymentReferenceNumber) { Payment newPayment = new Payment(); newPayment.EntryDate = entryDate; newPayment.TransactionDate = transactionDate; newPayment.ProcessedToPartyRoleId = processedToPartyRoleId; newPayment.ProcessedByPartyRoleId = processedByPartyRoleId;//partytroleID of teller newPayment.TotalAmount = totalAmount; newPayment.PaymentTypeId = paymentType.Id; newPayment.PaymentMethodTypeId = paymentMethodType.Id; newPayment.SpecificPaymentTypeId = specificPaymentType.Id; newPayment.PaymentReferenceNumber = paymentReferenceNumber; return newPayment; }
public static void SaveToDisbursementCheques(DateTime transactdate, DateTime entrydate, Payment parent, List<AddChequesModel> Cheques, int processedTo, int processedby, SpecificPaymentType specifictype, DisbursementType distype, string DisbursedToName, int CurrencyId) { foreach (var cheque in Cheques) { PaymentMethodType type = PaymentMethodType.PayCheckType; if (cheque.CheckType == PaymentMethodType.PersonalCheckType.Name) type = PaymentMethodType.PersonalCheckType; Payment chequepayment = new Payment(); chequepayment.PaymentMethodType = type; chequepayment.Payment2 = parent; chequepayment.ProcessedToPartyRoleId = processedTo; chequepayment.ProcessedByPartyRoleId = processedby; chequepayment.PaymentReferenceNumber = cheque.CheckNumber; chequepayment.TransactionDate = transactdate; chequepayment.EntryDate = entrydate; chequepayment.TotalAmount = cheque.Amount; chequepayment.PaymentType = PaymentType.Disbursement; chequepayment.SpecificPaymentType = specifictype; ObjectContext.Payments.AddObject(chequepayment); Disbursement disbursement = new Disbursement(); disbursement.Payment = chequepayment; disbursement.DisbursementType = distype; if (string.IsNullOrEmpty(DisbursedToName) == false) disbursement.DisbursedToName = DisbursedToName; ObjectContext.Disbursements.AddObject(disbursement); Cheque newCheque = new Cheque(); newCheque.BankPartyRoleId = cheque.BankPartyRoleId; newCheque.Payment = chequepayment; newCheque.CheckDate = cheque.CheckDate; ObjectContext.Cheques.AddObject(newCheque); ChequeStatu newChequeStatus = new ChequeStatu(); newChequeStatus.Cheque = newCheque; newChequeStatus.CheckStatusTypeId = ChequeStatusType.ClearedType.Id; newChequeStatus.TransitionDateTime = entrydate; newChequeStatus.IsActive = true; ObjectContext.ChequeStatus.AddObject(newChequeStatus); Currency.CreatePaymentCurrencyAssoc(chequepayment, CurrencyId); } }
// without currency and associated cheque public static Payment SaveToDisburseCash(DateTime transactdate, DateTime entrydate, Payment parent, int processedTo, int processedby, decimal AmountTodisburse, SpecificPaymentType specifictype, DisbursementType distype, string DisbursedToName) { Payment cashpayment = new Payment(); cashpayment.PaymentMethodType = PaymentMethodType.CashType; cashpayment.Payment2 = parent; cashpayment.ProcessedToPartyRoleId = processedTo; cashpayment.ProcessedByPartyRoleId = processedby; cashpayment.TransactionDate = transactdate; cashpayment.EntryDate = entrydate; cashpayment.TotalAmount = AmountTodisburse; cashpayment.PaymentType = PaymentType.Disbursement; cashpayment.SpecificPaymentType = specifictype; ObjectContext.Payments.AddObject(cashpayment); Disbursement disbursement = new Disbursement(); disbursement.Payment = cashpayment; disbursement.DisbursementType = distype; if (string.IsNullOrEmpty(DisbursedToName) == false) disbursement.DisbursedToName = DisbursedToName; ObjectContext.Disbursements.AddObject(disbursement); return cashpayment; }
// With currency public static Payment SaveToDisburseCash(DateTime transactdate, DateTime entrydate, Payment parent, int processedTo, int processedby, decimal AmountTodisburse, SpecificPaymentType specifictype,DisbursementType distype, string DisbursedToName, int CurrencyId) { Payment cashpayment = SaveToDisburseCash(transactdate, entrydate, parent, processedTo, processedby, AmountTodisburse, specifictype, distype, DisbursedToName); Currency.CreatePaymentCurrencyAssoc(cashpayment, CurrencyId); return cashpayment; }
//with associated cheque but no currency public static void SaveToDisburseCash(DateTime transactdate, DateTime entrydate, Payment parent, string CheckNumber, int processedTo, int processedby, decimal AmountTodisburse, SpecificPaymentType specifictype, DisbursementType distype, string DisbursedToName) { Payment payment = SaveToDisburseCash(transactdate, entrydate, parent, processedTo, processedby, AmountTodisburse, specifictype, distype, DisbursedToName); if (string.IsNullOrEmpty(CheckNumber) == false) payment.PaymentReferenceNumber = CheckNumber; }