public Object EditRecord(Int64 SizeID) { PropertySizeMaster _Size = new PropertySizeMaster(); try { PropertySize size = DAL.DALPropertySize.EditPropertySize(Convert.ToInt32(SizeID)); _Size.ID = size.ID; if (!String.IsNullOrEmpty(size.PropertySize1)) { _Size.PropertySize = size.PropertySize1; } if (size.ClientID != null) { _Size.ClientID = size.ClientID; } if (size.SiteID != null) { _Size.SiteID = size.SiteID; } } catch (Exception ex) { throw; } return _Size; }
public ActionResult Create(PropertySizeMaster model) { if (Session["Login"] != null) { if (String.IsNullOrEmpty(model.PropertySize)) { ModelState.AddModelError("Property Size", "Please Enter Property Size"); } if (ModelState.IsValid) { try { LoginSession loginsession = (LoginSession)Session["Login"]; model.CreateBy = Convert.ToInt64(loginsession.UserID); if (PropertySizeModel.CreatePropertySize(model)) { return Json(new { result = 1, message = "Record was successfully Saved!" }); } else { return Json(new { result = 0, message = "Duplicate Recored " }); } } catch (Exception ex) { return Json(new { result = 0, message = "ErrorMessage" + ":" + ex.StackTrace.ToString() }); } } else { String errorMessage = String.Empty; String exception = String.Empty; foreach (var modelStateVal in ViewData.ModelState.Values) { foreach (var error in modelStateVal.Errors) { errorMessage = error.ErrorMessage; exception = error.Exception.ToString(); } } return Json(new { result = 0, message = "ErrorMessage" + ":" + exception }); } } else { return RedirectToAction("Index", "Home"); } }
public ActionResult Edit(String Size_ID) { if (Session["Login"] != null) { LoginSession loginsession = (LoginSession)Session["Login"]; ViewBag.CompanyLogo = loginsession.CompanyLogo; ViewBag.Layout1 = BAL.Common.LayoutType(loginsession.UserType); String actionName = this.ControllerContext.RouteData.Values["action"].ToString(); String controllerName = this.ControllerContext.RouteData.Values["controller"].ToString(); ViewBag.Menu = BAL.Common.GetActiveMenu(controllerName, actionName, BAL.Common.LayoutType(loginsession.UserType)); ViewBag.RoleName = loginsession.RoleName; if (Size_ID != null) { String Dec_SizeID = BAL.Security.URLDecrypt(Size_ID); if ((Dec_SizeID != "0") && (Dec_SizeID != null)) { PropertySizeMaster Size = new PropertySizeMaster(); try { Size = BAL.PropertySizeModel.EditPropertySize(Dec_SizeID); ViewBag.size_ID = Size.ID; if (loginsession.ClientID != null) { if (Size.ClientID != null) { ViewBag.Client = new SelectList(BAL.ClientModel.ClientDropDownList(loginsession.ClientID), "Value", "Text", Size.ClientID); ViewBag.ClientSelectID = Size.ClientID; } if (Size.SiteID != null) { ViewBag.SiteSelectID = Size.SiteID; ViewBag.Site = new SelectList(BAL.SiteModel.SiteDropDownList(loginsession.UserID.ToString(), Convert.ToInt64(Size.ClientID), loginsession.UserType, loginsession.RoleName), "Value", "Text", Size.SiteID); } } else { if (Size.ClientID != null) { ViewBag.Client = new SelectList(BAL.ClientModel.ClientDropDownList(), "Value", "Text", Size.ClientID); ViewBag.ClientSelectID = Size.ClientID; } if (Size.SiteID != null) { ViewBag.SiteSelectID = Size.SiteID; ViewBag.Site = new SelectList(BAL.SiteModel.SiteDropDownList(loginsession.UserID.ToString(), Convert.ToInt64(Size.ClientID), loginsession.UserType, loginsession.RoleName), "Value", "Text", Size.SiteID); } }//else } catch (Exception ex) { return Content(ex.Message); } return View(Size); } } { return RedirectToAction("Index", "PropertySize"); } } else { return RedirectToAction("Index", "Home"); } }
public ActionResult Update(PropertySizeMaster model) { if (Session["Login"] != null) { if (ModelState.IsValid) { try { LoginSession loginsession = (LoginSession)Session["Login"]; model.modifyBy = Convert.ToInt64(loginsession.UserID); if (PropertySizeModel.UpdatePropertySize(model)) { return RedirectToAction("Index", "PropertySize"); } else { // return Json(new { result = 0, message = "Duplicate Currency Name " }); return Content("Unable to save , try again"); } } catch (Exception ex) { return Content("ErrorMessage" + ":" + ex.StackTrace.ToString()); } } else { String errorMessage = String.Empty; String exception = String.Empty; foreach (var modelStateVal in ViewData.ModelState.Values) { foreach (var error in modelStateVal.Errors) { errorMessage = error.ErrorMessage; exception = error.Exception.ToString(); } } return Content("ErrorMessage" + ":" + exception); } } else { return RedirectToAction("Index", "Home"); } }
public static bool UpdatePropertySize(PropertySizeMaster Size) { Boolean flag = false; try { Icontext objinter = new BALPropertySize(); flag = objinter.UpdateRecord(Size); } catch (Exception ex) { throw; } return flag; }