Пример #1
0
        public virtual JsonResult EntryGridData(string formVar)
        {
            ListCondition condition = new ListCondition();

            condition.SortField       = DataConvert.ToString(Request.Form["sidx"]);
            condition.SortType        = DataConvert.ToString(Request.Params["sord"]);
            condition.PageIndex       = DataConvert.ToInt32(Request.Params["page"]);
            condition.PageRowNum      = DataConvert.ToInt32(Request.Params["rows"]);
            condition.ListModelString = formVar;
            var rows = new object[0];
            int cnt  = 0;

            if (DataConvert.ToString(formVar) != "")
            {
                cnt = Repository.GetReportGridDataTable(condition, false).Rows.Count;
                condition.TotalRowNum = cnt;
                QueryEntryViewModel model = JsonHelper.Deserialize <QueryEntryViewModel>(formVar);
                DataTable           dt    = Repository.GetReportGridDataTable(condition, true);
                rows = DataTable2Object.Data(dt, EntryGridLayout(model.FormMode).GridLayouts);
            }
            double aa      = (double)cnt / condition.PageRowNum;
            double pageCnt = Math.Ceiling(aa);
            var    result  = new JsonResult();

            result.JsonRequestBehavior = JsonRequestBehavior.AllowGet;
            result.Data = new { page = 1, records = cnt, total = pageCnt, rows = rows };
            return(result);
        }
Пример #2
0
        public override JsonResult EntryGridData(string formVar, string formMode, string primaryKey)
        {
            try
            {
                int pageIndex  = DataConvert.ToInt32(Request.Params["page"]);
                int pageRowNum = DataConvert.ToInt32(Request.Params["rows"]);

                Dictionary <string, object> paras = new Dictionary <string, object>();
                int    cnt     = Repository.GetEntryGridCount(paras, formMode, primaryKey, formVar);
                double aa      = (double)cnt / pageRowNum;
                double pageCnt = Math.Ceiling(aa);


                paras.Add("pageIndex", pageIndex);
                paras.Add("pageRowNum", pageRowNum);

                DataTable dt     = Repository.GetEntryGridDataTable(paras, formMode, primaryKey, formVar);
                var       rows   = DataTable2Object.Data(dt, EntryGridLayout(formMode).GridLayouts);
                var       result = new JsonResult();
                result.JsonRequestBehavior = JsonRequestBehavior.AllowGet;
                result.Data = new { page = pageIndex, records = cnt, total = pageCnt, rows = rows };
                return(result);
            }
            catch (Exception ex)
            {
                AppLog.WriteLog(AppMember.AppText["SystemUser"], LogType.Error, "AssetsCheckController.AllDropList", "[Message]:" + ex.Message + " [StackTrace]:" + ex.StackTrace);
                return(new JsonResult());
            }
        }
Пример #3
0
        public JsonResult Menu()
        {
            UserInfo            sysUser = CacheInit.GetUserInfo(HttpContext);
            AuthorityRepository rep     = new AuthorityRepository();
            DataTable           dt      = rep.GetUserMenu(sysUser.UserId);

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                string urls = DataConvert.ToString(dt.Rows[i]["url"]);
                if (urls != "")
                {
                    string[] url     = urls.Split('/');
                    string   urlmenu = Url.Action(url[3], url[2], new { Area = url[1] });
                    if (url.Length > 4)
                    {
                        urlmenu = urlmenu + url[4];
                    }
                    dt.Rows[i]["url"] = urlmenu;
                }
            }
            var rows = DataTable2Object.Data(dt);
            //var rows = new object[4];
            //rows[0] = new { id = 1, cell = new[] { "1", "周报", "", "0", "1", "10", "false", "false" } };
            //rows[1] = new { id = 2, cell = new[] { "2", "用户组", "/BusinessCommon/Group/List", "1", "2", "3", "true", "true" } };
            //rows[2] = new { id = 3, cell = new[] { "6", "系统", "", "0", "11", "18", "false", "false" } };
            //rows[3] = new { id = 4, cell = new[] { "7", "用户", "/BusinessCommon/User/List", "1", "12", "13", "true", "true" } };
            var result = new JsonResult();

            result.JsonRequestBehavior = JsonRequestBehavior.AllowGet;
            result.Data = new { page = 1, records = rows.Length, rows = rows, total = 1 };
            return(result);
        }
Пример #4
0
        public JsonResult StoreSiteGridData(string formVar, string formMode, string primaryKey)
        {
            var rows   = DataTable2Object.Data(StoreSiteGridDataTable(formVar, formMode, primaryKey), StoreSiteGridLayout().GridLayouts);
            var result = new JsonResult();

            result.JsonRequestBehavior = JsonRequestBehavior.AllowGet;
            result.Data = new { page = 1, total = rows.Length, rows = rows };
            return(result);
        }
Пример #5
0
        public JsonResult GridData(string formVar)
        {
            var rows   = DataTable2Object.Data(GridDataTable(formVar), GridLayout());
            var result = new JsonResult();

            result.JsonRequestBehavior = JsonRequestBehavior.AllowGet;
            result.Data = new { page = 1, total = rows.Length, rows = rows };
            return(result);
        }
