Пример #1
0
        public bool InsertBankBookRow(TransactionInCheque chequeRecord)
        {
            int recordId = InsertLedgerRecord(chequeRecord);

            if (recordId > 0)
            {
                ChequeInfo chequeInfo    = chequeRecord.ChequeInfo;
                BankRecord dalBankRecord = chequeInfo == null
                                               ? new BankRecord
                {
                    RecordID = recordId
                }
                                               : new BankRecord
                {
                    RecordID   = recordId,
                    ChequeNo   = chequeRecord.ChequeInfo.ChequeNo,
                    BankName   = chequeRecord.ChequeInfo.BankName,
                    Branch     = chequeRecord.ChequeInfo.BankBranch,
                    ChequeDate = chequeRecord.ChequeInfo.Date
                };
                _db.AddToBankRecords(dalBankRecord);
                _db.SaveChanges();
                return(true);
            }
            return(false);
        }
        public ActionResult ChequeStore([Bind(Include = "Id,OrderId,Name,Address,City,State, ZipCode, Payer, ChequeCode, Amount, AmountByWord, BankName, Receiver, Image,CreatedAt,UpdatedAt")] ChequeInfo chequeInfo)
        {
            var orderId = chequeInfo.OrderId;

            if (ModelState.IsValid)
            {
                HttpContext.GetOwinContext().Get <ApplicationDbContext>().ChequeInfos.Add(chequeInfo);
                HttpContext.GetOwinContext().Get <ApplicationDbContext>().SaveChanges();
                ViewBag.Message = HttpContext.GetOwinContext().Get <ApplicationDbContext>().Orders.Find(orderId);
                return(View("ChequeFinish"));
            }

            Debug.WriteLine(orderId);
            ViewBag.OrderId = new SelectList(HttpContext.GetOwinContext().Get <ApplicationDbContext>().Orders.Where(o => o.Id == orderId), "Id", "CreatedAt");
            ViewBag.Message = HttpContext.GetOwinContext().Get <ApplicationDbContext>().Orders.Find(ViewBag.OrderId);
            return(View("~/Views/Checkout/Confirm.cshtml"));
        }
Пример #3
0
 public Record NewTransaction(IRecordRepository recordRepository, string bankBookOrCashBook, ChequeInfo chequeInfo = null)
 {
     Record transaction = default(Record);
     switch (bankBookOrCashBook)
     {
         case "BankBook":
             if (chequeInfo == null) throw new Exception("chequeInfo can not be null");
             transaction = new TransactionInCheque(recordRepository) { ChequeInfo = chequeInfo };
             break;
         case "CashBook":
             transaction = new TransactionInCash(recordRepository);
             break;
         default:
             throw new Exception("bankBookOrCashBook can be only BankBook or CashBook");
     }
     return transaction;
 }