Exemple #1
0
        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));
            }
        }
Exemple #2
0
        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));
        }