コード例 #1
0
ファイル: InsuranceBll.cs プロジェクト: JiaHangIT/GMDS
        public FuncResult GetList(SearchInsModel model)
        {
            FuncResult fr = new FuncResult()
            {
                IsSuccess = true, Message = "操作成功!"
            };

            try
            {
                var query = from r in context.ApdFctInsurance
                            join o in context.ApdDimOrg on r.OrgCode equals o.OrgCode
                            select new ReturnWaterModel()
                {
                    RecordId         = r.RecordId,
                    OrgName          = o.OrgName,
                    Town             = o.Town,
                    OrgCode          = o.OrgCode,
                    RegistrationType = o.RegistrationType,
                    Address          = o.Address,
                    InsuranceMonth   = r.InsuranceMonth,
                    Remark           = r.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);
            }
        }
コード例 #2
0
 public FuncResult GetListPagination([FromBody] SearchInsModel model)
 {
     model.page--; if (model.page < 0)
     {
         model.page = 0;
     }
     return(IMBll.GetListPagination(model));
 }
コード例 #3
0
ファイル: InsuranceBll.cs プロジェクト: JiaHangIT/GMDS
        public FuncResult GetListPagination(SearchInsModel model)
        {
            FuncResult fr = new FuncResult()
            {
                IsSuccess = true, Message = "操作成功!"
            };

            try
            {
                var query = from r in context.ApdFctInsurance
                            join o in context.ApdDimOrg on r.OrgCode equals o.OrgCode
                            select new
                {
                    CreationDate     = r.CreationDate,
                    PeriodYear       = r.PeriodYear,
                    RecordId         = r.RecordId,
                    OrgName          = o.OrgName,
                    Town             = o.Town,
                    OrgCode          = o.OrgCode,
                    RegistrationType = o.RegistrationType,
                    Address          = o.Address,
                    InsuranceMonth   = r.InsuranceMonth,
                    Remark           = r.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);
            }
        }