public ActionResult AddSpartan_RDM_Filters_Detail(int rowIndex = 0, int functionMode = 0, int id = 0) { int ModuleId = (Session["CurrentModuleId"] != null) ? Convert.ToInt32(Session["CurrentModuleId"]) : 0; ViewBag.currentRowIndex = rowIndex; ViewBag.functionMode = functionMode; ViewBag.Consult = false; var permission = PermissionHelper.GetRoleObjectPermission(SessionHelper.Role, 45362); ViewBag.Permission = permission; if (!_tokenManager.GenerateToken()) { return(null); } _ISpartan_RDM_Filters_DetailApiConsumer.SetAuthHeader(_tokenManager.Token); Spartan_RDM_Filters_DetailModel varSpartan_RDM_Filters_Detail = new Spartan_RDM_Filters_DetailModel(); if (id.ToString() != "0") { var Spartan_RDM_Filters_DetailsData = _ISpartan_RDM_Filters_DetailApiConsumer.ListaSelAll(0, 1000, "Spartan_RDM_Filters_Detail.Filters_Detail_Id=" + id, "").Resource.Spartan_RDM_Filters_Details; if (Spartan_RDM_Filters_DetailsData != null && Spartan_RDM_Filters_DetailsData.Count > 0) { var Spartan_RDM_Filters_DetailData = Spartan_RDM_Filters_DetailsData.First(); varSpartan_RDM_Filters_Detail = new Spartan_RDM_Filters_DetailModel { Filters_Detail_Id = Spartan_RDM_Filters_DetailData.Filters_Detail_Id , Field_Name = Spartan_RDM_Filters_DetailData.Field_Name , Field_NameDescription = CultureHelper.GetTraduction(Convert.ToString(Spartan_RDM_Filters_DetailData.Field_Name), "Spartan_Attribute_Bypass") ?? (string)Spartan_RDM_Filters_DetailData.Field_Name_Spartan_Attribute_Bypass.Description , Field_Label = Spartan_RDM_Filters_DetailData.Field_Label , Order_Shown = Spartan_RDM_Filters_DetailData.Order_Shown , Field_Path = Spartan_RDM_Filters_DetailData.Field_Path , Physical_Field_Name = Spartan_RDM_Filters_DetailData.Physical_Field_Name , Logical_Field_Name = Spartan_RDM_Filters_DetailData.Logical_Field_Name }; } } if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } _ISpartan_Attribute_BypassApiConsumer.SetAuthHeader(_tokenManager.Token); var Spartan_Attribute_Bypasss_Field_Name = _ISpartan_Attribute_BypassApiConsumer.SelAll(true); if (Spartan_Attribute_Bypasss_Field_Name != null && Spartan_Attribute_Bypasss_Field_Name.Resource != null) { ViewBag.Spartan_Attribute_Bypasss_Field_Name = Spartan_Attribute_Bypasss_Field_Name.Resource.Where(m => m.Description != null).OrderBy(m => m.Description).Select(m => new SelectListItem { Text = CultureHelper.GetTraduction(Convert.ToString(m.AttributeId), "Spartan_Attribute_Bypass", "Description") ?? m.Description.ToString(), Value = Convert.ToString(m.AttributeId) }).ToList(); } return(PartialView("AddSpartan_RDM_Filters_Detail", varSpartan_RDM_Filters_Detail)); }
public ActionResult Post(bool IsNew, Spartan_RDM_Filters_DetailModel varSpartan_RDM_Filters_Detail) { try { if (ModelState.IsValid) { if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } _ISpartan_RDM_Filters_DetailApiConsumer.SetAuthHeader(_tokenManager.Token); var result = ""; var Spartan_RDM_Filters_DetailInfo = new Spartan_RDM_Filters_Detail { Filters_Detail_Id = varSpartan_RDM_Filters_Detail.Filters_Detail_Id , Field_Name = varSpartan_RDM_Filters_Detail.Field_Name , Field_Label = varSpartan_RDM_Filters_Detail.Field_Label , Order_Shown = varSpartan_RDM_Filters_Detail.Order_Shown , Field_Path = varSpartan_RDM_Filters_Detail.Field_Path , Physical_Field_Name = varSpartan_RDM_Filters_Detail.Physical_Field_Name , Logical_Field_Name = varSpartan_RDM_Filters_Detail.Logical_Field_Name }; result = !IsNew? _ISpartan_RDM_Filters_DetailApiConsumer.Update(Spartan_RDM_Filters_DetailInfo, null, null).Resource.ToString() : _ISpartan_RDM_Filters_DetailApiConsumer.Insert(Spartan_RDM_Filters_DetailInfo, null, null).Resource.ToString(); return(Json(result, JsonRequestBehavior.AllowGet)); } return(Json(false, JsonRequestBehavior.AllowGet)); } catch (ServiceException ex) { return(Json(false, JsonRequestBehavior.AllowGet)); } }
public ActionResult Create(int Id = 0, int consult = 0) { int ModuleId = (Session["CurrentModuleId"] != null) ? Convert.ToInt32(Session["CurrentModuleId"]) : 0; var permission = PermissionHelper.GetRoleObjectPermission(SessionHelper.Role, 45362); ViewBag.Permission = permission; var varSpartan_RDM_Filters_Detail = new Spartan_RDM_Filters_DetailModel(); ViewBag.ObjectId = "45362"; ViewBag.Operation = "New"; ViewBag.IsNew = true; if ((Id.GetType() == typeof(string) && Id.ToString() != "") || ((Id.GetType() == typeof(int) || Id.GetType() == typeof(Int16) || Id.GetType() == typeof(Int32) || Id.GetType() == typeof(Int64) || Id.GetType() == typeof(short)) && Id.ToString() != "0")) { ViewBag.IsNew = false; ViewBag.Operation = "Update"; if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } _ISpartan_RDM_Filters_DetailApiConsumer.SetAuthHeader(_tokenManager.Token); var Spartan_RDM_Filters_DetailData = _ISpartan_RDM_Filters_DetailApiConsumer.GetByKeyComplete(Id).Resource.Spartan_RDM_Filters_Details[0]; if (Spartan_RDM_Filters_DetailData == null) { return(HttpNotFound()); } varSpartan_RDM_Filters_Detail = new Spartan_RDM_Filters_DetailModel { Filters_Detail_Id = (int)Spartan_RDM_Filters_DetailData.Filters_Detail_Id , Field_Name = Spartan_RDM_Filters_DetailData.Field_Name , Field_NameDescription = CultureHelper.GetTraduction(Convert.ToString(Spartan_RDM_Filters_DetailData.Field_Name), "Spartan_Attribute_Bypass") ?? (string)Spartan_RDM_Filters_DetailData.Field_Name_Spartan_Attribute_Bypass.Description , Field_Label = Spartan_RDM_Filters_DetailData.Field_Label , Order_Shown = Spartan_RDM_Filters_DetailData.Order_Shown , Field_Path = Spartan_RDM_Filters_DetailData.Field_Path , Physical_Field_Name = Spartan_RDM_Filters_DetailData.Physical_Field_Name , Logical_Field_Name = Spartan_RDM_Filters_DetailData.Logical_Field_Name }; } if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } _ISpartan_Attribute_BypassApiConsumer.SetAuthHeader(_tokenManager.Token); var Spartan_Attribute_Bypasss_Field_Name = _ISpartan_Attribute_BypassApiConsumer.SelAll(true); if (Spartan_Attribute_Bypasss_Field_Name != null && Spartan_Attribute_Bypasss_Field_Name.Resource != null) { ViewBag.Spartan_Attribute_Bypasss_Field_Name = Spartan_Attribute_Bypasss_Field_Name.Resource.Where(m => m.Description != null).OrderBy(m => m.Description).Select(m => new SelectListItem { Text = CultureHelper.GetTraduction(Convert.ToString(m.AttributeId), "Spartan_Attribute_Bypass", "Description") ?? m.Description.ToString(), Value = Convert.ToString(m.AttributeId) }).ToList(); } ViewBag.Consult = consult == 1; if (consult == 1) { ViewBag.Operation = "Consult"; } return(View(varSpartan_RDM_Filters_Detail)); }