예제 #1
0
        public ActionResult GetReportData(List <I.MES.Models.WhereCondition> whereList, string page)
        {
            try
            {
                ReportOP op = new ReportOP();
                //总记录数
                int intRowTotal = 0;
                //获取当前页码
                int intPage = string.IsNullOrWhiteSpace(page) ? 1 : int.Parse(page);

                DataSet ds            = op.GetReportData(whereList, intPage, ConstInfo.PAGE_SIZE, out intRowTotal);
                var     strReportJson = ToJson(ds.Tables[1]);
                //JsonHelper.ToJson(ds.Tables[1]);
                return(Json(new ReturnResult
                {
                    Result = 1,
                    Message = intRowTotal.ToString(),
                    Data = strReportJson
                }));
            }
            catch (Exception ex)
            {
                return(Json(new ReturnResult
                {
                    Result = 0,
                    Message = ex.Message,
                    Data = ""
                }));
            }
        }
예제 #2
0
        public ActionResult GetVehicleModeList(string vehicleMode, string vehicleName)
        {
            ReportOP op = new ReportOP();

            int total = 0;
            int page  = int.Parse(Request["page"]);

            #region 查询条件
            List <I.MES.Models.WhereCondition> whereList = new List <I.MES.Models.WhereCondition>();
            whereList.Add(new MES.Models.WhereCondition
            {
                Key   = "ViewName",
                Value = "MFG_VehicleMode"
            });

            whereList.Add(new MES.Models.WhereCondition
            {
                Key   = "SortColumn",
                Value = "VehicleMode"
            });

            whereList.Add(new MES.Models.WhereCondition
            {
                Key   = "SortDirection",
                Value = "Asc"
            });

            whereList.Add(new MES.Models.WhereCondition
            {
                Key        = "VehicleMode",
                ColumnName = "VehicleMode",
                Operator   = "",
                Value      = vehicleMode
            });
            whereList.Add(new MES.Models.WhereCondition
            {
                Key        = "VehicleName",
                ColumnName = "VehicleName",
                Operator   = "",
                Value      = vehicleName
            });

            #endregion


            DataSet ds   = op.GetReportData(whereList, page, ConstInfo.PAGE_SIZE, out total);
            var     data = ModelHelper.DataSetToIList <MFG_VehicleMode>(ds, 1);

            ViewBag.TotalRecords = total;

            Hashtable ht = new Hashtable();
            ht.Add("rows", data);
            ht.Add("total", total);

            return(Json(ht, JsonRequestBehavior.AllowGet));
        }