예제 #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
파일: WaterBll.cs 프로젝트: JiaHangIT/GMDS
        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
파일: GasBLl.cs 프로젝트: JiaHangIT/GMDS
        /// <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);
            }
        }