예제 #1
0
        public ActionResult InfoBank(FormCollection collection)
        {
            if (Session["dangnhap"] == null)
            {
                return(RedirectToAction("login", "home"));
            }
            if (!Equals(Session["idLevel"], 2))
            {
                return(RedirectToAction("Error404", "home"));
            }
            LoadInfoBank();
            var ten      = collection["nameBank"];
            var stk      = collection["numberBank"];
            var sohuu    = collection["ownerBank"];
            var chinhanh = collection["ChiNhanhBank"];

            if (ten.Length > 60)
            {
                ViewData["Err"] = "(*) Tên ngân hàng không vượt quá 60 ký tự !";
                return(View());
            }
            else if (stk.Length > 20)
            {
                ViewData["Err"] = "(*) Số tài khoản không vượt quá 20 ký tự !";
                return(View());
            }
            else if (sohuu.Length > 60)
            {
                ViewData["Err"] = "(*) Tên chủ sở hữu không vượt quá 60 ký tự !";
                return(View());
            }
            else if (chinhanh.Length > 30)
            {
                ViewData["Err"] = "(*) Tên chi nhánh không vượt quá 30 ký tự !";
                return(View());
            }

            if (String.IsNullOrEmpty(ten) || String.IsNullOrEmpty(stk) || String.IsNullOrEmpty(sohuu) || String.IsNullOrEmpty(chinhanh))
            {
                ViewData["Err"] = "(*) Vui lòng nhập đầy đủ thông tin !";
                return(View());
            }

            InfoBank bank = new InfoBank();

            bank.nameBank     = ten;
            bank.numberBank   = stk;
            bank.ownerBank    = sohuu;
            bank.ChiNhanhBank = chinhanh;
            db.InfoBanks.InsertOnSubmit(bank);
            db.SubmitChanges();
            return(RedirectToAction("InfoBank", "admin"));
        }
예제 #2
0
        public void Insert(string BankName,int? UserKeyUpdated,DateTime? LastChanged,string BankDescription)
        {
            InfoBank item = new InfoBank();

            item.BankName = BankName;

            item.UserKeyUpdated = UserKeyUpdated;

            item.LastChanged = LastChanged;

            item.BankDescription = BankDescription;

            item.Save(UserName);
        }
예제 #3
0
        public void Update(int InfoBankKey,string BankName,int? UserKeyUpdated,DateTime? LastChanged,string BankDescription)
        {
            InfoBank item = new InfoBank();
            item.MarkOld();
            item.IsLoaded = true;

            item.InfoBankKey = InfoBankKey;

            item.BankName = BankName;

            item.UserKeyUpdated = UserKeyUpdated;

            item.LastChanged = LastChanged;

            item.BankDescription = BankDescription;

            item.Save(UserName);
        }