Пример #6
0
        public JsonResult ApproveGridData(string pkValue, string tableName)
        {
            pkValue = DataConvert.ToString(pkValue);
            var rows   = DataTable2Object.Data(ApproveGridDataTable(pkValue, tableName), ApproveGridLayout().GridLayouts);
            var result = new JsonResult();

            result.JsonRequestBehavior = JsonRequestBehavior.AllowGet;
            result.Data = new { page = 1, total = rows.Length, rows = rows };
            return(result);
        }
Пример #7
0
 public virtual JsonResult EntryGridData(string formVar, string formMode, string primaryKey)
 {
     try
     {
         Dictionary <string, object> paras = new Dictionary <string, object>();
         DataTable dt     = EntryRepository.GetEntryGridDataTable(paras, formMode, primaryKey, formVar);
         var       rows   = DataTable2Object.Data(dt, EntryGridLayout(formMode).GridLayouts);
         var       result = new JsonResult();
         result.JsonRequestBehavior = JsonRequestBehavior.AllowGet;
         result.Data = new { page = 1, total = rows.Length, rows = rows };
         return(result);
     }
     catch (Exception ex)
     {
         AppLog.WriteLog(AppMember.AppText["SystemUser"], LogType.Error, "ApproveMasterController.EntryGridData", ControllerName + "[Message]:" + ex.Message + " [StackTrace]:" + ex.StackTrace);
         return(new JsonResult());
     }
 }
Пример #8
0
        public JsonResult GridData(string listMode, string filterString, string selectMode)
        {
            try
            {
                ApproveListCondition condition = new ApproveListCondition();
                condition.SortField    = DataConvert.ToString(Request.Form["sidx"]);
                condition.SortType     = DataConvert.ToString(Request.Params["sord"]);
                condition.PageIndex    = DataConvert.ToInt32(Request.Params["page"]);
                condition.PageRowNum   = DataConvert.ToInt32(Request.Params["rows"]);
                condition.ListMode     = listMode;
                condition.SelectMode   = selectMode;
                condition.FilterString = filterString;
                //if (Request.Form.AllKeys.Contains("isQuery") && DataConvert.ToString(Request.Form["isQuery"]) == "true")
                //    condition.PageIndex = 1;
                if (Request.Form.AllKeys.Contains("formVar"))
                {
                    condition.ListModelString = DataConvert.ToString(Request.Form["formVar"]);
                }

                UserInfo sysUser = CacheInit.GetUserInfo(HttpContext);
                condition.SysUser  = sysUser;
                condition.Approver = sysUser.UserId;
                int cnt = ListRepository.GetGridDataCount(condition);
                condition.TotalRowNum = cnt;
                DataTable dt      = ListRepository.GetGridDataTable(condition);
                var       rows    = DataTable2Object.Data(dt, GridLayout(listMode, selectMode).GridLayouts);
                double    aa      = (double)cnt / condition.PageRowNum;
                double    pageCnt = Math.Ceiling(aa);
                var       result  = new JsonResult();
                result.JsonRequestBehavior = JsonRequestBehavior.AllowGet;
                result.Data = new { page = condition.PageIndex, records = cnt, total = pageCnt, rows = rows };
                return(result);
            }
            catch (Exception ex)
            {
                AppLog.WriteLog(AppMember.AppText["SystemUser"], LogType.Error, "ApproveMasterController.GridData", ControllerName + "[Message]:" + ex.Message + " [StackTrace]:" + ex.StackTrace);
                return(new JsonResult());
            }
        }
        public override JsonResult EntryGridData(string formVar)
        {
            ListCondition condition = new ListCondition();

            condition.SortField       = DataConvert.ToString(Request.Form["sidx"]);
            condition.SortType        = DataConvert.ToString(Request.Params["sord"]);
            condition.PageIndex       = DataConvert.ToInt32(Request.Params["page"]);
            condition.PageRowNum      = DataConvert.ToInt32(Request.Params["rows"]);
            condition.ListModelString = formVar;
            var rows = new object[0];

            if (DataConvert.ToString(formVar) != "")
            {
                DataTable dt = Repository.GetReportGridDataTable(condition);
                rows = DataTable2Object.Data(dt, EntryGridLayout2().GridLayouts);
            }
            var result = new JsonResult();

            result.JsonRequestBehavior = JsonRequestBehavior.AllowGet;
            result.Data = new { page = 1, total = rows.Length, rows = rows };
            return(result);
        }
Пример #10
0
 public JsonResult EntryGridData()
 {
     try
     {
         UserInfo sysUser = CacheInit.GetUserInfo(HttpContext);
         Dictionary <string, object> paras = new Dictionary <string, object>();
         if (!paras.ContainsKey("approver"))
         {
             paras.Add("approver", sysUser.UserId);
         }
         MainIndexRepository mainRep = new MainIndexRepository();
         DataTable           dt      = mainRep.GetEntryGridDataTable(paras);
         var rows   = DataTable2Object.Data(dt, EntryGridLayout().GridLayouts);
         var result = new JsonResult();
         result.JsonRequestBehavior = JsonRequestBehavior.AllowGet;
         result.Data = new { page = 1, total = rows.Length, rows = rows };
         return(result);
     }
     catch (Exception ex)
     {
         AppLog.WriteLog(AppMember.AppText["SystemUser"], LogType.Error, "MainIndexController.EntryGridData", "[Message]:" + ex.Message + " [StackTrace]:" + ex.StackTrace);
         return(new JsonResult());
     }
 }