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, 31954); ViewBag.Permission = permission; var varSpartan_Report_Presentation_Type = new Spartan_Report_Presentation_TypeModel(); ViewBag.ObjectId = "31954"; 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_Presentation_TypeApiConsumer.SetAuthHeader(_tokenManager.Token); var Spartan_Report_Presentation_TypeData = _ISpartan_Report_Presentation_TypeApiConsumer.GetByKeyComplete(Id).Resource.Spartan_Report_Presentation_Types[0]; if (Spartan_Report_Presentation_TypeData == null) { return(HttpNotFound()); } varSpartan_Report_Presentation_Type = new Spartan_Report_Presentation_TypeModel { PresentationTypeId = (int)Spartan_Report_Presentation_TypeData.PresentationTypeId , Description = Spartan_Report_Presentation_TypeData.Description }; } if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } ViewBag.Consult = consult == 1; if (consult == 1) { ViewBag.Operation = "Consult"; } return(View(varSpartan_Report_Presentation_Type)); }
public ActionResult Create(int Id = 0, int consult = 0) { var permission = PermissionHelper.GetRoleObjectPermission(SessionHelper.Role, 31955); ViewBag.Permission = permission; var varSpartan_Report_Presentation_View = new Spartan_Report_Presentation_ViewModel(); ViewBag.ObjectId = "31955"; 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_Presentation_ViewApiConsumer.SetAuthHeader(_tokenManager.Token); var Spartan_Report_Presentation_ViewData = _ISpartan_Report_Presentation_ViewApiConsumer.GetByKeyComplete(Id).Resource.Spartan_Report_Presentation_Views[0]; if (Spartan_Report_Presentation_ViewData == null) { return(HttpNotFound()); } varSpartan_Report_Presentation_View = new Spartan_Report_Presentation_ViewModel { PresentationViewId = (int)Spartan_Report_Presentation_ViewData.PresentationViewId , Description = Spartan_Report_Presentation_ViewData.Description , Presentation_Type = Spartan_Report_Presentation_ViewData.Presentation_Type , Presentation_TypeDescription = (string)Spartan_Report_Presentation_ViewData.Presentation_Type_Spartan_Report_Presentation_Type.Description }; } if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } _ISpartan_Report_Presentation_TypeApiConsumer.SetAuthHeader(_tokenManager.Token); var Spartan_Report_Presentation_Types = _ISpartan_Report_Presentation_TypeApiConsumer.SelAll(true); if (Spartan_Report_Presentation_Types != null && Spartan_Report_Presentation_Types.Resource != null) { ViewBag.Spartan_Report_Presentation_Types = Spartan_Report_Presentation_Types.Resource.Select(m => new SelectListItem { Text = m.Description.ToString(), Value = Convert.ToString(m.PresentationTypeId) }).ToList(); } ViewBag.Consult = consult == 1; if (consult == 1) { ViewBag.Operation = "Consult"; } return(View(varSpartan_Report_Presentation_View)); }