Ejemplo n.º 1
0
        public ActionResult deposit(long?id, decimal?balamt)
        {
            try
            {
                ViewBag.username = Session["userName"];
                if (Session["userName"] != null && Session["userroleId"].ToString() == "2")
                {
                    cashierViewAccountbyId_group2_Result objAccount = new cashierViewAccountbyId_group2_Result();
                    if (id != null)
                    {
                        objAccount = bank.cashierViewAccountbyId_group2(id).FirstOrDefault();
                        return(View(objAccount));
                    }


                    return(View());
                }
                else
                {
                    return(Redirect("../login/login"));
                }
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Ejemplo n.º 2
0
        public ActionResult Withdraw(addaccount_group2 withd, long id, decimal?balamt)
        {
            try
            {
                cashierViewAccountbyId_group2_Result objAccount = new cashierViewAccountbyId_group2_Result();
                if (withd.DepositAmount < 0 || withd.DepositAmount > balamt || withd.DepositAmount == 0 || withd.DepositAmount == null)
                {
                    objAccount.AccountId     = withd.AccountId;
                    objAccount.DepositAmount = withd.DepositAmount;
                    ViewBag.messageinsuf     = "invalid amount";

                    return(View());
                }

                else
                {
//                    @AccountId bigint,
//@AccountType varchar(50),
//@TransactionType varchar(50),
//@amount money,
//@beforebalance money,
//@latestbalance money out
                    ObjectParameter objParam = new ObjectParameter("latestbalance", typeof(decimal));
                    int             result;
                    if (withd.AccountType == 1)
                    {
                        result = bank.sp_WithdrawAmount_group2(id, "Savings", "withdraw", withd.DepositAmount, balamt, objParam);
                    }
                    else
                    {
                        result = bank.sp_WithdrawAmount_group2(id, "Current", "withdraw", withd.DepositAmount, balamt, objParam);
                    }
                    if (result > 0)
                    {
                        this.bank.SaveChanges();
                        TempData["Messwith"] = "Successfully Withdrawn! The new available balance is Rs." + objParam.Value;
                    }
                    return(RedirectToAction("cashierView"));
                }
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Ejemplo n.º 3
0
 public ActionResult withdraw(long?id, decimal?balamt)
 {
     try
     {
         ViewBag.username = Session["userName"];
         if (Session["userName"] != null && Session["userroleId"].ToString() == "2")
         {
             cashierViewAccountbyId_group2_Result objaccount = new cashierViewAccountbyId_group2_Result();
             if (balamt == 0)
             {
                 TempData["Messagewithdraw"] = "Your balance is RS." + balamt;
                 return(RedirectToAction("cashierView"));
             }
             else
             {
                 if (id != null)
                 {
                     objaccount = bank.cashierViewAccountbyId_group2(id).FirstOrDefault();
                     int?transctns = bank.sp_Totaltransactions(objaccount.CustomerID, DateTime.Today.Date).FirstOrDefault();
                     int a         = transctns.GetValueOrDefault();
                     if (a > 3)
                     {
                         TempData["msg"] = "transactions limit has been reached";
                         return(RedirectToAction("cashierView"));
                     }
                     return(View(objaccount));
                 }
             }
             return(RedirectToAction("cashierView"));
         }
         else
         {
             return(Redirect("../login/login"));
         }
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Ejemplo n.º 4
0
        public ActionResult deposit(addaccount_group2 objTran, long id, decimal balamt)
        {
            try
            {
                ViewBag.username = Session["userName"];
                cashierViewAccountbyId_group2_Result objAccount = new cashierViewAccountbyId_group2_Result();
                if (objTran.DepositAmount <= 0 || objTran.DepositAmount > 100000 || objTran.DepositAmount == null)
                {
                    objAccount.AccountId     = objTran.AccountId;
                    objAccount.DepositAmount = objTran.DepositAmount;
                    ViewBag.message          = "enter valid amount";
                    return(View(objAccount));
                }
                else
                {
                    ObjectParameter objParam = new ObjectParameter("latestbalance", typeof(decimal));
                    int             result;
                    if (objTran.AccountType == 1)
                    {
                        result = bank.sp_Deposit_group2(id, "Savings ", "deposit", objTran.DepositAmount, balamt, objParam);
                    }
                    else
                    {
                        result = bank.sp_Deposit_group2(id, "Current ", "deposit", objTran.DepositAmount, balamt, objParam);
                    }
                    if (result > 0)
                    {
                        this.bank.SaveChanges();
                        TempData["Messdep"] = "Successfully Deposited! The new available balance is Rs." + objParam.Value;
                    }
                    return(RedirectToAction("cashierView"));
                }
            }

            catch (Exception e)
            {
                throw e;
            }
        }