예제 #1
0
        public ActionResult SavingsAdmin(Savings data)
        {
            List <Savings> ret = new List <Savings>();

            ret = SavingsCotrollerSql.GetAll(data.MemberId);
            return(Json(new { data = ret }, JsonRequestBehavior.AllowGet));
        }
예제 #2
0
        public ActionResult Savings(Savings contribution, FormCollection fc)
        {
            bool           status = false;
            List <Savings> contr  = new List <Savings>();

            contr = SavingsCotrollerSql.GetAll();
            int     id    = contr.Count + 1;
            int     mid   = Convert.ToInt32(fc["MemberId"]);
            string  name  = Convert.ToString(Session["Fullname"]);
            string  sid   = "C" + id.ToString();
            Savings model = new Savings
            {
                SavingsId   = sid,
                SavingsDate = DateTime.Now,
                SavingsAmt  = contribution.SavingsAmt,
                MemberId    = mid,
                Deleted     = 0,
                CreatedBy   = name
            };

            status = SavingsCotrollerSql.Insert(model);
            if (status == true)
            {
                Response.Write("<script>alert('You have successfully add the savings');</script>");
            }
            return(View());
        }
예제 #3
0
        public ActionResult GetSavings()
        {
            int            id  = Convert.ToInt32(Session["MemberId"]);
            List <Savings> ret = new List <Savings>();

            ret = SavingsCotrollerSql.GetAll(id);
            return(Json(new { data = ret }, JsonRequestBehavior.AllowGet));
        }
예제 #4
0
        public JsonResult Delete(Savings data)
        {
            bool status = false;

            status = SavingsCotrollerSql.UpdateStatus(data.Id);
            return(new JsonResult {
                Data = status, JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
예제 #5
0
        // GET: Loan
        public ActionResult Loan()
        {
            List <Savings> save = new List <Savings>();

            save = SavingsCotrollerSql.GetAll();
            if (save.Count != 0)
            {
                decimal total = 0;
                for (int i = 0; i <= save.Count - 1; i++)
                {
                    total += save[i].SavingsAmt;
                }
                if (total >= 15000)
                {
                    string      memberid = Convert.ToString(Session["MemberId"]);
                    List <Loan> loanlist = new List <Loan>();
                    loanlist = LoanControllerSql.GetAll(memberid);
                    if (loanlist.Count == 0)
                    {
                        List <Member> mem = new List <Member>();
                        mem              = MemberControllerSql.GetAll(Convert.ToInt32(Session["MemberId"]));
                        ViewBag.Id       = Convert.ToInt32(Session["MemberId"]);
                        ViewBag.Fullname = Convert.ToString(Session["Fullname"]);
                        ViewBag.Members  = mem;
                        return(View());
                    }
                    else
                    {
                        Session["alert"] = "1";
                        return(RedirectToAction("Home", "Member"));
                    }
                }
                else
                {
                    Session["alert1"] = "1";
                    return(RedirectToAction("Home", "Member"));
                }
            }
            else
            {
                Session["alert1"] = "1";
                return(RedirectToAction("Home", "Member"));
            }
        }
예제 #6
0
        // GET: Withdraw
        public ActionResult Withdraw()
        {
            int             id    = Convert.ToInt32(Session["MemberId"]);
            List <Withdraw> with1 = new List <Withdraw>();

            with1 = WithdrawControllerSql.Check(id);
            if (with1.Count == 0)
            {
                decimal        totalsavings = 0;
                List <Savings> savings      = new List <Savings>();
                savings = SavingsCotrollerSql.GetAll(id);
                if (savings.Count > 0)
                {
                    for (int i = 0; i <= savings.Count - 1; i++)
                    {
                        totalsavings += savings[i].SavingsAmt;
                    }
                }
                List <Withdraw> with = new List <Withdraw>();
                with = WithdrawControllerSql.GetAll(id);
                if (with.Count > 0)
                {
                    for (int i = 0; i <= with.Count - 1; i++)
                    {
                        totalsavings -= with[i].WithdrawAmt;
                    }
                }
                ViewBag.Fullname = Convert.ToString(Session["Fullname"]);
                ViewBag.Total    = totalsavings;
                return(View());
            }
            else
            {
                Session["withdrawstatus"] = "1";
                return(RedirectToAction("Home", "Member"));
            }
        }