Exemplo n.º 1
0
        public ActionResult ConfirmDeleteBank(int PrimaryID)
        {
            Tbl_FMBank_Banks bankss = (from a in BOSSDB.Tbl_FMBank_Banks where a.BankID == PrimaryID select a).FirstOrDefault();

            BOSSDB.Tbl_FMBank_Banks.Remove(bankss);
            BOSSDB.SaveChanges();

            var result = "";

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 2
0
        public ActionResult DeleteBank(int PrimaryID)
        {
            Tbl_FMBank_Banks        banks     = (from a in BOSSDB.Tbl_FMBank_Banks where a.BankID == PrimaryID select a).FirstOrDefault();
            Tbl_FMBank_BankAccounts bankaccnt = (from a in BOSSDB.Tbl_FMBank_BankAccounts where a.BankID == PrimaryID select a).FirstOrDefault();
            //Tbl_FMBrgy_BrgyBankAccount brgy = (from a in BOSSDB.Tbl_FMBrgy_BrgyBankAccount where a.BankID == PrimaryID select a).FirstOrDefault();

            var confirmDelete = "";

            if (banks != null)
            {
                if (bankaccnt != null)
                {
                    confirmDelete = "true";
                }
                else
                {
                    confirmDelete = "false";
                }
            }
            var result = new { confirmDelete = confirmDelete };

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 3
0
        public ActionResult SaveBank(BanksModel model)
        {
            var isExist = "";

            if (ModelState.IsValid)
            {
                var bankTitle = model.BankList.BankTitle;
                var bankCode  = model.BankList.BankCode;
                var bankAdd   = model.BankList.BankAddress;

                Tbl_FMBank_Banks checkBanks = (from a in BOSSDB.Tbl_FMBank_Banks where (a.BankTitle == bankTitle && a.BankAddress == bankAdd) select a).FirstOrDefault();

                if (model.ActionID == 1)
                {
                    if (checkBanks == null)
                    {
                        Tbl_FMBank_Banks bank = new Tbl_FMBank_Banks();
                        bank.BankTitle   = bankTitle;
                        bank.BankCode    = bankCode;
                        bank.BankAddress = bankAdd;
                        BOSSDB.Tbl_FMBank_Banks.Add(bank);
                        BOSSDB.SaveChanges();
                        isExist = "false";
                    }
                    else if (checkBanks != null)
                    {
                        isExist = "true";
                    }
                }
                else if (model.ActionID == 2)
                {
                    Tbl_FMBank_Banks        bankii         = (from a in BOSSDB.Tbl_FMBank_Banks where a.BankID == model.BankList.BankID select a).FirstOrDefault();
                    List <Tbl_FMBank_Banks> banktitleCount = (from e in BOSSDB.Tbl_FMBank_Banks where e.BankTitle == bankTitle select e).ToList();
                    List <Tbl_FMBank_Banks> bankaddCount   = (from e in BOSSDB.Tbl_FMBank_Banks where e.BankAddress == bankAdd select e).ToList();
                    if (checkBanks != null)
                    {
                        if (bankii.BankTitle == bankTitle && bankii.BankCode == bankCode && bankii.BankAddress == bankAdd)
                        {
                            isExist = "justUpdate";
                        }
                        else
                        {
                            if (bankii.BankTitle != bankTitle && banktitleCount.Count >= 1 || bankii.BankAddress != bankAdd && bankaddCount.Count >= 1)
                            {
                                isExist = "true";
                            }
                            else
                            {
                                isExist = "justUpdate";
                            }
                        }
                    }
                    else if (checkBanks == null)
                    {
                        isExist = "justUpdate";
                    }

                    if (isExist == "justUpdate")
                    {
                        bankii.BankTitle   = bankTitle;
                        bankii.BankCode    = bankCode;
                        bankii.BankAddress = bankAdd;
                        BOSSDB.Entry(bankii);
                        BOSSDB.SaveChanges();
                    }
                }
            }
            return(new JsonResult()
            {
                JsonRequestBehavior = JsonRequestBehavior.AllowGet,
                Data = new { isExist = isExist }
            });
        }