public ActionResult WizardStep2(string selPresType, string selPresText) { if (!_tokenManager.GenerateToken()) { return(null); } _ISpartan_Report_Presentation_TypeApiConsumer.SetAuthHeader(_tokenManager.Token); var resultTypes = _ISpartan_Report_Presentation_TypeApiConsumer.SelAll(false); var presentationTypeId = resultTypes.Resource.Where(x => x.Description.Equals(selPresType)).Select(x => x.PresentationTypeId).SingleOrDefault(); if (presentationTypeId <= 0) { return(Json(new { success = false, errorText = string.Format(Resources.Resources.TypeNotExist, selPresText) }, JsonRequestBehavior.AllowGet)); } _ISpartan_ReportApiConsumer.SetAuthHeader(_tokenManager.Token); var result = _ISpartan_ReportApiConsumer.SelAll(true).Resource.Where(x => x.Presentation_Type == presentationTypeId).OrderBy(x => x.Report_Name); if (result.Count() == 0) { return(Json(new { success = false, errorText = Resources.Resources.ItemsNotFound }, JsonRequestBehavior.AllowGet)); } return(Json(new { success = true, data = result.Select(m => new Spartan_ReportGridModel { ReportId = m.ReportId, Report_Name = m.Report_Name }).ToList(), }, JsonRequestBehavior.AllowGet)); }
public ActionResult Create(int Id = 0, int consult = 0) { var permission = PermissionHelper.GetRoleObjectPermission(SessionHelper.Role, 31957); ViewBag.Permission = permission; var varSpartan_Report_Permissions = new Spartan_Report_PermissionsModel(); ViewBag.ObjectId = "31957"; ViewBag.Operation = "New"; ViewBag.IsNew = true; if ((Id.GetType() == typeof(string) && Id.ToString() != "") || (Id.GetType() == typeof(int) && Id.ToString() != "0")) { ViewBag.IsNew = false; ViewBag.Operation = "Update"; if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } _ISpartan_Report_PermissionsApiConsumer.SetAuthHeader(_tokenManager.Token); var Spartan_Report_PermissionsData = _ISpartan_Report_PermissionsApiConsumer.GetByKeyComplete(Id).Resource.Spartan_Report_Permissionss[0]; if (Spartan_Report_PermissionsData == null) { return(HttpNotFound()); } varSpartan_Report_Permissions = new Spartan_Report_PermissionsModel { ReportPermissionId = (int)Spartan_Report_PermissionsData.ReportPermissionId , User_Role = Spartan_Report_PermissionsData.User_Role , Report = Spartan_Report_PermissionsData.Report , ReportReport_Name = (string)Spartan_Report_PermissionsData.Report_Spartan_Report.Report_Name , Permission_Type = Spartan_Report_PermissionsData.Permission_Type , Permission_TypeDescription = (string)Spartan_Report_PermissionsData.Permission_Type_Spartan_Report_Permission_Type.Description }; } if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } _ISpartan_ReportApiConsumer.SetAuthHeader(_tokenManager.Token); var Spartan_Reports = _ISpartan_ReportApiConsumer.SelAll(true); if (Spartan_Reports != null && Spartan_Reports.Resource != null) { ViewBag.Spartan_Reports = Spartan_Reports.Resource.Select(m => new SelectListItem { Text = m.Report_Name.ToString(), Value = Convert.ToString(m.ReportId) }).ToList(); } _ISpartan_Report_Permission_TypeApiConsumer.SetAuthHeader(_tokenManager.Token); var Spartan_Report_Permission_Types = _ISpartan_Report_Permission_TypeApiConsumer.SelAll(true); if (Spartan_Report_Permission_Types != null && Spartan_Report_Permission_Types.Resource != null) { ViewBag.Spartan_Report_Permission_Types = Spartan_Report_Permission_Types.Resource.Select(m => new SelectListItem { Text = m.Description.ToString(), Value = Convert.ToString(m.PermissionTypeId) }).ToList(); } ViewBag.Consult = consult == 1; if (consult == 1) { ViewBag.Operation = "Consult"; } return(View(varSpartan_Report_Permissions)); }