示例#1
0
        public ActionResult customerEdit(sp_viewbyid_CustomerTable_group2_Result tablecustomer)
        {
            try
            {
                ViewBag.username = Session["userName"];
                ObjectParameter retCustID = new ObjectParameter("customeridout", typeof(int));

                DateTime date = new DateTime();
                date = Convert.ToDateTime(tablecustomer.Dob);
                int age = DateTime.Today.Year - date.Year;
                if (age < 18 || age > 90 || age == 0)
                {
                    ViewBag.Show = "Customer is not in the age range of 18 to 90";
                    return(View());
                }
                else
                {
                    int State = Convert.ToInt32(Request.Form["State"]);
                    int City  = Convert.ToInt32(Request.Form["City"]);


                    int res = bank.sp_CustomerTable_group2(tablecustomer.CustomerID, tablecustomer.AadhaarID, tablecustomer.CustomerName,
                                                           tablecustomer.Dob, tablecustomer.AddressLine1, tablecustomer.AddressLine2, State, City,
                                                           tablecustomer.Contact, tablecustomer.Email, retCustID);
                    this.bank.SaveChanges();

                    TempData["Message"] = "Customer Updated Successfully";
                    return(RedirectToAction("ListCustomer"));
                }
            }
            catch (Exception e)
            {
                throw e;
            }
        }
示例#2
0
        public ActionResult Delete(long id, sp_viewbyid_CustomerTable_group2_Result byid)
        {
            try
            {
                ViewBag.username = Session["userName"];
                if (byid.NoofAccounts == 0)
                {
                    int res = bank.sp_deletebyid_CustomerTable_group2(id);
                    this.bank.SaveChanges();

                    TempData["Mess5"] = "Customer Deactivated Succesfully";
                    return(RedirectToAction("ListCustomer"));
                }
                else
                {
                    TempData["mess6"] = "Unable To Delete as the account has money";
                    return(View());
                }
            }

            catch (Exception e)
            {
                throw e;
            }
        }
示例#3
0
 public ActionResult Delete(long?id)
 {
     try
     {
         ViewBag.username = Session["userName"];
         if (Session["userName"] != null && Session["userroleId"].ToString() == "1")
         {
             if (id != null)
             {
                 sp_viewbyid_CustomerTable_group2_Result byid = new sp_viewbyid_CustomerTable_group2_Result();
                 byid = bank.sp_viewbyid_CustomerTable_group2(id).FirstOrDefault();
                 return(View(byid));
             }
         }
         else
         {
             return(Redirect("../login/login"));
         }
         return(View());
     }
     catch (Exception e)
     {
         throw e;
     }
 }
示例#4
0
        public ActionResult customerEdit(long?id)
        {
            ViewBag.username = Session["userName"];

            if (Session["userName"] != null && Session["userroleId"].ToString() == "1")
            {
                try
                {
                    sp_viewbyid_CustomerTable_group2_Result ob = bank.sp_viewbyid_CustomerTable_group2(id).FirstOrDefault();
                    Session["state"] = ob.State;
                    Session["city"]  = ob.City;

                    return(View(ob));
                }
                catch (Exception e)
                {
                    throw e;
                }
            }
            else
            {
                return(Redirect("/login/login"));
            }
        }