Beispiel #1
0
        /// <summary>
        /// 获取数据列表(分页)
        /// </summary>
        public DataTable GetExportList(MonthCostHeSuanRequest request)
        {
            //组装查询语句
            #region 模糊搜索条件

            var where = new Where <TbMonthCostHeSuan>();

            if (!string.IsNullOrWhiteSpace(request.ProcessFactoryCode))
            {
                where.And(p => p.ProcessFactoryCode == request.ProcessFactoryCode);
            }
            if (!string.IsNullOrWhiteSpace(request.HeSuanCode))
            {
                where.And(p => p.HeSuanCode == request.HeSuanCode);
            }

            #endregion

            try
            {
                var ret = Db.Context.From <TbMonthCostHeSuan>()
                          .Select(
                    TbMonthCostHeSuan._.All
                    , TbCompany._.CompanyFullName.As("ProcessFactoryName")
                    , TbUser._.UserName)
                          .LeftJoin <TbCompany>((a, c) => a.ProcessFactoryCode == c.CompanyCode)
                          .LeftJoin <TbUser>((a, c) => a.InsertUserCode == c.UserCode)
                          .Where(where).OrderByDescending(d => d.ID).ToDataTable();
                return(ret);
            }
            catch (Exception)
            {
                throw;
            }
        }
        /// <summary>
        /// 获取分页列表数据
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public ActionResult GetGridJson(MonthCostHeSuanRequest request)
        {
            var data = _monthCostHeSuanLogic.GetDataListForPage(request);

            return(Content(data.ToJson()));
        }