public ActionResult CustomerUpdate() { Validation_update b = new Validation_update(); CustomerDetails_3 o = new CustomerDetails_3(); try { int i = Convert.ToInt32(Session["custid"]); o = db.CustomerDetails_3.Find(i); b.CustomerID_3 = o.CustomerID_3; b.OldCustomerName_3 = o.CustomerName_3; b.OldAge_3 = o.Age_3; b.OldCustomerAddress_3 = o.CustomerAddress_3; b.Message_3 = o.Message_3; b.Status_3 = o.Status_3; b.CustomerSSID_3 = o.CustomerSSID_3; if (o == null) { TempData["AlertMessage"] = 6; return(RedirectToAction("SearchUpdate")); } } catch (Exception ex) { Response.Write("<script>alert('Enter valid Account Id')</script>"); } return(View(b)); }
public ActionResult SearchCustomer(FormCollection f) { if (f["CheckMethod"] == "CustomerID") { try { TempData["id"] = f["CustomerID"]; CustomerDetails_3 p = db.CustomerDetails_3.Find(Convert.ToInt64(f["CustomerID"])); if (p == null) { TempData["AlertMessage"] = 98; return(RedirectToAction("SearchCustomer")); } else { return(RedirectToAction("SearchCustomer1")); } } catch (Exception ex) { TempData["AlertMessage"] = 98; return(RedirectToAction("SearchCustomer")); } } else if (f["CheckMethod"] == "CustomerSSID") { try { TempData["id"] = f["CustomerSSID"]; long id1 = Convert.ToInt64(f["CustomerSSID"]); ObjectParameter d = new ObjectParameter("cusid", 0); long cusid = Convert.ToInt64(db.sp_findcustid(id1, d)); if (cusid == 0) { TempData["AlertMessage"] = 100; return(RedirectToAction("SearchCustomer")); } return(RedirectToAction("SearchCustomer1")); } catch (Exception ex) { TempData["AlertMessage"] = 100; return(RedirectToAction("SearchCustomer")); } } else { Response.Write("<script>alert('Select the Account Selection type!!')</script>"); return(View()); } return(View()); }
public ActionResult CustomerDelete(CustomerDetails_3 c) { try { CustomerDetails_3 o = new CustomerDetails_3(); int i = Convert.ToInt32(Session["custid"]); o = db.CustomerDetails_3.Find(i); return(View(o)); } catch (Exception ex) { TempData["AlertMessage"] = 99; return(RedirectToAction("CustomerDelete")); } }
public ActionResult CreateCustomer(CustomerDetails_3 c, FormCollection f) { //c.State_3 = f["State_Name_3"]; // c.City_3 = f["City_Name_3"]; int state_id = Convert.ToInt32(c.State_3); int city_id = Convert.ToInt32(c.City_3); var temp = db.Select_State_3.Where(a => a.State_ID_3 == state_id).ToList(); if (temp != null) { foreach (var l in temp) { c.State_3 = l.State_Name_3; } } var temp1 = db.Select_City_3.Where(x => x.City_ID_3 == city_id).ToList(); if (temp1 != null) { foreach (var l in temp1) { c.City_3 = l.City_Name_3; } } if (ModelState.IsValid) { ObjectParameter op = new ObjectParameter("CustomerID_3", 0); db.create_customer_3(c.CustomerSSID_3, c.CustomerName_3, c.Age_3, c.CustomerAddress_3, c.State_3, c.City_3, op); db.SaveChanges(); ModelState.Clear(); if (Convert.ToInt32(op.Value) == 0) { Response.Write("<script>alert('Registration Unsuccessful!!! Try Re-Registering')</script>"); } else { Response.Write("<script>alert('Registration Successful!!! The Customer ID is : " + op.Value + "')</script>"); State_List(); return(View()); } } State_List(); return(View()); }
public ActionResult CustomerStatus(CustomerDetails_3 c) { ObjectResult o = db.View_Status_3(); return(View(o)); }