コード例 #1
0
        private static BankAccount getEntityByModel(BankAccountViewModel model)
        {
            if (model == null) return null;

            BankAccount entity = new BankAccount();

            if (model.Id == 0)
            {
                entity.CompanyId = AuthenticationHelper.CompanyId.Value;
                entity.CreateBy = AuthenticationHelper.UserId;
                entity.CreateDate = DateTime.Now;
            }
            else
            {
                entity.CompanyId = model.CompanyId;
                entity.CreateBy = model.CreateBy;
                entity.CreateDate = model.CreateDate;
            }

            entity.AccountName = model.AccountName;
            entity.AdditionalInformation = model.AdditionalInformation;
            entity.BankId = model.BankId;
            entity.Cash_CCID = model.Cash_CCID;
            entity.Confirm_CCID = model.Confirm_CCID;
            entity.EndDate = model.EndDate;
            entity.Id = model.Id;
            entity.RemitCash_CCID = model.RemitCash_CCID;
            entity.StartDate = model.StartDate;
            entity.UpdateBy = AuthenticationHelper.UserId;
            entity.UpdateDate = DateTime.Now;

            return entity;
        }
コード例 #2
0
 public ActionResult Create(BankAccountViewModel model)
 {
     if (ModelState.IsValid)
     {
         string result = "";
         BankModel bank = BankHelper.GetBank(model.BankId.ToString());
         if ((model.StartDate >= bank.StartDate && model.EndDate <= bank.EndDate) ||
             (model.StartDate == null && bank.StartDate == null ||
             model.EndDate == null && bank.EndDate == null))
         {
             result = BankHelper.SaveBankAccount(model);
             return RedirectToAction("Index", new { Id = model.BankId });
         }
         else
         {
             ModelState.AddModelError("Error", "Bank Account Dates should be within the range of Bank Dates.");
         }
     }
     return View(model);
 }
コード例 #3
0
 public static string SaveBankAccount(BankAccountViewModel model)
 {
     if (model.Id > 0)
         return bankAccountService.Update(getEntityByModel(model));
     else
         return bankAccountService.Insert(getEntityByModel(model));
 }
コード例 #4
0
 public static BankAccountViewModel GetBankAccount(string bankAccountId)
 {
     BankAccountViewModel bankAccount = new BankAccountViewModel(bankAccountService.GetSingle(bankAccountId, AuthenticationHelper.CompanyId.Value));
     return bankAccount;
 }
コード例 #5
0
 public ActionResult Create(long bankId)
 {
     BankAccountViewModel bankAccount = new BankAccountViewModel();
     if (bankAccount.CodeCombinition == null)
     {
         BankModel bank = BankHelper.GetBank(bankId.ToString());
         bankAccount.CodeCombinition = CodeCombinationHelper.GetAccounts(SessionHelper.SOBId, bank.StartDate, bank.EndDate).ToList();
     }
     bankAccount.BankId = bankId;
     return View(bankAccount);
 }