示例#1
0
        public PagedModel<Customer> Search(CustomerCriteria c)
        {
            return this.Repository.Search(c, this.SysContext.CurrentUser.Id);
            #region Old
            //PagedModel<Customer> m = new PagedModel<Customer>();
            ////var r = this.Repository.FindAll();
            //var r = this.Repository.FindAll2();

            //#region 权限控制
            //var supervisorService = new SupervisorService(this.SysContext, this.Db);
            //// 首先检查当前用户是否具有“查看所有生源”的特权
            //var isSa = (supervisorService.FindByUserId(this.SysContext.CurrentUser.Id).Count(o => o.Type.Equals("查看所有生源")) > 0);
            //if (!isSa) {
            //    // 没有特权,则读取当前用户担任组长和组员的的招生小组的ID
            //    var teamMemberService = new SalesTeamMemberService(this.SysContext, this.Db);
            //    var leaders = teamMemberService.FindByUserId(this.SysContext.CurrentUser.Id).Where(o => o.IsLeader).Select(o=>o.SalesTeamId).ToList();
            //    var members = teamMemberService.FindByUserId(this.SysContext.CurrentUser.Id).Where(o => !o.IsLeader).Select(o => o.SalesTeamId).ToList();
            //    if (leaders.Count > 0 || members.Count > 0) {
            //        // 过滤掉未分配生源以及其它招生小组的资料
            //        r = r.Where(o => o.SalesTeamId.HasValue
            //            && (leaders.Contains(o.SalesTeamId.Value)
            //                || (o.SalesmanId.HasValue && o.SalesmanId.Equals(this.SysContext.CurrentUser.Id))
            //            )
            //        );
            //        //u = u.Where(o => o.SalesTeamId.HasValue
            //        //    && (leaders.Contains(o.SalesTeamId.Value)
            //        //        || (o.SalesmanId.HasValue && o.SalesmanId.Equals(this.SysContext.CurrentUser.Id))
            //        //    )
            //        //);

            //    }
            //}
            //#endregion

            //if (c.SchoolIdSrh.HasValue) {
            //    r = r.Where(o=>o.SchoolId.HasValue && o.SchoolId.Value.Equals(c.SchoolIdSrh.Value));
            //    //u = u.Where(o=>o.SchoolId.HasValue && o.SchoolId.Value.Equals(c.SchoolIdSrh.Value));
            //}
            //if (!String.IsNullOrEmpty(c.SchoolNameSrh)) {
            //    r = r.Where(o => o.School != null && o.School.Name.Contains(c.SchoolNameSrh));
            //    //u = u.Where(o => o.School != null && o.School.Name.Contains(c.SchoolNameSrh));
            //}
            //if (!String.IsNullOrEmpty(c.ClazzSrh)) {
            //    r = r.Where(o => !String.IsNullOrEmpty(o.Clazz) && o.Clazz.Contains(c.ClazzSrh));
            //}
            //if (!String.IsNullOrEmpty(c.ConsultTypeSrh)) {
            //    r = r.Where(o => !String.IsNullOrEmpty(o.ConsultType) && o.ConsultType.Equals(c.ConsultTypeSrh));
            //}
            //if (c.SalesTeamIdSrh.HasValue) {
            //    r = r.Where(o => o.SalesTeamId.HasValue && o.SalesTeamId.Value.Equals(c.SalesTeamIdSrh.Value));
            //}
            //if (c.SalesmanIdSrh.HasValue) {
            //    r = r.Where(o => o.SalesmanId.HasValue && o.SalesmanId.Value.Equals(c.SalesmanIdSrh.Value));
            //}
            //if (!String.IsNullOrEmpty(c.EduLevelSrh)) {
            //    r = r.Where(o => !String.IsNullOrEmpty(o.EduLevel) && o.EduLevel.Contains(c.EduLevelSrh));
            //}
            //if (!String.IsNullOrEmpty(c.NameSrh)) {
            //    r = r.Where(o => !String.IsNullOrEmpty(o.Name) && o.Name.Contains(c.NameSrh));
            //    //u = u.Where(o => !String.IsNullOrEmpty(o.Name) && o.Name.Contains(c.NameSrh));
            //}
            //if (!String.IsNullOrEmpty(c.TelephoneSrh)) {
            //    r = r.Where(o =>
            //        (!String.IsNullOrEmpty(o.Telephone) && o.Telephone.Contains(c.TelephoneSrh)) ||
            //        (!String.IsNullOrEmpty(o.Mobile) && o.Mobile.Contains(c.TelephoneSrh)) ||
            //        (!String.IsNullOrEmpty(o.Address) && o.Address.Contains(c.TelephoneSrh))
            //    );
            //}
            //if (c.ImportantSrh.HasValue && c.ImportantSrh.Value) {
            //    r = r.Where(o => o.Important);
            //}
            //if (!String.IsNullOrEmpty(c.KeywordsSrh)) {
            //    r = r.Where(o => !String.IsNullOrEmpty(o.Keywords) && o.Keywords.Contains(c.KeywordsSrh));
            //}
            //if (c.IsTodaySrh.HasValue && c.IsTodaySrh.Value) {
            //    r = r.Where(o => o.NextTeleSalesTime.HasValue && o.NextTeleSalesTime.Value.Date.Equals(DateTime.Today));
            //}

            //#region 以下条件用于查询咨询状态
            //if (c.IsDropInSrh.HasValue && c.IsDropInSrh.Value) {
            //    r = r.Where(o => o.IsDropIn);
            //    if (c.DropInTimeFromSrh.HasValue) {
            //        r = r.Where(o => o.DropInTime.HasValue && o.DropInTime.Value >= c.DropInTimeFromSrh.Value);
            //    }
            //    if (c.DropInTimeToSrh.HasValue) {
            //        r = r.Where(o => o.DropInTime.HasValue && o.DropInTime.Value <= c.DropInTimeToSrh.Value);
            //    }
            //}
            //if (c.IsDinWeiSrh.HasValue && c.IsDinWeiSrh.Value) {
            //    r = r.Where(o => o.IsDinWei);
            //    if (c.DinWeiTimeFromSrh.HasValue) {
            //        r = r.Where(o => o.DinWeiTime.HasValue && o.DinWeiTime.Value >= c.DinWeiTimeFromSrh.Value);
            //    }
            //    if (c.DinWeiTimeToSrh.HasValue) {
            //        r = r.Where(o => o.DinWeiTime.HasValue && o.DinWeiTime.Value <= c.DinWeiTimeToSrh.Value);
            //    }
            //}
            //if (c.IsSignUpSrh.HasValue && c.IsSignUpSrh.Value) {
            //    r = r.Where(o => o.IsSignUp);
            //    if (c.SignUpTimeFromSrh.HasValue) {
            //        r = r.Where(o => o.SignUpTime.HasValue && o.SignUpTime.Value >= c.SignUpTimeFromSrh.Value);
            //    }
            //    if (c.SignUpTimeToSrh.HasValue) {
            //        r = r.Where(o => o.SignUpTime.HasValue && o.SignUpTime.Value <= c.SignUpTimeToSrh.Value);
            //    }
            //}
            //if (c.IsPaySrh.HasValue && c.IsPaySrh.Value) {
            //    r = r.Where(o => o.IsPay);
            //    if (c.PayTimeFromSrh.HasValue) {
            //        r = r.Where(o => o.PayTime.HasValue && o.PayTime.Value >= c.PayTimeFromSrh.Value);
            //    }
            //    if (c.SignUpTimeToSrh.HasValue) {
            //        r = r.Where(o => o.PayTime.HasValue && o.PayTime.Value <= c.PayTimeToSrh.Value);
            //    }
            //}
            //if (c.IsRefundSrh.HasValue && c.IsRefundSrh.Value) {
            //    r = r.Where(o => o.IsRefund);
            //    if (c.RefundTimeFromSrh.HasValue) {
            //        r = r.Where(o => o.RefundTime.HasValue && o.RefundTime.Value >= c.RefundTimeFromSrh.Value);
            //    }
            //    if (c.SignUpTimeToSrh.HasValue) {
            //        r = r.Where(o => o.RefundTime.HasValue && o.RefundTime.Value <= c.RefundTimeToSrh.Value);
            //    }
            //}

            //#endregion

            //#region 以下条件用于组长跟进
            //if (!String.IsNullOrEmpty(c.SalesmanNameSrh)) {
            //    r = r.Where(o => o.Salesman != null && o.Salesman.Name.Contains(c.SalesmanNameSrh));
            //    //u = u.Where(o => o.Salesman != null && o.Salesman.Name.Contains(c.SalesmanNameSrh));
            //}
            //if (c.IsLeaderFollowSrh.HasValue && c.IsLeaderFollowSrh.Value) {
            //    r = r.Where(o => o.IsLeaderFollow);
            //    //u = u.Where(o => o.IsLeaderFollow);
            //}
            //#endregion

            //#region 排序
            //if (String.IsNullOrEmpty(c.sortname)) {
            //    c.sortname = "name";
            //}
            //if (String.IsNullOrEmpty(c.sortorder)) {
            //    c.sortorder = "adc";
            //}
            //if (!String.IsNullOrEmpty(c.sortname)) {
            //    if (c.sortname.ToLower().Equals("id")) {
            //        if (c.sortorder.ToLower().Equals("asc")) {
            //            r = r.OrderBy(o => o.Id);
            //        } else {
            //            r = r.OrderByDescending(o => o.Id);
            //        }
            //    }
            //    if (c.sortname.ToLower().Equals("name")) {
            //        if (c.sortorder.ToLower().Equals("asc")) {
            //            r = r.OrderBy(o => o.Name);
            //        } else {
            //            r = r.OrderByDescending(o => o.Name);
            //        }
            //    }
            //    if (c.sortname.ToLower().Equals("schoolid")) {
            //        if (c.sortorder.ToLower().Equals("asc")) {
            //            r = r.OrderBy(o => o.SchoolId);
            //        } else {
            //            r = r.OrderByDescending(o => o.SchoolId);
            //        }
            //    }
            //    if (c.sortname.ToLower().Equals("marketyear")) {
            //        if (c.sortorder.ToLower().Equals("asc")) {
            //            r = r.OrderBy(o => o.MarketYear);
            //        } else {
            //            r = r.OrderByDescending(o => o.MarketYear);
            //        }
            //    }
            //    if (c.sortname.ToLower().Equals("telephone")) {
            //        if (c.sortorder.ToLower().Equals("asc")) {
            //            r = r.OrderBy(o => o.Telephone);
            //        } else {
            //            r = r.OrderByDescending(o => o.Telephone);
            //        }
            //    }
            //    if (c.sortname.ToLower().Equals("mobile")) {
            //        if (c.sortorder.ToLower().Equals("asc")) {
            //            r = r.OrderBy(o => o.Mobile);
            //        } else {
            //            r = r.OrderByDescending(o => o.Mobile);
            //        }
            //    }
            //    if (c.sortname.ToLower().Equals("gender")) {
            //        if (c.sortorder.ToLower().Equals("asc")) {
            //            r = r.OrderBy(o => o.Gender);
            //        } else {
            //            r = r.OrderByDescending(o => o.Gender);
            //        }
            //    }
            //    if (c.sortname.ToLower().Equals("qq")) {
            //        if (c.sortorder.ToLower().Equals("asc")) {
            //            r = r.OrderBy(o => o.QQ);
            //        } else {
            //            r = r.OrderByDescending(o => o.QQ);
            //        }
            //    }
            //    if (c.sortname.ToLower().Equals("email")) {
            //        if (c.sortorder.ToLower().Equals("asc")) {
            //            r = r.OrderBy(o => o.Email);
            //        } else {
            //            r = r.OrderByDescending(o => o.Email);
            //        }
            //    }
            //    if (c.sortname.ToLower().Equals("edulevel")) {
            //        if (c.sortorder.ToLower().Equals("asc")) {
            //            r = r.OrderBy(o => o.EduLevel);
            //        } else {
            //            r = r.OrderByDescending(o => o.EduLevel);
            //        }
            //    }
            //    if (c.sortname.ToLower().Equals("isgaokao")) {
            //        if (c.sortorder.ToLower().Equals("asc")) {
            //            r = r.OrderBy(o => o.IsGaoKao);
            //        } else {
            //            r = r.OrderByDescending(o => o.IsGaoKao);
            //        }
            //    }
            //    if (c.sortname.ToLower().Equals("gaokaoscore")) {
            //        if (c.sortorder.ToLower().Equals("asc")) {
            //            r = r.OrderBy(o => o.GaoKaoScore);
            //        } else {
            //            r = r.OrderByDescending(o => o.GaoKaoScore);
            //        }
            //    }
            //    if (c.sortname.ToLower().Equals("gaokaobatch")) {
            //        if (c.sortorder.ToLower().Equals("asc")) {
            //            r = r.OrderBy(o => o.GaoKaoBatch);
            //        } else {
            //            r = r.OrderByDescending(o => o.GaoKaoBatch);
            //        }
            //    }
            //    if (c.sortname.ToLower().Equals("districtid")) {
            //        if (c.sortorder.ToLower().Equals("asc")) {
            //            r = r.OrderBy(o => o.DistrictId);
            //        } else {
            //            r = r.OrderByDescending(o => o.DistrictId);
            //        }
            //    }
            //    if (c.sortname.ToLower().Equals("address")) {
            //        if (c.sortorder.ToLower().Equals("asc")) {
            //            r = r.OrderBy(o => o.Address);
            //        } else {
            //            r = r.OrderByDescending(o => o.Address);
            //        }
            //    }
            //    if (c.sortname.ToLower().Equals("postcode")) {
            //        if (c.sortorder.ToLower().Equals("asc")) {
            //            r = r.OrderBy(o => o.Postcode);
            //        } else {
            //            r = r.OrderByDescending(o => o.Postcode);
            //        }
            //    }
            //    if (c.sortname.ToLower().Equals("smallinfosourceid")) {
            //        if (c.sortorder.ToLower().Equals("asc")) {
            //            r = r.OrderBy(o => o.SmallInfoSourceId);
            //        } else {
            //            r = r.OrderByDescending(o => o.SmallInfoSourceId);
            //        }
            //    }
            //    if (c.sortname.ToLower().Equals("consulttype")) {
            //        if (c.sortorder.ToLower().Equals("asc")) {
            //            r = r.OrderBy(o => o.ConsultType);
            //        } else {
            //            r = r.OrderByDescending(o => o.ConsultType);
            //        }
            //    }
            //    if (c.sortname.ToLower().Equals("remark")) {
            //        if (c.sortorder.ToLower().Equals("asc")) {
            //            r = r.OrderBy(o => o.Remark);
            //        } else {
            //            r = r.OrderByDescending(o => o.Remark);
            //        }
            //    }
            //    if (c.sortname.ToLower().Equals("consultantid1")) {
            //        if (c.sortorder.ToLower().Equals("asc")) {
            //            r = r.OrderBy(o => o.ConsultantId1);
            //        } else {
            //            r = r.OrderByDescending(o => o.ConsultantId1);
            //        }
            //    }
            //    if (c.sortname.ToLower().Equals("consultantid2")) {
            //        if (c.sortorder.ToLower().Equals("asc")) {
            //            r = r.OrderBy(o => o.ConsultantId2);
            //        } else {
            //            r = r.OrderByDescending(o => o.ConsultantId2);
            //        }
            //    }
            //    if (c.sortname.ToLower().Equals("netconsultantid")) {
            //        if (c.sortorder.ToLower().Equals("asc")) {
            //            r = r.OrderBy(o => o.NetConsultantId);
            //        } else {
            //            r = r.OrderByDescending(o => o.NetConsultantId);
            //        }
            //    }
            //    if (c.sortname.ToLower().Equals("createteacherid")) {
            //        if (c.sortorder.ToLower().Equals("asc")) {
            //            r = r.OrderBy(o => o.CreateTeacherId);
            //        } else {
            //            r = r.OrderByDescending(o => o.CreateTeacherId);
            //        }
            //    }
            //    if (c.sortname.ToLower().Equals("consulttime")) {
            //        if (c.sortorder.ToLower().Equals("asc")) {
            //            r = r.OrderBy(o => o.ConsultTime);
            //        } else {
            //            r = r.OrderByDescending(o => o.ConsultTime);
            //        }
            //    }
            //    if (c.sortname.ToLower().Equals("salesteamid")) {
            //        if (c.sortorder.ToLower().Equals("asc")) {
            //            r = r.OrderBy(o => o.SalesTeamId);
            //        } else {
            //            r = r.OrderByDescending(o => o.SalesTeamId);
            //        }
            //    }
            //    if (c.sortname.ToLower().Equals("salesmanid")) {
            //        if (c.sortorder.ToLower().Equals("asc")) {
            //            r = r.OrderBy(o => o.SalesmanId);
            //        } else {
            //            r = r.OrderByDescending(o => o.SalesmanId);
            //        }
            //    }
            //    if (c.sortname.ToLower().Equals("isimport")) {
            //        if (c.sortorder.ToLower().Equals("asc")) {
            //            r = r.OrderBy(o => o.IsImport);
            //        } else {
            //            r = r.OrderByDescending(o => o.IsImport);
            //        }
            //    }
            //    if (c.sortname.ToLower().Equals("telesalestimes")) {
            //        if (c.sortorder.ToLower().Equals("asc")) {
            //            r = r.OrderBy(o => o.TeleSalesTimes);
            //        } else {
            //            r = r.OrderByDescending(o => o.TeleSalesTimes);
            //        }
            //    }
            //    if (c.sortname.ToLower().Equals("nexttelesalestime")) {
            //        if (c.sortorder.ToLower().Equals("asc")) {
            //            r = r.OrderBy(o => o.NextTeleSalesTime);
            //        } else {
            //            r = r.OrderByDescending(o => o.NextTeleSalesTime);
            //        }
            //    }
            //    if (c.sortname.ToLower().Equals("appointmenttime")) {
            //        if (c.sortorder.ToLower().Equals("asc")) {
            //            r = r.OrderBy(o => o.AppointmentTime);
            //        } else {
            //            r = r.OrderByDescending(o => o.AppointmentTime);
            //        }
            //    }
            //    if (c.sortname.ToLower().Equals("dropintime")) {
            //        if (c.sortorder.ToLower().Equals("asc")) {
            //            r = r.OrderBy(o => o.DropInTime);
            //        } else {
            //            r = r.OrderByDescending(o => o.DropInTime);
            //        }
            //    }
            //    if (c.sortname.ToLower().Equals("dinweitime")) {
            //        if (c.sortorder.ToLower().Equals("asc")) {
            //            r = r.OrderBy(o => o.DinWeiTime);
            //        } else {
            //            r = r.OrderByDescending(o => o.DinWeiTime);
            //        }
            //    }
            //    if (c.sortname.ToLower().Equals("signuptime")) {
            //        if (c.sortorder.ToLower().Equals("asc")) {
            //            r = r.OrderBy(o => o.SignUpTime);
            //        } else {
            //            r = r.OrderByDescending(o => o.SignUpTime);
            //        }
            //    }
            //    if (c.sortname.ToLower().Equals("isdinwei")) {
            //        if (c.sortorder.ToLower().Equals("asc")) {
            //            r = r.OrderBy(o => o.IsDinWei);
            //        } else {
            //            r = r.OrderByDescending(o => o.IsDinWei);
            //        }
            //    }
            //    if (c.sortname.ToLower().Equals("isclosed")) {
            //        if (c.sortorder.ToLower().Equals("asc")) {
            //            r = r.OrderBy(o => o.IsClosed);
            //        } else {
            //            r = r.OrderByDescending(o => o.IsClosed);
            //        }
            //    }
            //    if (c.sortname.ToLower().Equals("lastsalestime")) {
            //        if (c.sortorder.ToLower().Equals("asc")) {
            //            r = r.OrderBy(o => o.LastSalesTime);
            //        } else {
            //            r = r.OrderByDescending(o => o.LastSalesTime);
            //        }
            //    }
            //    if (c.sortname.ToLower().Equals("important")) {
            //        if (c.sortorder.ToLower().Equals("asc")) {
            //            r = r.OrderBy(o => o.Important);
            //        } else {
            //            r = r.OrderByDescending(o => o.Important);
            //        }
            //    }
            //    if (c.sortname.ToLower().Equals("consultantremark")) {
            //        if (c.sortorder.ToLower().Equals("asc")) {
            //            r = r.OrderBy(o => o.ConsultantRemark);
            //        } else {
            //            r = r.OrderByDescending(o => o.ConsultantRemark);
            //        }
            //    }
            //    if (c.sortname.ToLower().Equals("keywords")) {
            //        if (c.sortorder.ToLower().Equals("asc")) {
            //            r = r.OrderBy(o => o.Keywords);
            //        } else {
            //            r = r.OrderByDescending(o => o.Keywords);
            //        }
            //    }
            //    if (c.sortname.ToLower().Equals("clazz")) {
            //        if (c.sortorder.ToLower().Equals("asc")) {
            //            r = r.OrderBy(o => o.Clazz);
            //        } else {
            //            r = r.OrderByDescending(o => o.Clazz);
            //        }
            //    }

            //}
            //#endregion

            //m.RecordCount = r.OrderBy(o=>o.Name).Count();
            //if (!c.pagesize.HasValue) {
            //    c.pagesize = 20;
            //}
            //if (c.pagesize.HasValue) {
            //    int page = c.page ?? 1;
            //    int pageCount = m.RecordCount / c.pagesize.Value;
            //    if (m.RecordCount % c.pagesize.Value > 0) {
            //        pageCount++;
            //    }
            //    int skip = (page - 1) * c.pagesize.Value;
            //    if (skip > 0) {
            //        r = r.Skip(skip);
            //        //u = u.Skip(skip);
            //    }
            //    r = r.Take(c.pagesize.Value);
            //    //u = u.Take(c.pagesize.Value);
            //}

            //m.Data = r.ToList();
            ////m.Data = u.ToList();
            //return m;
            #endregion
        }
