public ActionResult Post(bool IsNew, Spartan_Report_Fields_DetailModel varSpartan_Report_Fields_Detail) { try { if (ModelState.IsValid) { if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } _ISpartan_Report_Fields_DetailApiConsumer.SetAuthHeader(_tokenManager.Token); var result = ""; var Spartan_Report_Fields_DetailInfo = new Spartan_Report_Fields_Detail { DesignDetailId = varSpartan_Report_Fields_Detail.DesignDetailId , PathField = varSpartan_Report_Fields_Detail.PathField , Physical_Name = varSpartan_Report_Fields_Detail.Physical_Name , Title = varSpartan_Report_Fields_Detail.Title , Function = varSpartan_Report_Fields_Detail.Function , Format = varSpartan_Report_Fields_Detail.Format , Order_Type = varSpartan_Report_Fields_Detail.Order_Type , Field_Type = varSpartan_Report_Fields_Detail.Field_Type , Order_Number = varSpartan_Report_Fields_Detail.Order_Number , AttributeId = varSpartan_Report_Fields_Detail.AttributeId }; result = !IsNew? _ISpartan_Report_Fields_DetailApiConsumer.Update(Spartan_Report_Fields_DetailInfo, null, null).Resource.ToString() : _ISpartan_Report_Fields_DetailApiConsumer.Insert(Spartan_Report_Fields_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 AddSpartan_Report_Fields_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, 34553); ViewBag.Permission = permission; if (!_tokenManager.GenerateToken()) { return(null); } _ISpartan_Report_Fields_DetailApiConsumer.SetAuthHeader(_tokenManager.Token); Spartan_Report_Fields_DetailModel varSpartan_Report_Fields_Detail = new Spartan_Report_Fields_DetailModel(); if (id.ToString() != "0") { var Spartan_Report_Fields_DetailsData = _ISpartan_Report_Fields_DetailApiConsumer.ListaSelAll(0, 1000, "Spartan_Report_Fields_Detail.DesignDetailId=" + id, "").Resource.Spartan_Report_Fields_Details; if (Spartan_Report_Fields_DetailsData != null && Spartan_Report_Fields_DetailsData.Count > 0) { var Spartan_Report_Fields_DetailData = Spartan_Report_Fields_DetailsData.First(); varSpartan_Report_Fields_Detail = new Spartan_Report_Fields_DetailModel { DesignDetailId = Spartan_Report_Fields_DetailData.DesignDetailId , PathField = Spartan_Report_Fields_DetailData.PathField , Physical_Name = Spartan_Report_Fields_DetailData.Physical_Name , Title = Spartan_Report_Fields_DetailData.Title , Function = Spartan_Report_Fields_DetailData.Function , FunctionDescription = (string)Spartan_Report_Fields_DetailData.Function_Spartan_Report_Function.Description , Format = Spartan_Report_Fields_DetailData.Format , FormatDescription = (string)Spartan_Report_Fields_DetailData.Format_Spartan_Report_Format.Description , Order_Type = Spartan_Report_Fields_DetailData.Order_Type , Order_TypeDescription = (string)Spartan_Report_Fields_DetailData.Order_Type_Spartan_Report_Order_Type.Description , Field_Type = Spartan_Report_Fields_DetailData.Field_Type , Field_TypeDescription = (string)Spartan_Report_Fields_DetailData.Field_Type_Spartan_Report_Field_Type.Description , Order_Number = Spartan_Report_Fields_DetailData.Order_Number , AttributeId = Spartan_Report_Fields_DetailData.AttributeId , AttributeIdLogical_Name = (string)Spartan_Report_Fields_DetailData.AttributeId_Spartan_Metadata.Logical_Name }; } } if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } _ISpartan_Report_FunctionApiConsumer.SetAuthHeader(_tokenManager.Token); var Spartan_Report_Functions_Function = _ISpartan_Report_FunctionApiConsumer.SelAll(true); if (Spartan_Report_Functions_Function != null && Spartan_Report_Functions_Function.Resource != null) { ViewBag.Spartan_Report_Functions_Function = Spartan_Report_Functions_Function.Resource.OrderBy(m => m.Description).Select(m => new SelectListItem { Text = m.Description.ToString(), Value = Convert.ToString(m.FunctionId) }).ToList(); } _ISpartan_Report_FormatApiConsumer.SetAuthHeader(_tokenManager.Token); var Spartan_Report_Formats_Format = _ISpartan_Report_FormatApiConsumer.SelAll(true); if (Spartan_Report_Formats_Format != null && Spartan_Report_Formats_Format.Resource != null) { ViewBag.Spartan_Report_Formats_Format = Spartan_Report_Formats_Format.Resource.OrderBy(m => m.Description).Select(m => new SelectListItem { Text = m.Description.ToString(), Value = Convert.ToString(m.FormatId) }).ToList(); } _ISpartan_Report_Order_TypeApiConsumer.SetAuthHeader(_tokenManager.Token); var Spartan_Report_Order_Types_Order_Type = _ISpartan_Report_Order_TypeApiConsumer.SelAll(true); if (Spartan_Report_Order_Types_Order_Type != null && Spartan_Report_Order_Types_Order_Type.Resource != null) { ViewBag.Spartan_Report_Order_Types_Order_Type = Spartan_Report_Order_Types_Order_Type.Resource.OrderBy(m => m.Description).Select(m => new SelectListItem { Text = m.Description.ToString(), Value = Convert.ToString(m.OrderTypeId) }).ToList(); } _ISpartan_Report_Field_TypeApiConsumer.SetAuthHeader(_tokenManager.Token); var Spartan_Report_Field_Types_Field_Type = _ISpartan_Report_Field_TypeApiConsumer.SelAll(true); if (Spartan_Report_Field_Types_Field_Type != null && Spartan_Report_Field_Types_Field_Type.Resource != null) { ViewBag.Spartan_Report_Field_Types_Field_Type = Spartan_Report_Field_Types_Field_Type.Resource.OrderBy(m => m.Description).Select(m => new SelectListItem { Text = m.Description.ToString(), Value = Convert.ToString(m.FieldTypeId) }).ToList(); } _ISpartan_MetadataApiConsumer.SetAuthHeader(_tokenManager.Token); var Spartan_Metadatas_AttributeId = _ISpartan_MetadataApiConsumer.SelAll(true); if (Spartan_Metadatas_AttributeId != null && Spartan_Metadatas_AttributeId.Resource != null) { ViewBag.Spartan_Metadatas_AttributeId = Spartan_Metadatas_AttributeId.Resource.OrderBy(m => m.Logical_Name).Select(m => new SelectListItem { Text = m.Logical_Name.ToString(), Value = Convert.ToString(m.AttributeId) }).ToList(); } return(PartialView("AddSpartan_Report_Fields_Detail", varSpartan_Report_Fields_Detail)); }
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, 34553); ViewBag.Permission = permission; var varSpartan_Report_Fields_Detail = new Spartan_Report_Fields_DetailModel(); ViewBag.ObjectId = "34553"; 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_Report_Fields_DetailApiConsumer.SetAuthHeader(_tokenManager.Token); var Spartan_Report_Fields_DetailData = _ISpartan_Report_Fields_DetailApiConsumer.GetByKeyComplete(Id).Resource.Spartan_Report_Fields_Details[0]; if (Spartan_Report_Fields_DetailData == null) { return(HttpNotFound()); } varSpartan_Report_Fields_Detail = new Spartan_Report_Fields_DetailModel { DesignDetailId = (int)Spartan_Report_Fields_DetailData.DesignDetailId , PathField = Spartan_Report_Fields_DetailData.PathField , Physical_Name = Spartan_Report_Fields_DetailData.Physical_Name , Title = Spartan_Report_Fields_DetailData.Title , Function = Spartan_Report_Fields_DetailData.Function , FunctionDescription = (string)Spartan_Report_Fields_DetailData.Function_Spartan_Report_Function.Description , Format = Spartan_Report_Fields_DetailData.Format , FormatDescription = (string)Spartan_Report_Fields_DetailData.Format_Spartan_Report_Format.Description , Order_Type = Spartan_Report_Fields_DetailData.Order_Type , Order_TypeDescription = (string)Spartan_Report_Fields_DetailData.Order_Type_Spartan_Report_Order_Type.Description , Field_Type = Spartan_Report_Fields_DetailData.Field_Type , Field_TypeDescription = (string)Spartan_Report_Fields_DetailData.Field_Type_Spartan_Report_Field_Type.Description , Order_Number = Spartan_Report_Fields_DetailData.Order_Number , AttributeId = Spartan_Report_Fields_DetailData.AttributeId , AttributeIdLogical_Name = (string)Spartan_Report_Fields_DetailData.AttributeId_Spartan_Metadata.Logical_Name }; } if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } _ISpartan_Report_FunctionApiConsumer.SetAuthHeader(_tokenManager.Token); var Spartan_Report_Functions_Function = _ISpartan_Report_FunctionApiConsumer.SelAll(true); if (Spartan_Report_Functions_Function != null && Spartan_Report_Functions_Function.Resource != null) { ViewBag.Spartan_Report_Functions_Function = Spartan_Report_Functions_Function.Resource.OrderBy(m => m.Description).Select(m => new SelectListItem { Text = m.Description.ToString(), Value = Convert.ToString(m.FunctionId) }).ToList(); } _ISpartan_Report_FormatApiConsumer.SetAuthHeader(_tokenManager.Token); var Spartan_Report_Formats_Format = _ISpartan_Report_FormatApiConsumer.SelAll(true); if (Spartan_Report_Formats_Format != null && Spartan_Report_Formats_Format.Resource != null) { ViewBag.Spartan_Report_Formats_Format = Spartan_Report_Formats_Format.Resource.OrderBy(m => m.Description).Select(m => new SelectListItem { Text = m.Description.ToString(), Value = Convert.ToString(m.FormatId) }).ToList(); } _ISpartan_Report_Order_TypeApiConsumer.SetAuthHeader(_tokenManager.Token); var Spartan_Report_Order_Types_Order_Type = _ISpartan_Report_Order_TypeApiConsumer.SelAll(true); if (Spartan_Report_Order_Types_Order_Type != null && Spartan_Report_Order_Types_Order_Type.Resource != null) { ViewBag.Spartan_Report_Order_Types_Order_Type = Spartan_Report_Order_Types_Order_Type.Resource.OrderBy(m => m.Description).Select(m => new SelectListItem { Text = m.Description.ToString(), Value = Convert.ToString(m.OrderTypeId) }).ToList(); } _ISpartan_Report_Field_TypeApiConsumer.SetAuthHeader(_tokenManager.Token); var Spartan_Report_Field_Types_Field_Type = _ISpartan_Report_Field_TypeApiConsumer.SelAll(true); if (Spartan_Report_Field_Types_Field_Type != null && Spartan_Report_Field_Types_Field_Type.Resource != null) { ViewBag.Spartan_Report_Field_Types_Field_Type = Spartan_Report_Field_Types_Field_Type.Resource.OrderBy(m => m.Description).Select(m => new SelectListItem { Text = m.Description.ToString(), Value = Convert.ToString(m.FieldTypeId) }).ToList(); } _ISpartan_MetadataApiConsumer.SetAuthHeader(_tokenManager.Token); var Spartan_Metadatas_AttributeId = _ISpartan_MetadataApiConsumer.SelAll(true); if (Spartan_Metadatas_AttributeId != null && Spartan_Metadatas_AttributeId.Resource != null) { ViewBag.Spartan_Metadatas_AttributeId = Spartan_Metadatas_AttributeId.Resource.OrderBy(m => m.Logical_Name).Select(m => new SelectListItem { Text = m.Logical_Name.ToString(), Value = Convert.ToString(m.AttributeId) }).ToList(); } ViewBag.Consult = consult == 1; if (consult == 1) { ViewBag.Operation = "Consult"; } return(View(varSpartan_Report_Fields_Detail)); }