public JsonResult GetDashboardDetail(int idTemplate, int idDashboard) { try { if (!_tokenManager.GenerateToken()) { return(null); } _ITemplate_Dashboard_DetailApiConsumer.SetAuthHeader(_tokenManager.Token); //var result = _ITemplate_Dashboard_EditorApiConsumer.GetByKeyComplete(idTemplate); var result = _ITemplate_Dashboard_DetailApiConsumer.ListaSelAll(0, 100, "Template_Dashboard_Detail.Template=" + idTemplate, ""); if (!_tokenManager.GenerateToken()) { return(null); } _IDashboard_Config_DetailApiConsumer.SetAuthHeader(_tokenManager.Token); var resultConfig = _IDashboard_Config_DetailApiConsumer.ListaSelAll(0, 100, "Dashboard_Config_Detail.Dashboard=" + idDashboard, ""); List <List <string> > rows = new List <List <string> >(); for (int i = 0; i < result.Resource.RowCount; i++) { var nuevaRow = new List <string>(); var row = result.Resource.Template_Dashboard_Details[i]; for (int j = 0; j < row.Columns; j++) { var dashboardConfigDetail = resultConfig.Resource.Dashboard_Config_Details.SingleOrDefault(cd => (cd.ConfigRow - 1) == i && (cd.ConfigColumn - 1) == j); string reportId = null; if (dashboardConfigDetail != null) { if (dashboardConfigDetail.Report_Id != null) { reportId = dashboardConfigDetail.Report_Id.ToString(); } } nuevaRow.Add(reportId); } rows.Add(nuevaRow); } var res = new { Success = true, Rows = rows }; return(Json(res, JsonRequestBehavior.AllowGet)); } catch (System.Exception) { return(Json(new { Success = false }, JsonRequestBehavior.AllowGet)); } }
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)); }