public JsonResult getSpartanFormatPermissions(int id) { string respuesta = ""; bool token = _tokenManager.GenerateToken(); if (!token) { return(Json(null, JsonRequestBehavior.AllowGet)); } else { _ISpartan_Format_PermissionsApiConsumer.SetAuthHeader(_tokenManager.Token); respuesta = JsonConvert.SerializeObject(_ISpartan_Format_PermissionsApiConsumer.ListaSelAll(1, int.MaxValue, "Spartan_User_Role = " + id, "").Resource.Spartan_Format_Permissionss); return(Json(_ISpartan_Format_PermissionsApiConsumer.ListaSelAll(1, int.MaxValue, "Spartan_User_Role = " + id, "").Resource.Spartan_Format_Permissionss, JsonRequestBehavior.AllowGet)); } }
public ActionResult GetFormats(string RecordId) { if (!_tokenManager.GenerateToken()) { return(null); } var formatList = new List <SelectListItem>(); if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } _ISpartan_Format_PermissionsApiConsumer.SetAuthHeader(_tokenManager.Token); _ISpartan_FormatApiConsumer.SetAuthHeader(_tokenManager.Token); var whereClause = " Spartan_Format_Permissions.Spartan_User_Role = " + SessionHelper.Role + " AND Spartan_Format_Permissions.Permission_Type = 1 AND Apply=1 "; var formatsPermisions = _ISpartan_Format_PermissionsApiConsumer.ListaSelAll(0, 500, whereClause, string.Empty).Resource; if (formatsPermisions.RowCount > 0) { var formats = string.Join(",", formatsPermisions.Spartan_Format_Permissionss.Select(f => f.Format).ToArray()); var whereClauseFormat = "Object = 45045 AND FormatId in (" + formats + ")"; var Spartan_Formats = _ISpartan_FormatApiConsumer.ListaSelAll(0, 1000, whereClauseFormat, string.Empty); if (Spartan_Formats != null && Spartan_Formats.Resource != null && Spartan_Formats.Resource.Spartan_Formats != null) { _IArticuloApiConsumer.SetAuthHeader(_tokenManager.Token); foreach (Spartan_Format format in Spartan_Formats.Resource.Spartan_Formats) { if (format.Filter != null && format.Filter.Trim() != string.Empty) { var where = Helper.ReplaceGlobal(format.Filter).Trim() + " And Articulo.Clave= " + RecordId; var result = _IArticuloApiConsumer.ListaSelAll(0, 1000, where, string.Empty); if (result != null && result.Resource != null && result.Resource.RowCount > 0) { formatList.Add(new SelectListItem { Text = CultureHelper.GetTraductionAdd(format.FormatId.ToString(), "Format", format.Format_Name), Value = Convert.ToString(format.FormatId) }); } } else { formatList.Add(new SelectListItem { Text = CultureHelper.GetTraductionAdd(format.FormatId.ToString(), "Format", format.Format_Name), Value = Convert.ToString(format.FormatId) }); } } } } return(Json(formatList, JsonRequestBehavior.AllowGet)); }
public ActionResult AddSpartan_Format_Permissions(int rowIndex = 0, int functionMode = 0, int id = 0) { ViewBag.currentRowIndex = rowIndex; ViewBag.functionMode = functionMode; ViewBag.Consult = false; var permission = PermissionHelper.GetRoleObjectPermission(SessionHelper.Role, 31868); ViewBag.Permission = permission; if (!_tokenManager.GenerateToken()) { return(null); } _ISpartan_Format_PermissionsApiConsumer.SetAuthHeader(_tokenManager.Token); Spartan_Format_PermissionsModel varSpartan_Format_Permissions = new Spartan_Format_PermissionsModel(); if (id.ToString() != "0") { var Spartan_Format_PermissionssData = _ISpartan_Format_PermissionsApiConsumer.ListaSelAll(0, 1000, "PermissionId=" + id, "").Resource.Spartan_Format_Permissionss; if (Spartan_Format_PermissionssData != null && Spartan_Format_PermissionssData.Count > 0) { var Spartan_Format_PermissionsData = Spartan_Format_PermissionssData.First(); varSpartan_Format_Permissions = new Spartan_Format_PermissionsModel { PermissionId = Spartan_Format_PermissionsData.PermissionId , Format = Spartan_Format_PermissionsData.Format , FormatFormat_Name = (string)Spartan_Format_PermissionsData.Format_Spartan_Format.Format_Name , Permission_Type = Spartan_Format_PermissionsData.Permission_Type , Permission_TypeDescription = (string)Spartan_Format_PermissionsData.Permission_Type_Spartan_Format_Permission_Type.Description , Apply = Spartan_Format_PermissionsData.Apply.GetValueOrDefault() , Spartan_User_Role = Spartan_Format_PermissionsData.Spartan_User_Role }; } } if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } _ISpartan_FormatApiConsumer.SetAuthHeader(_tokenManager.Token); var Spartan_Formats = _ISpartan_FormatApiConsumer.SelAll(true); if (Spartan_Formats != null && Spartan_Formats.Resource != null) { ViewBag.Spartan_Formats = Spartan_Formats.Resource.Select(m => new SelectListItem { Text = m.Format_Name.ToString(), Value = Convert.ToString(m.FormatId) }).ToList(); } _ISpartan_Format_Permission_TypeApiConsumer.SetAuthHeader(_tokenManager.Token); var Spartan_Format_Permission_Types = _ISpartan_Format_Permission_TypeApiConsumer.SelAll(true); if (Spartan_Format_Permission_Types != null && Spartan_Format_Permission_Types.Resource != null) { ViewBag.Spartan_Format_Permission_Types = Spartan_Format_Permission_Types.Resource.Select(m => new SelectListItem { Text = m.Description.ToString(), Value = Convert.ToString(m.PermissionTypeId) }).ToList(); } return(PartialView("AddSpartan_Format_Permissions", varSpartan_Format_Permissions)); }