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, 40190); ViewBag.Permission = permission; var varDashboard_Config_Detail = new Dashboard_Config_DetailModel(); ViewBag.ObjectId = "40190"; 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)); } _IDashboard_Config_DetailApiConsumer.SetAuthHeader(_tokenManager.Token); var Dashboard_Config_DetailData = _IDashboard_Config_DetailApiConsumer.GetByKeyComplete(Id).Resource.Dashboard_Config_Details[0]; if (Dashboard_Config_DetailData == null) { return(HttpNotFound()); } varDashboard_Config_Detail = new Dashboard_Config_DetailModel { Detail_Id = (int)Dashboard_Config_DetailData.Detail_Id , Report_Id = Dashboard_Config_DetailData.Report_Id , Report_Name = Dashboard_Config_DetailData.Report_Name , ConfigRow = Dashboard_Config_DetailData.ConfigRow , ConfigColumn = Dashboard_Config_DetailData.ConfigColumn }; } if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } ViewBag.Consult = consult == 1; if (consult == 1) { ViewBag.Operation = "Consult"; } return(View(varDashboard_Config_Detail)); }
public ActionResult AddDashboard_Config_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, 40190); ViewBag.Permission = permission; if (!_tokenManager.GenerateToken()) { return(null); } _IDashboard_Config_DetailApiConsumer.SetAuthHeader(_tokenManager.Token); Dashboard_Config_DetailModel varDashboard_Config_Detail = new Dashboard_Config_DetailModel(); if (id.ToString() != "0") { var Dashboard_Config_DetailsData = _IDashboard_Config_DetailApiConsumer.ListaSelAll(0, 1000, "Dashboard_Config_Detail.Detail_Id=" + id, "").Resource.Dashboard_Config_Details; if (Dashboard_Config_DetailsData != null && Dashboard_Config_DetailsData.Count > 0) { var Dashboard_Config_DetailData = Dashboard_Config_DetailsData.First(); varDashboard_Config_Detail = new Dashboard_Config_DetailModel { Detail_Id = Dashboard_Config_DetailData.Detail_Id , Report_Id = Dashboard_Config_DetailData.Report_Id , Report_Name = Dashboard_Config_DetailData.Report_Name , ConfigRow = Dashboard_Config_DetailData.ConfigRow , ConfigColumn = Dashboard_Config_DetailData.ConfigColumn }; } } if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } return(PartialView("AddDashboard_Config_Detail", varDashboard_Config_Detail)); }
public ActionResult Post(bool IsNew, Dashboard_Config_DetailModel varDashboard_Config_Detail) { try { if (ModelState.IsValid) { if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } _IDashboard_Config_DetailApiConsumer.SetAuthHeader(_tokenManager.Token); var result = ""; var Dashboard_Config_DetailInfo = new Dashboard_Config_Detail { Detail_Id = varDashboard_Config_Detail.Detail_Id , Report_Id = varDashboard_Config_Detail.Report_Id , Report_Name = varDashboard_Config_Detail.Report_Name , ConfigRow = varDashboard_Config_Detail.ConfigRow , ConfigColumn = varDashboard_Config_Detail.ConfigColumn }; result = !IsNew? _IDashboard_Config_DetailApiConsumer.Update(Dashboard_Config_DetailInfo, null, null).Resource.ToString() : _IDashboard_Config_DetailApiConsumer.Insert(Dashboard_Config_DetailInfo, null, null).Resource.ToString(); return(Json(result, JsonRequestBehavior.AllowGet)); } return(Json(false, JsonRequestBehavior.AllowGet)); } catch (ServiceException ex) { return(Json(false, JsonRequestBehavior.AllowGet)); } }