示例#2
0
        public IEnumerable<Customer> FindByCriteria(CustomerCriteria c)
        {
            return this.DbContext.Customers.Include("District").Include("InfoSource").Include("School").Include("Consultant1").Include("Consultant2").Include("CreateTeacher").Include("NetConsultant").Include("Salesman").Include("SalesTeam").Include("InClazz").Where(o =>
                (!c.IdSrh.HasValue || o.Id.Equals(c.IdSrh.Value))
                && (!c.IdFromSrh.HasValue || o.Id >= c.IdFromSrh.Value)
                && (!c.IdToSrh.HasValue || o.Id <= c.IdToSrh.Value)
                && (String.IsNullOrEmpty(c.NameSrh) || o.Name.Contains(c.NameSrh))
                && (!c.SchoolIdSrh.HasValue || (o.SchoolId.HasValue 			&& o.SchoolId.Value.Equals(c.SchoolIdSrh.Value)))
                && (!c.SchoolIdFromSrh.HasValue || (o.SchoolId.HasValue 			&& o.SchoolId.Value >= c.SchoolIdFromSrh.Value))
                && (!c.SchoolIdToSrh.HasValue || (o.SchoolId.HasValue 			&& o.SchoolId.Value <= c.SchoolIdToSrh.Value))
                && (!c.MarketYearSrh.HasValue || o.MarketYear.Equals(c.MarketYearSrh.Value))
                && (!c.MarketYearFromSrh.HasValue || o.MarketYear >= c.MarketYearFromSrh.Value)
                && (!c.MarketYearToSrh.HasValue || o.MarketYear <= c.MarketYearToSrh.Value)
                && (String.IsNullOrEmpty(c.TelephoneSrh) || o.Telephone.Contains(c.TelephoneSrh))
                && (String.IsNullOrEmpty(c.MobileSrh) || o.Mobile.Contains(c.MobileSrh))
                && (String.IsNullOrEmpty(c.GenderSrh) || o.Gender.Contains(c.GenderSrh))
                && (String.IsNullOrEmpty(c.QQSrh) || o.QQ.Contains(c.QQSrh))
                && (String.IsNullOrEmpty(c.EmailSrh) || o.Email.Contains(c.EmailSrh))
                && (String.IsNullOrEmpty(c.EduLevelSrh) || o.EduLevel.Contains(c.EduLevelSrh))
                && (!c.IsGaoKaoSrh.HasValue || o.IsGaoKao.Equals(c.IsGaoKaoSrh.Value))
                && (!c.GaoKaoScoreSrh.HasValue || (o.GaoKaoScore.HasValue 			&& o.GaoKaoScore.Value.Equals(c.GaoKaoScoreSrh.Value)))
                && (!c.GaoKaoScoreFromSrh.HasValue || (o.GaoKaoScore.HasValue 			&& o.GaoKaoScore.Value >= c.GaoKaoScoreFromSrh.Value))
                && (!c.GaoKaoScoreToSrh.HasValue || (o.GaoKaoScore.HasValue 			&& o.GaoKaoScore.Value <= c.GaoKaoScoreToSrh.Value))
                && (String.IsNullOrEmpty(c.GaoKaoBatchSrh) || o.GaoKaoBatch.Contains(c.GaoKaoBatchSrh))
                && (!c.DistrictIdSrh.HasValue || (o.DistrictId.HasValue 			&& o.DistrictId.Value.Equals(c.DistrictIdSrh.Value)))
                && (!c.DistrictIdFromSrh.HasValue || (o.DistrictId.HasValue 			&& o.DistrictId.Value >= c.DistrictIdFromSrh.Value))
                && (!c.DistrictIdToSrh.HasValue || (o.DistrictId.HasValue 			&& o.DistrictId.Value <= c.DistrictIdToSrh.Value))
                && (String.IsNullOrEmpty(c.AddressSrh) || o.Address.Contains(c.AddressSrh))
                && (String.IsNullOrEmpty(c.PostcodeSrh) || o.Postcode.Contains(c.PostcodeSrh))
                && (!c.SmallInfoSourceIdSrh.HasValue || o.SmallInfoSourceId.Equals(c.SmallInfoSourceIdSrh.Value))
                && (!c.SmallInfoSourceIdFromSrh.HasValue || o.SmallInfoSourceId >= c.SmallInfoSourceIdFromSrh.Value)
                && (!c.SmallInfoSourceIdToSrh.HasValue || o.SmallInfoSourceId <= c.SmallInfoSourceIdToSrh.Value)
                && (String.IsNullOrEmpty(c.ConsultTypeSrh) || o.ConsultType.Contains(c.ConsultTypeSrh))
                && (String.IsNullOrEmpty(c.RemarkSrh) || o.Remark.Contains(c.RemarkSrh))
                && (!c.ConsultantId1Srh.HasValue || (o.ConsultantId1.HasValue 			&& o.ConsultantId1.Value.Equals(c.ConsultantId1Srh.Value)))
                && (!c.ConsultantId1FromSrh.HasValue || (o.ConsultantId1.HasValue 			&& o.ConsultantId1.Value >= c.ConsultantId1FromSrh.Value))
                && (!c.ConsultantId1ToSrh.HasValue || (o.ConsultantId1.HasValue 			&& o.ConsultantId1.Value <= c.ConsultantId1ToSrh.Value))
                && (!c.ConsultantId2Srh.HasValue || (o.ConsultantId2.HasValue 			&& o.ConsultantId2.Value.Equals(c.ConsultantId2Srh.Value)))
                && (!c.ConsultantId2FromSrh.HasValue || (o.ConsultantId2.HasValue 			&& o.ConsultantId2.Value >= c.ConsultantId2FromSrh.Value))
                && (!c.ConsultantId2ToSrh.HasValue || (o.ConsultantId2.HasValue 			&& o.ConsultantId2.Value <= c.ConsultantId2ToSrh.Value))
                && (!c.NetConsultantIdSrh.HasValue || (o.NetConsultantId.HasValue 			&& o.NetConsultantId.Value.Equals(c.NetConsultantIdSrh.Value)))
                && (!c.NetConsultantIdFromSrh.HasValue || (o.NetConsultantId.HasValue 			&& o.NetConsultantId.Value >= c.NetConsultantIdFromSrh.Value))
                && (!c.NetConsultantIdToSrh.HasValue || (o.NetConsultantId.HasValue 			&& o.NetConsultantId.Value <= c.NetConsultantIdToSrh.Value))
                && (!c.CreateTeacherIdSrh.HasValue || (o.CreateTeacherId.HasValue 			&& o.CreateTeacherId.Value.Equals(c.CreateTeacherIdSrh.Value)))
                && (!c.CreateTeacherIdFromSrh.HasValue || (o.CreateTeacherId.HasValue 			&& o.CreateTeacherId.Value >= c.CreateTeacherIdFromSrh.Value))
                && (!c.CreateTeacherIdToSrh.HasValue || (o.CreateTeacherId.HasValue 			&& o.CreateTeacherId.Value <= c.CreateTeacherIdToSrh.Value))
                && (!c.ConsultTimeSrh.HasValue || (o.ConsultTime.HasValue 			&& o.ConsultTime.Value.Equals(c.ConsultTimeSrh.Value)))
                && (!c.ConsultTimeFromSrh.HasValue || (o.ConsultTime.HasValue 			&& o.ConsultTime.Value >= c.ConsultTimeFromSrh.Value))
                && (!c.ConsultTimeToSrh.HasValue || (o.ConsultTime.HasValue 			&& o.ConsultTime.Value <= c.ConsultTimeToSrh.Value))
                && (!c.SalesTeamIdSrh.HasValue || (o.SalesTeamId.HasValue 			&& o.SalesTeamId.Value.Equals(c.SalesTeamIdSrh.Value)))
                && (!c.SalesTeamIdFromSrh.HasValue || (o.SalesTeamId.HasValue 			&& o.SalesTeamId.Value >= c.SalesTeamIdFromSrh.Value))
                && (!c.SalesTeamIdToSrh.HasValue || (o.SalesTeamId.HasValue 			&& o.SalesTeamId.Value <= c.SalesTeamIdToSrh.Value))
                && (!c.SalesmanIdSrh.HasValue || (o.SalesmanId.HasValue 			&& o.SalesmanId.Value.Equals(c.SalesmanIdSrh.Value)))
                && (!c.SalesmanIdFromSrh.HasValue || (o.SalesmanId.HasValue 			&& o.SalesmanId.Value >= c.SalesmanIdFromSrh.Value))
                && (!c.SalesmanIdToSrh.HasValue || (o.SalesmanId.HasValue 			&& o.SalesmanId.Value <= c.SalesmanIdToSrh.Value))
                && (!c.IsImportSrh.HasValue || o.IsImport.Equals(c.IsImportSrh.Value))
                && (!c.TeleSalesTimesSrh.HasValue || o.TeleSalesTimes.Equals(c.TeleSalesTimesSrh.Value))
                && (!c.TeleSalesTimesFromSrh.HasValue || o.TeleSalesTimes >= c.TeleSalesTimesFromSrh.Value)
                && (!c.TeleSalesTimesToSrh.HasValue || o.TeleSalesTimes <= c.TeleSalesTimesToSrh.Value)
                && (!c.NextTeleSalesTimeSrh.HasValue || (o.NextTeleSalesTime.HasValue 			&& o.NextTeleSalesTime.Value.Equals(c.NextTeleSalesTimeSrh.Value)))
                && (!c.NextTeleSalesTimeFromSrh.HasValue || (o.NextTeleSalesTime.HasValue 			&& o.NextTeleSalesTime.Value >= c.NextTeleSalesTimeFromSrh.Value))
                && (!c.NextTeleSalesTimeToSrh.HasValue || (o.NextTeleSalesTime.HasValue 			&& o.NextTeleSalesTime.Value <= c.NextTeleSalesTimeToSrh.Value))
                && (!c.AppointmentTimeSrh.HasValue || (o.AppointmentTime.HasValue 			&& o.AppointmentTime.Value.Equals(c.AppointmentTimeSrh.Value)))
                && (!c.AppointmentTimeFromSrh.HasValue || (o.AppointmentTime.HasValue 			&& o.AppointmentTime.Value >= c.AppointmentTimeFromSrh.Value))
                && (!c.AppointmentTimeToSrh.HasValue || (o.AppointmentTime.HasValue 			&& o.AppointmentTime.Value <= c.AppointmentTimeToSrh.Value))
                && (!c.DropInTimeSrh.HasValue || (o.DropInTime.HasValue 			&& o.DropInTime.Value.Equals(c.DropInTimeSrh.Value)))
                && (!c.DropInTimeFromSrh.HasValue || (o.DropInTime.HasValue 			&& o.DropInTime.Value >= c.DropInTimeFromSrh.Value))
                && (!c.DropInTimeToSrh.HasValue || (o.DropInTime.HasValue 			&& o.DropInTime.Value <= c.DropInTimeToSrh.Value))
                && (!c.DinWeiTimeSrh.HasValue || (o.DinWeiTime.HasValue 			&& o.DinWeiTime.Value.Equals(c.DinWeiTimeSrh.Value)))
                && (!c.DinWeiTimeFromSrh.HasValue || (o.DinWeiTime.HasValue 			&& o.DinWeiTime.Value >= c.DinWeiTimeFromSrh.Value))
                && (!c.DinWeiTimeToSrh.HasValue || (o.DinWeiTime.HasValue 			&& o.DinWeiTime.Value <= c.DinWeiTimeToSrh.Value))
                && (!c.SignUpTimeSrh.HasValue || (o.SignUpTime.HasValue 			&& o.SignUpTime.Value.Equals(c.SignUpTimeSrh.Value)))
                && (!c.SignUpTimeFromSrh.HasValue || (o.SignUpTime.HasValue 			&& o.SignUpTime.Value >= c.SignUpTimeFromSrh.Value))
                && (!c.SignUpTimeToSrh.HasValue || (o.SignUpTime.HasValue 			&& o.SignUpTime.Value <= c.SignUpTimeToSrh.Value))
                && (!c.IsDinWeiSrh.HasValue || o.IsDinWei.Equals(c.IsDinWeiSrh.Value))
                && (!c.IsClosedSrh.HasValue || o.IsClosed.Equals(c.IsClosedSrh.Value))
                && (!c.LastSalesTimeSrh.HasValue || (o.LastSalesTime.HasValue 			&& o.LastSalesTime.Value.Equals(c.LastSalesTimeSrh.Value)))
                && (!c.LastSalesTimeFromSrh.HasValue || (o.LastSalesTime.HasValue 			&& o.LastSalesTime.Value >= c.LastSalesTimeFromSrh.Value))
                && (!c.LastSalesTimeToSrh.HasValue || (o.LastSalesTime.HasValue 			&& o.LastSalesTime.Value <= c.LastSalesTimeToSrh.Value))
                && (!c.ImportantSrh.HasValue || o.Important.Equals(c.ImportantSrh.Value))
                && (String.IsNullOrEmpty(c.ConsultantRemarkSrh) || o.ConsultantRemark.Contains(c.ConsultantRemarkSrh))
                && (String.IsNullOrEmpty(c.KeywordsSrh) || o.Keywords.Contains(c.KeywordsSrh))
                && (String.IsNullOrEmpty(c.ClazzSrh) || o.Clazz.Contains(c.ClazzSrh))
                && (!c.IsLeaderFollowSrh.HasValue || o.IsLeaderFollow.Equals(c.IsLeaderFollowSrh.Value))
                && (String.IsNullOrEmpty(c.StatusSrh) || o.Status.Contains(c.StatusSrh))
                && (String.IsNullOrEmpty(c.LastSaleLogSrh) || o.LastSaleLog.Contains(c.LastSaleLogSrh))
                && (!c.IsDormSrh.HasValue || (o.IsDorm.HasValue 			&& o.IsDorm.Value.Equals(c.IsDormSrh.Value)))
                && (!c.InClazzIdSrh.HasValue || (o.InClazzId.HasValue 			&& o.InClazzId.Value.Equals(c.InClazzIdSrh.Value)))
                && (!c.InClazzIdFromSrh.HasValue || (o.InClazzId.HasValue 			&& o.InClazzId.Value >= c.InClazzIdFromSrh.Value))
                && (!c.InClazzIdToSrh.HasValue || (o.InClazzId.HasValue 			&& o.InClazzId.Value <= c.InClazzIdToSrh.Value))
                && (!c.IsPaySrh.HasValue || o.IsPay.Equals(c.IsPaySrh.Value))
                && (!c.PayTimeSrh.HasValue || (o.PayTime.HasValue 			&& o.PayTime.Value.Equals(c.PayTimeSrh.Value)))
                && (!c.PayTimeFromSrh.HasValue || (o.PayTime.HasValue 			&& o.PayTime.Value >= c.PayTimeFromSrh.Value))
                && (!c.PayTimeToSrh.HasValue || (o.PayTime.HasValue 			&& o.PayTime.Value <= c.PayTimeToSrh.Value))
                && (!c.IsRefundSrh.HasValue || o.IsRefund.Equals(c.IsRefundSrh.Value))
                && (!c.RefundTimeSrh.HasValue || (o.RefundTime.HasValue 			&& o.RefundTime.Value.Equals(c.RefundTimeSrh.Value)))
                && (!c.RefundTimeFromSrh.HasValue || (o.RefundTime.HasValue 			&& o.RefundTime.Value >= c.RefundTimeFromSrh.Value))
                && (!c.RefundTimeToSrh.HasValue || (o.RefundTime.HasValue 			&& o.RefundTime.Value <= c.RefundTimeToSrh.Value))
                && (!c.IsDropInSrh.HasValue || o.IsDropIn.Equals(c.IsDropInSrh.Value))
                && (!c.IsSignUpSrh.HasValue || o.IsSignUp.Equals(c.IsSignUpSrh.Value))

            );
        }
