Ejemplo n.º 1
0
        public long InsertUpdateTempReceiptPayment(PharmaBusinessObjects.Transaction.ReceiptPayment.ReceiptPaymentItem receiptPayment)
        {
            try
            {
                long receiptPaymentID = 0;

                using (PharmaDBEntities context = new PharmaDBEntities())
                {
                    var receiptPaymentDB = context.TempReceiptPayment.Where(x => x.ReceiptPaymentID == receiptPayment.ReceiptPaymentID).FirstOrDefault();

                    if (receiptPaymentDB != null)
                    {
                        receiptPaymentDB.PaymentMode = receiptPayment.PaymentMode;
                        receiptPaymentDB.Ammount     = receiptPayment.Amount;
                        receiptPaymentDB.BankAccountLedgerTypeCode = receiptPayment.BankAccountLedgerTypeCode;
                        receiptPaymentDB.BankAccountLedgerTypeName = receiptPayment.BankAccountLedgerTypeName;
                        receiptPaymentDB.ChequeNumber     = receiptPayment.ChequeNumber;
                        receiptPaymentDB.ChequeDate       = receiptPayment.ChequeDate;
                        receiptPaymentDB.UnadjustedAmount = receiptPayment.UnadjustedAmount;

                        context.SaveChanges();
                        receiptPaymentID = receiptPaymentDB.ReceiptPaymentID;
                    }
                    else
                    {
                        Entity.TempReceiptPayment receiptPaymentDBEntry = new Entity.TempReceiptPayment()
                        {
                            VoucherNumber             = "TPVOCHER",
                            VoucherTypeCode           = receiptPayment.VoucherTypeCode,
                            VoucherDate               = receiptPayment.VoucherDate,
                            LedgerType                = receiptPayment.LedgerType,
                            LedgerTypeCode            = receiptPayment.LedgerTypeCode,
                            LedgerTypeName            = receiptPayment.LedgerTypeName,
                            PaymentMode               = receiptPayment.PaymentMode,
                            BankAccountLedgerTypeCode = receiptPayment.BankAccountLedgerTypeCode,
                            BankAccountLedgerTypeName = receiptPayment.BankAccountLedgerTypeName,
                            CreatedBy = LoggedInUser.Username,
                            CreatedOn = DateTime.Now
                        };

                        context.TempReceiptPayment.Add(receiptPaymentDBEntry);
                        context.SaveChanges();
                        receiptPaymentID = receiptPaymentDBEntry.ReceiptPaymentID;
                    }
                }
                return(receiptPaymentID);
            }
            catch (DbEntityValidationException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 2
0
 public long InsertUpdateTempReceiptPayment(PharmaBusinessObjects.Transaction.ReceiptPayment.ReceiptPaymentItem receiptPayment)
 {
     try
     {
         return(new ReceiptPaymentBiz(this.LoggedInUser).InsertUpdateTempReceiptPayment(receiptPayment));
     }
     catch (Exception)
     {
         throw;
     }
 }
Ejemplo n.º 3
0
 internal long InsertUpdateTempReceiptPayment(PharmaBusinessObjects.Transaction.ReceiptPayment.ReceiptPaymentItem receiptPayment)
 {
     return(new ReceiptPaymentDao(this.LoggedInUser).InsertUpdateTempReceiptPayment(receiptPayment));
 }