Пример #1
0
 public async Task <FuncResult> GetListPagination([FromBody] SearchExcelModel model)
 {
     model.page--; if (model.page < 0)
     {
         model.page = 0;
     }
     return(waterBll.GetListPagination(model));
 }
Пример #2
0
 public FuncResult GetListPagination([FromBody] SearchExcelModel model)
 {
     model.page--; if (model.page < 0)
     {
         model.page = 0;
     }
     return(gasBll.GetListPagination(model));
 }
Пример #3
0
        public FuncResult GetListPagination(SearchExcelModel model)
        {
            FuncResult fr = new FuncResult()
            {
                IsSuccess = true, Message = "操作成功!"
            };

            try
            {
                //var q= context.ApdFctWater
                var query = from c in context.ApdFctWater
                            join o in context.ApdDimOrg on c.OrgCode equals o.OrgCode
                            select new
                {
                    CreationDate     = c.CreationDate,
                    RecordId         = c.RecordId,
                    OrgName          = o.OrgName,
                    Town             = o.Town,
                    OrgCode          = o.OrgCode,
                    RegistrationType = o.RegistrationType,
                    Address          = o.Address,
                    PeriodYear       = o.PeriodYear,
                    Water            = c.Water,
                    Other            = c.Other,
                    Remark           = c.Remark
                };
                query = query.Where(f => (
                                        (string.IsNullOrWhiteSpace(model.orgcode) || f.OrgCode.Contains(model.orgcode)) &&
                                        (string.IsNullOrWhiteSpace(model.orgname) || f.OrgName.Contains(model.orgname)) &&
                                        (string.IsNullOrWhiteSpace(model.year) || f.PeriodYear.Equals(Convert.ToDecimal(model.year)))
                                        ));
                int count      = query.Count();
                var pagination = query.Skip(model.limit * model.page).Take(model.limit);
                fr.Content = new { total = count, data = pagination };
                return(fr);
            }
            catch (Exception ex)
            {
                throw new Exception("error", ex);
            }
        }
Пример #4
0
        /// <summary>
        /// 列表
        /// </summary>
        /// <returns></returns>
        public FuncResult GetList(SearchExcelModel model)
        {
            FuncResult fr = new FuncResult()
            {
                IsSuccess = true, Message = "操作成功"
            };

            try
            {
                var query = from c in context.ApdFctGas
                            join o in context.ApdDimOrg on c.OrgCode equals o.OrgCode
                            select new ReturnPollutantModel()
                {
                    RecordId         = c.RecordId,
                    OrgName          = o.OrgName,
                    Town             = o.Town,
                    OrgCode          = o.OrgCode,
                    RegistrationType = o.RegistrationType,
                    Address          = o.Address,
                    PeriodYear       = o.PeriodYear,
                    Gas    = c.Gas,
                    Other  = c.Other,
                    Remark = c.Remark
                };
                query = query.Where(f => (
                                        (string.IsNullOrWhiteSpace(model.orgcode) || f.OrgCode.Contains(model.orgcode)) &&
                                        (string.IsNullOrWhiteSpace(model.orgname) || f.OrgName.Contains(model.orgname)) &&
                                        (string.IsNullOrWhiteSpace(model.year) || f.PeriodYear.Equals(Convert.ToDecimal(model.year)))
                                        ));
                fr.Content = query.ToList();
                return(fr);
            }
            catch (Exception ex)
            {
                throw new Exception("error", ex);
            }
        }