Example #1
0
        public ActionResult WizardComplete(int idDashboard, int reportId, int row, int column)
        {
            if (!_tokenManager.GenerateToken())
            {
                return(null);
            }
            _IDashboard_Config_DetailApiConsumer.SetAuthHeader(_tokenManager.Token);

            var    resultConfig = _IDashboard_Config_DetailApiConsumer.ListaSelAll(0, 100, "Dashboard_Config_Detail.Dashboard=" + idDashboard + " AND Dashboard_Config_Detail.ConfigRow=" + row + " AND Dashboard_Config_Detail.ConfigColumn=" + column, "");
            string result;

            //Estoy editando
            if (resultConfig.Success && resultConfig.Resource.RowCount > 0 && resultConfig.Resource.Dashboard_Config_Details.Any())
            {
                var dashboardConfig = resultConfig.Resource.Dashboard_Config_Details.First();

                dashboardConfig.Report_Id   = reportId;
                dashboardConfig.Report_Name = reportId.ToString();

                result = _IDashboard_Config_DetailApiConsumer.Update(dashboardConfig, null, null).Resource.ToString();
            }
            //Creo nuevo registro
            else
            {
                var Dashboard_Config_DetailInfo = new Dashboard_Config_Detail
                {
                    Detail_Id    = -1,
                    Dashboard    = idDashboard,
                    Report_Id    = reportId,
                    Report_Name  = reportId.ToString(),
                    ConfigRow    = (short)row,
                    ConfigColumn = (short)column
                };

                result = _IDashboard_Config_DetailApiConsumer.Insert(Dashboard_Config_DetailInfo, null, null).Resource.ToString();
            }

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Example #2
0
        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));
            }
        }