示例#3
0
 public PagedModel<Customer> FindDuplicate(CustomerCriteria c)
 {
     return this.Repository.FindDuplicate(c);
 }
示例#4
0
        public PagedModel<Customer> FindByCriteria(CustomerCriteria c)
        {
            PagedModel<Customer> m = new PagedModel<Customer>();
            var r = this.Repository.FindByCriteria(c);
            if(!String.IsNullOrEmpty(c.sortname)){
            if(c.sortname.ToLower().Equals("id")){
                if(c.sortorder.ToLower().Equals("asc")){
                    r = r.OrderBy(o=>o.Id);
                }else{
                    r = r.OrderByDescending(o=>o.Id);
                }
            }
            if(c.sortname.ToLower().Equals("name")){
                if(c.sortorder.ToLower().Equals("asc")){
                    r = r.OrderBy(o=>o.Name);
                }else{
                    r = r.OrderByDescending(o=>o.Name);
                }
            }
            if(c.sortname.ToLower().Equals("schoolid")){
                if(c.sortorder.ToLower().Equals("asc")){
                    r = r.OrderBy(o=>o.SchoolId);
                }else{
                    r = r.OrderByDescending(o=>o.SchoolId);
                }
            }
            if(c.sortname.ToLower().Equals("marketyear")){
                if(c.sortorder.ToLower().Equals("asc")){
                    r = r.OrderBy(o=>o.MarketYear);
                }else{
                    r = r.OrderByDescending(o=>o.MarketYear);
                }
            }
            if(c.sortname.ToLower().Equals("telephone")){
                if(c.sortorder.ToLower().Equals("asc")){
                    r = r.OrderBy(o=>o.Telephone);
                }else{
                    r = r.OrderByDescending(o=>o.Telephone);
                }
            }
            if(c.sortname.ToLower().Equals("mobile")){
                if(c.sortorder.ToLower().Equals("asc")){
                    r = r.OrderBy(o=>o.Mobile);
                }else{
                    r = r.OrderByDescending(o=>o.Mobile);
                }
            }
            if(c.sortname.ToLower().Equals("gender")){
                if(c.sortorder.ToLower().Equals("asc")){
                    r = r.OrderBy(o=>o.Gender);
                }else{
                    r = r.OrderByDescending(o=>o.Gender);
                }
            }
            if(c.sortname.ToLower().Equals("qq")){
                if(c.sortorder.ToLower().Equals("asc")){
                    r = r.OrderBy(o=>o.QQ);
                }else{
                    r = r.OrderByDescending(o=>o.QQ);
                }
            }
            if(c.sortname.ToLower().Equals("email")){
                if(c.sortorder.ToLower().Equals("asc")){
                    r = r.OrderBy(o=>o.Email);
                }else{
                    r = r.OrderByDescending(o=>o.Email);
                }
            }
            if(c.sortname.ToLower().Equals("edulevel")){
                if(c.sortorder.ToLower().Equals("asc")){
                    r = r.OrderBy(o=>o.EduLevel);
                }else{
                    r = r.OrderByDescending(o=>o.EduLevel);
                }
            }
            if(c.sortname.ToLower().Equals("isgaokao")){
                if(c.sortorder.ToLower().Equals("asc")){
                    r = r.OrderBy(o=>o.IsGaoKao);
                }else{
                    r = r.OrderByDescending(o=>o.IsGaoKao);
                }
            }
            if(c.sortname.ToLower().Equals("gaokaoscore")){
                if(c.sortorder.ToLower().Equals("asc")){
                    r = r.OrderBy(o=>o.GaoKaoScore);
                }else{
                    r = r.OrderByDescending(o=>o.GaoKaoScore);
                }
            }
            if(c.sortname.ToLower().Equals("gaokaobatch")){
                if(c.sortorder.ToLower().Equals("asc")){
                    r = r.OrderBy(o=>o.GaoKaoBatch);
                }else{
                    r = r.OrderByDescending(o=>o.GaoKaoBatch);
                }
            }
            if(c.sortname.ToLower().Equals("districtid")){
                if(c.sortorder.ToLower().Equals("asc")){
                    r = r.OrderBy(o=>o.DistrictId);
                }else{
                    r = r.OrderByDescending(o=>o.DistrictId);
                }
            }
            if(c.sortname.ToLower().Equals("address")){
                if(c.sortorder.ToLower().Equals("asc")){
                    r = r.OrderBy(o=>o.Address);
                }else{
                    r = r.OrderByDescending(o=>o.Address);
                }
            }
            if(c.sortname.ToLower().Equals("postcode")){
                if(c.sortorder.ToLower().Equals("asc")){
                    r = r.OrderBy(o=>o.Postcode);
                }else{
                    r = r.OrderByDescending(o=>o.Postcode);
                }
            }
            if(c.sortname.ToLower().Equals("smallinfosourceid")){
                if(c.sortorder.ToLower().Equals("asc")){
                    r = r.OrderBy(o=>o.SmallInfoSourceId);
                }else{
                    r = r.OrderByDescending(o=>o.SmallInfoSourceId);
                }
            }
            if(c.sortname.ToLower().Equals("consulttype")){
                if(c.sortorder.ToLower().Equals("asc")){
                    r = r.OrderBy(o=>o.ConsultType);
                }else{
                    r = r.OrderByDescending(o=>o.ConsultType);
                }
            }
            if(c.sortname.ToLower().Equals("remark")){
                if(c.sortorder.ToLower().Equals("asc")){
                    r = r.OrderBy(o=>o.Remark);
                }else{
                    r = r.OrderByDescending(o=>o.Remark);
                }
            }
            if(c.sortname.ToLower().Equals("consultantid1")){
                if(c.sortorder.ToLower().Equals("asc")){
                    r = r.OrderBy(o=>o.ConsultantId1);
                }else{
                    r = r.OrderByDescending(o=>o.ConsultantId1);
                }
            }
            if(c.sortname.ToLower().Equals("consultantid2")){
                if(c.sortorder.ToLower().Equals("asc")){
                    r = r.OrderBy(o=>o.ConsultantId2);
                }else{
                    r = r.OrderByDescending(o=>o.ConsultantId2);
                }
            }
            if(c.sortname.ToLower().Equals("netconsultantid")){
                if(c.sortorder.ToLower().Equals("asc")){
                    r = r.OrderBy(o=>o.NetConsultantId);
                }else{
                    r = r.OrderByDescending(o=>o.NetConsultantId);
                }
            }
            if(c.sortname.ToLower().Equals("createteacherid")){
                if(c.sortorder.ToLower().Equals("asc")){
                    r = r.OrderBy(o=>o.CreateTeacherId);
                }else{
                    r = r.OrderByDescending(o=>o.CreateTeacherId);
                }
            }
            if(c.sortname.ToLower().Equals("consulttime")){
                if(c.sortorder.ToLower().Equals("asc")){
                    r = r.OrderBy(o=>o.ConsultTime);
                }else{
                    r = r.OrderByDescending(o=>o.ConsultTime);
                }
            }
            if(c.sortname.ToLower().Equals("salesteamid")){
                if(c.sortorder.ToLower().Equals("asc")){
                    r = r.OrderBy(o=>o.SalesTeamId);
                }else{
                    r = r.OrderByDescending(o=>o.SalesTeamId);
                }
            }
            if(c.sortname.ToLower().Equals("salesmanid")){
                if(c.sortorder.ToLower().Equals("asc")){
                    r = r.OrderBy(o=>o.SalesmanId);
                }else{
                    r = r.OrderByDescending(o=>o.SalesmanId);
                }
            }
            if(c.sortname.ToLower().Equals("isimport")){
                if(c.sortorder.ToLower().Equals("asc")){
                    r = r.OrderBy(o=>o.IsImport);
                }else{
                    r = r.OrderByDescending(o=>o.IsImport);
                }
            }
            if(c.sortname.ToLower().Equals("telesalestimes")){
                if(c.sortorder.ToLower().Equals("asc")){
                    r = r.OrderBy(o=>o.TeleSalesTimes);
                }else{
                    r = r.OrderByDescending(o=>o.TeleSalesTimes);
                }
            }
            if(c.sortname.ToLower().Equals("nexttelesalestime")){
                if(c.sortorder.ToLower().Equals("asc")){
                    r = r.OrderBy(o=>o.NextTeleSalesTime);
                }else{
                    r = r.OrderByDescending(o=>o.NextTeleSalesTime);
                }
            }
            if(c.sortname.ToLower().Equals("appointmenttime")){
                if(c.sortorder.ToLower().Equals("asc")){
                    r = r.OrderBy(o=>o.AppointmentTime);
                }else{
                    r = r.OrderByDescending(o=>o.AppointmentTime);
                }
            }
            if(c.sortname.ToLower().Equals("dropintime")){
                if(c.sortorder.ToLower().Equals("asc")){
                    r = r.OrderBy(o=>o.DropInTime);
                }else{
                    r = r.OrderByDescending(o=>o.DropInTime);
                }
            }
            if(c.sortname.ToLower().Equals("dinweitime")){
                if(c.sortorder.ToLower().Equals("asc")){
                    r = r.OrderBy(o=>o.DinWeiTime);
                }else{
                    r = r.OrderByDescending(o=>o.DinWeiTime);
                }
            }
            if(c.sortname.ToLower().Equals("signuptime")){
                if(c.sortorder.ToLower().Equals("asc")){
                    r = r.OrderBy(o=>o.SignUpTime);
                }else{
                    r = r.OrderByDescending(o=>o.SignUpTime);
                }
            }
            if(c.sortname.ToLower().Equals("isdinwei")){
                if(c.sortorder.ToLower().Equals("asc")){
                    r = r.OrderBy(o=>o.IsDinWei);
                }else{
                    r = r.OrderByDescending(o=>o.IsDinWei);
                }
            }
            if(c.sortname.ToLower().Equals("isclosed")){
                if(c.sortorder.ToLower().Equals("asc")){
                    r = r.OrderBy(o=>o.IsClosed);
                }else{
                    r = r.OrderByDescending(o=>o.IsClosed);
                }
            }
            if(c.sortname.ToLower().Equals("lastsalestime")){
                if(c.sortorder.ToLower().Equals("asc")){
                    r = r.OrderBy(o=>o.LastSalesTime);
                }else{
                    r = r.OrderByDescending(o=>o.LastSalesTime);
                }
            }
            if(c.sortname.ToLower().Equals("important")){
                if(c.sortorder.ToLower().Equals("asc")){
                    r = r.OrderBy(o=>o.Important);
                }else{
                    r = r.OrderByDescending(o=>o.Important);
                }
            }
            if(c.sortname.ToLower().Equals("consultantremark")){
                if(c.sortorder.ToLower().Equals("asc")){
                    r = r.OrderBy(o=>o.ConsultantRemark);
                }else{
                    r = r.OrderByDescending(o=>o.ConsultantRemark);
                }
            }
            if(c.sortname.ToLower().Equals("keywords")){
                if(c.sortorder.ToLower().Equals("asc")){
                    r = r.OrderBy(o=>o.Keywords);
                }else{
                    r = r.OrderByDescending(o=>o.Keywords);
                }
            }
            if(c.sortname.ToLower().Equals("clazz")){
                if(c.sortorder.ToLower().Equals("asc")){
                    r = r.OrderBy(o=>o.Clazz);
                }else{
                    r = r.OrderByDescending(o=>o.Clazz);
                }
            }
            if(c.sortname.ToLower().Equals("isleaderfollow")){
                if(c.sortorder.ToLower().Equals("asc")){
                    r = r.OrderBy(o=>o.IsLeaderFollow);
                }else{
                    r = r.OrderByDescending(o=>o.IsLeaderFollow);
                }
            }
            if(c.sortname.ToLower().Equals("status")){
                if(c.sortorder.ToLower().Equals("asc")){
                    r = r.OrderBy(o=>o.Status);
                }else{
                    r = r.OrderByDescending(o=>o.Status);
                }
            }
            if(c.sortname.ToLower().Equals("lastsalelog")){
                if(c.sortorder.ToLower().Equals("asc")){
                    r = r.OrderBy(o=>o.LastSaleLog);
                }else{
                    r = r.OrderByDescending(o=>o.LastSaleLog);
                }
            }
            if(c.sortname.ToLower().Equals("isdorm")){
                if(c.sortorder.ToLower().Equals("asc")){
                    r = r.OrderBy(o=>o.IsDorm);
                }else{
                    r = r.OrderByDescending(o=>o.IsDorm);
                }
            }
            if(c.sortname.ToLower().Equals("inclazzid")){
                if(c.sortorder.ToLower().Equals("asc")){
                    r = r.OrderBy(o=>o.InClazzId);
                }else{
                    r = r.OrderByDescending(o=>o.InClazzId);
                }
            }
            if(c.sortname.ToLower().Equals("ispay")){
                if(c.sortorder.ToLower().Equals("asc")){
                    r = r.OrderBy(o=>o.IsPay);
                }else{
                    r = r.OrderByDescending(o=>o.IsPay);
                }
            }
            if(c.sortname.ToLower().Equals("paytime")){
                if(c.sortorder.ToLower().Equals("asc")){
                    r = r.OrderBy(o=>o.PayTime);
                }else{
                    r = r.OrderByDescending(o=>o.PayTime);
                }
            }
            if(c.sortname.ToLower().Equals("isrefund")){
                if(c.sortorder.ToLower().Equals("asc")){
                    r = r.OrderBy(o=>o.IsRefund);
                }else{
                    r = r.OrderByDescending(o=>o.IsRefund);
                }
            }
            if(c.sortname.ToLower().Equals("refundtime")){
                if(c.sortorder.ToLower().Equals("asc")){
                    r = r.OrderBy(o=>o.RefundTime);
                }else{
                    r = r.OrderByDescending(o=>o.RefundTime);
                }
            }
            if(c.sortname.ToLower().Equals("isdropin")){
                if(c.sortorder.ToLower().Equals("asc")){
                    r = r.OrderBy(o=>o.IsDropIn);
                }else{
                    r = r.OrderByDescending(o=>o.IsDropIn);
                }
            }
            if(c.sortname.ToLower().Equals("issignup")){
                if(c.sortorder.ToLower().Equals("asc")){
                    r = r.OrderBy(o=>o.IsSignUp);
                }else{
                    r = r.OrderByDescending(o=>o.IsSignUp);
                }
            }

            }

            m.RecordCount = r.Count();
            if (c.pagesize.HasValue) {
                int page = c.page ?? 1;
                int pageCount = m.RecordCount / c.pagesize.Value;
                if (m.RecordCount % c.pagesize.Value > 0) {
                    pageCount++;
                }
                int skip = (page - 1) * c.pagesize.Value;
                if (skip > 0) {
                    r = r.Skip(skip);
                }
                r = r.Take(c.pagesize.Value);
            }

            m.Data = r.ToList();
            return m;
        }