public List <VHelpArea> SearchMyInfoByWhere(GetMyListViewModel VSearchModel) { //查询条件 var predicate = WhereExtension.True <VHelpArea>();//初始化where表达式 // 不显示 已删除的信息 20191111 predicate = predicate.And(p => !p.Status.Equals("3")); if (!String.IsNullOrEmpty(VSearchModel.CommunityID)) { predicate = predicate.And(p => p.CommunityID.Contains(VSearchModel.CommunityID)); } if (!String.IsNullOrEmpty(VSearchModel.TypeIDs)) { predicate = predicate.And(p => p.TypeID.Contains(VSearchModel.TypeIDs)); } if (!String.IsNullOrEmpty(VSearchModel.Status)) { predicate = predicate.And(p => p.Address.Contains(VSearchModel.Status)); } var result = DbSet.Where(predicate) .OrderByDescending(o => o.CreateDate).ToList(); return(result); }
//根据条件查询用户 private Expression <Func <VolunteerActivity, bool> > SearchVAWhere(VolunteerActivitySearchViewModel VSearchViewModel) { var predicate = WhereExtension.True <VolunteerActivity>();//初始化where表达式 if (!String.IsNullOrEmpty(VSearchViewModel.ID)) { predicate = predicate.And(p => p.ID.Contains(VSearchViewModel.ID)); } if (!String.IsNullOrEmpty(VSearchViewModel.Title)) { predicate = predicate.And(p => p.Title.Contains(VSearchViewModel.Title)); } if (!String.IsNullOrEmpty(VSearchViewModel.CommunityID)) { predicate = predicate.And(p => p.CommunityID.Contains(VSearchViewModel.CommunityID)); } if (!String.IsNullOrEmpty(VSearchViewModel.Address)) { predicate = predicate.And(p => p.Address.Contains(VSearchViewModel.Address)); } if (!String.IsNullOrEmpty(VSearchViewModel.TypeIDs)) { predicate = predicate.And(p => p.TypeIDs.Contains(VSearchViewModel.TypeIDs)); } return(predicate); }
//根据条件查询 public List <VolunteerActivity> SearchInfoByWhere(AllSearchViewModel VSearchViewModel) { //查询条件 var predicate = WhereExtension.True <VolunteerActivity>();//初始化where表达式 // 不显示 已删除的信息 status=0 (20191128) predicate = predicate.And(p => !p.Status.Equals("0")); predicate = predicate.And(p => (p.Title.Contains(VSearchViewModel.Title) || p.Community.Contains(VSearchViewModel.Community) || p.Address.Contains(VSearchViewModel.Address) || p.Type.Contains(VSearchViewModel.Type))); if (!String.IsNullOrEmpty(VSearchViewModel.Status)) { predicate = predicate.And(p => (p.Status.Equals(VSearchViewModel.Status))); } if (!String.IsNullOrEmpty(VSearchViewModel.CommunityID)) { predicate = predicate.And(p => p.CommunityID.Equals(VSearchViewModel.CommunityID)); } if (!String.IsNullOrEmpty(VSearchViewModel.TypeID)) { predicate = predicate.And(p => p.TypeIDs.Equals(VSearchViewModel.TypeID)); } var result = DbSet.Where(predicate) .OrderByDescending(o => o.CreateDate).ToList(); return(result); }
private Expression <Func <ResidentInfo, bool> > SearchUnderAgeWhere(UnderAgerSearchViewModel underAgerSearchViewModel) { var predicate = WhereExtension.True <ResidentInfo>();//初始化where表达式 if (underAgerSearchViewModel.Area != "") { predicate = predicate.And(p => p.InfoRelationShips.HouseInfo.Area.Equals(underAgerSearchViewModel.Area)); } if (underAgerSearchViewModel.Name != "") { predicate = predicate.And(p => p.Name.Equals(underAgerSearchViewModel.Name)); } //根据出生年月范围查询 if (underAgerSearchViewModel.StartTime != null) { predicate = predicate.And(p => DateTime.ParseExact(p.IdNumber.Substring(6, 8), "yyyyMMdd", System.Globalization.CultureInfo.CurrentCulture) >= underAgerSearchViewModel.StartTime); } if (underAgerSearchViewModel.EndTime != null) { predicate = predicate.And(p => DateTime.ParseExact(p.IdNumber.Substring(6, 8), "yyyyMMdd", System.Globalization.CultureInfo.CurrentCulture) <= underAgerSearchViewModel.EndTime); } predicate = predicate.And(p => (Convert.ToInt32(DateTime.Now.Year.ToString()) - Convert.ToInt32(p.IdNumber.Substring(6, 4))) < 18); predicate = predicate.And(p => p.Status == "1"); return(predicate); }
private Expression <Func <Inform, bool> > SearchInformWhere(InformSearchViewModel informSearchViewModel) { var predicate = WhereExtension.True <Inform>();//初始化where表达式 if (informSearchViewModel.StartTime != null) { predicate = predicate.And(p => p.SendTime > informSearchViewModel.StartTime); } if (informSearchViewModel.EndTime != null) { predicate = predicate.And(p => p.SendTime < informSearchViewModel.EndTime); } if (informSearchViewModel.Sender != "") { predicate = predicate.And(p => p.Sender.Contains(informSearchViewModel.Sender)); } if (informSearchViewModel.Title != "") { predicate = predicate.And(p => p.InformTitle.Contains(informSearchViewModel.Title)); } if (informSearchViewModel.Status == "1") { predicate = predicate.And(p => p.Status == "1"); } if (informSearchViewModel.Status == "2") { predicate = predicate.And(p => p.Status == "2"); } if (informSearchViewModel.Status == "3") { predicate = predicate.And(p => p.Status != "0"); } return(predicate); }
private Expression <Func <ResidentInfo, bool> > SearchStatisticsWhere(StatisticsViewModel statisticsViewModel) { var predicate = WhereExtension.True <ResidentInfo>();//初始化where表达式 //小区名字 if (statisticsViewModel.Name != null) { predicate = predicate.And(p => p.InfoRelationShips.HouseInfo.Area.Equals(statisticsViewModel.Name)); } //性别 if (statisticsViewModel.Gender != null) { predicate = predicate.And(p => p.Gender.Equals(statisticsViewModel.Gender)); } //起始年龄 if (statisticsViewModel.StartAge != 0) { predicate = predicate.And(p => Convert.ToInt32(DateTime.Now.Year.ToString()) - Convert.ToInt32(p.IdNumber.Substring(6, 4)) > (statisticsViewModel.StartAge)); } //结束年龄 if (statisticsViewModel.EndAge != 0) { predicate = predicate.And(p => Convert.ToInt32(DateTime.Now.Year.ToString()) - Convert.ToInt32(p.IdNumber.Substring(6, 4)) <= (statisticsViewModel.EndAge)); } return(predicate); }
//根据条件查询报修 private Expression <Func <Flow_Node, bool> > SearchByRepairWhere(FlowNodeByRepairIdSearchViewModel flowNodeByRepairIdSearchViewModel) { var predicate = WhereExtension.True <Flow_Node>();//初始化where表达式 predicate = predicate.And(p => p.Repair_InfoId == flowNodeByRepairIdSearchViewModel.Repair_InfoId); return(predicate); }
public Expression <Func <Except_Info_Employ, bool> > GetByModelWhere(ExceptEmploySearchViewModel exceptEmploySearchViewModel) { var predicate = WhereExtension.True <Except_Info_Employ>();//初始化where表达式SchoolName //姓 if (!exceptEmploySearchViewModel.SchoolCode.Equals("")) { predicate = predicate.And(p => p.facultystaff_Info.SchoolCode.Contains(exceptEmploySearchViewModel.SchoolCode)); } if (!exceptEmploySearchViewModel.DepartCode.Equals("")) { predicate = predicate.And(p => p.facultystaff_Info.DepartCode.Contains(exceptEmploySearchViewModel.DepartCode)); } if (!exceptEmploySearchViewModel.StaffCode.Equals("")) { predicate = predicate.And(p => p.facultystaff_Info.StaffCode.Contains(exceptEmploySearchViewModel.StaffCode)); } if (!exceptEmploySearchViewModel.CreateDate.Equals("")) { predicate = predicate.And(p => p.CreateDate.ToString().Contains(exceptEmploySearchViewModel.CreateDate)); } if (!exceptEmploySearchViewModel.Name.Equals("")) { predicate = predicate.And(p => p.Name.Contains(exceptEmploySearchViewModel.Name)); } if (!exceptEmploySearchViewModel.Temperature.Equals("")) { predicate = predicate.And(p => p.Temperature.Contains(exceptEmploySearchViewModel.Temperature)); } return(predicate); }
public bool GetByParas(string uid, string OndutyClaims_InfoId, DateTime?StartDutyTime, DateTime?EndDutyTime) { var predicate = WhereExtension.True <MydutyClaim_Info>();//初始化where表达式 if (!string.IsNullOrEmpty(uid)) { predicate = predicate.And(p => p.Userid.Equals(uid)); } if (!string.IsNullOrEmpty(OndutyClaims_InfoId)) { predicate = predicate.And(p => p.OndutyClaims_InfoId.Equals(OndutyClaims_InfoId)); } predicate = predicate.And(p => p.StartDutyTime.Equals(StartDutyTime)); predicate = predicate.And(p => p.EndDutyTime.Equals(EndDutyTime)); var result = DbSet.Where(predicate).OrderBy(a => a.CreateDate).ToList(); if (result.Count > 0) { return(true); } else { return(false); } }
public List <Student_DayandNight_Info> CheckDayAndNightList(string IdNumber, string GradeName, string IsComeSchool, string Name, string SchoolName, string Temperature, string AddTimeInterval, string AddCreateDate) { //查询条件 var predicate = WhereExtension.True <Student_DayandNight_Info>();//初始化where表达式 predicate = predicate.And(p => p.IdNumber.Contains(IdNumber)); predicate = predicate.And(p => p.GradeName.Contains(GradeName)); predicate = predicate.And(p => p.Name.Contains(Name)); predicate = predicate.And(p => p.SchoolName.Contains(SchoolName)); predicate = predicate.And(p => p.AddTimeInterval.Contains(AddTimeInterval)); if (AddCreateDate != null && !AddCreateDate.Equals("")) { predicate = predicate.And(p => p.AddCreateDate >= Convert.ToDateTime(Convert.ToDateTime(AddCreateDate).ToString("yyyy-MM-dd 00:00:00")) && p.AddCreateDate <= Convert.ToDateTime(Convert.ToDateTime(AddCreateDate).ToString("yyyy-MM-dd 23:59:59"))); } var result = Db.Student_DayandNight_Info.Where(predicate).ToList(); if (result.Count > 0) { return(result); } else { return(null); } }
public Expression <Func <Student_DayandNight_Info, bool> > GetByModelChildWhereYEY(String ClassName) { var predicate = WhereExtension.True <Student_DayandNight_Info>();//初始化where表达式SchoolName predicate = predicate.And(p => p.ClassName == ClassName); return(predicate); }
//根据条件活动 private Expression <Func <Activity, bool> > SearchActivityWhere(ActivitySearchViewModel activitySearchViewModel) { var predicate = WhereExtension.True <Activity>();//初始化where表达式 //predicate = predicate.And(p => p.Name.ToString().Contains(buildingSearchViewModel.Name.ToString())); if (activitySearchViewModel.Title != "") { predicate = predicate.And(p => p.Title.Contains(activitySearchViewModel.Title)); } if (activitySearchViewModel.StartTime != null) { predicate = predicate.And(p => activitySearchViewModel.StartTime < p.StartTime); } if (activitySearchViewModel.EndTime != null) { predicate = predicate.And(p => p.StartTime < activitySearchViewModel.EndTime); } if (activitySearchViewModel.Recorder != "") { predicate = predicate.And(p => p.Recorder.Contains(activitySearchViewModel.Recorder)); } //predicate = predicate.And(p => p.ConstructionTime.ToString().c); predicate = predicate.And(p => p.Status == "1"); return(predicate); }
public LoginType_Log SearchByUIDModel(SearchByVIDModel user) { var res = new LoginType_Log(); //查询条件 var predicate = WhereExtension.True <LoginType_Log>();//初始化where表达式 //status='true' 为有效登录方式信息 predicate = predicate.And(p => p.status.Contains("true")); if (!String.IsNullOrEmpty(user.VID)) { predicate = predicate.And(p => p.uid.Contains(user.VID)); } var result = DbSet.Where(predicate).OrderByDescending(p => p.CreateDate).ToList(); if (result.Count != 0) { res = result.First(); } else { res = null; } return(res); }
//志愿者互助信息退出功能 (互助ID标识ContentID、志愿者唯一VID、擅长技能TypeID为空不传参数) public string SetStatusBack(string VID, string ContentID) { string status = string.Empty; VHA_Sign res = new VHA_Sign(); //查询条件 var predicate = WhereExtension.True <VHA_Sign>();//初始化where表达式 if (!String.IsNullOrEmpty(VID)) { predicate = predicate.And(p => p.VID.Equals(VID)); } if (!String.IsNullOrEmpty(ContentID)) { predicate = predicate.And(p => p.ContentID.Equals(ContentID)); } var result = DbSet.Where(predicate).OrderByDescending(o => o.CreateDate).ToList(); if (result.Count > 0) { res = result.First(); res.Status = "3"; Update(res); int a = SaveChanges(); if (a > 0) { status = "success"; } else { status = "fail"; } } return(status); }
//根据条件查小区 #region 查询条件 private Expression <Func <ResidentialArea, bool> > SearchAreaWhere(AreaSearchViewModel areaSearchViewModel) { var predicate = WhereExtension.True <ResidentialArea>();//初始化where表达式 if (areaSearchViewModel.Id != null) { predicate = predicate.And(p => p.Id.Equals(areaSearchViewModel.Id)); } if (areaSearchViewModel.Name != "") { predicate = predicate.And(p => p.Name.ToString().Contains(areaSearchViewModel.Name.ToString())); } if (areaSearchViewModel.Developers != "") { predicate = predicate.And(p => p.Developers.Contains(areaSearchViewModel.Developers)); } if (areaSearchViewModel.ConstructionTimeStart != null) { predicate = predicate.And(p => p.ConstructionTime > (areaSearchViewModel.ConstructionTimeStart)); } if (areaSearchViewModel.ConstructionTimeEnd != null) { predicate = predicate.And(p => p.ConstructionTime < (areaSearchViewModel.ConstructionTimeEnd)); } predicate = predicate.And(p => p.Status == "1"); return(predicate); }
//根据条件查询班车 private Expression <Func <Bus_Payment, bool> > BusUserTongJiExcept_SearchWhere(BusPaymentSearchViewModel busPaymentSearchViewModel) { var predicate = WhereExtension.True <Bus_Payment>();//初始化where表达式 if (busPaymentSearchViewModel.Bus_LineId != null) { predicate = predicate.And(a => a.Bus_LineId == busPaymentSearchViewModel.Bus_LineId); } // predicate = predicate.And(a => a.Bus_Payment_OrderId!=null); if (busPaymentSearchViewModel.User_DepartId != null) { predicate = predicate.And(a => a.User_DepartId == busPaymentSearchViewModel.User_DepartId); } predicate = predicate.And(a => a.Bus_Payment_Order.orderNo.Contains(busPaymentSearchViewModel.orderNo)); predicate = predicate.And(a => a.status == "0"); predicate = predicate.And(a => a.UserName.Contains(busPaymentSearchViewModel.UserName)); if (busPaymentSearchViewModel.carDate != null) { predicate = predicate.And(a => a.carDate.Value.Year == busPaymentSearchViewModel.carDate.Value.Year && a.carDate.Value.Month == busPaymentSearchViewModel.carDate.Value.Month); } predicate = predicate.And(a => a.Code != null); return(predicate); }
public User_Info GetByIdnumber(string idnumber) { var res = new User_Info(); //查询条件 var predicate = WhereExtension.True <User_Info>();//初始化where表达式 //Console.WriteLine("aaaaaaaa" + idnumber);这什么玩意 if (!String.IsNullOrEmpty(idnumber)) { predicate = predicate.And(p => Dtol.Helper.MD5.Decrypt(p.Idnumber).Equals(idnumber)); } var result = DbSet.Where(predicate).ToList(); if (result.Count > 0) { res = result.First(); } else { res = null; } return(res); }
//根据条件查询班车 private Expression <Func <Bus_Payment, bool> > SearchBusUser2Where(BusUserSearch2ViewModel busUserSearch2ViewModel) { var predicate = WhereExtension.True <Bus_Payment>();//初始化where表达式 predicate = predicate.And(a => a.Bus_Payment_Order.orderNo.Contains(busUserSearch2ViewModel.orderNo)); predicate = predicate.And(a => a.UserName.Contains(busUserSearch2ViewModel.UserName)); predicate = predicate.And(a => a.Name.Contains(busUserSearch2ViewModel.User_DepartName)); if (busUserSearch2ViewModel.Bus_LineId != null) { predicate = predicate.And(a => a.Bus_LineId == busUserSearch2ViewModel.Bus_LineId); } if (busUserSearch2ViewModel.User_DepartId != null) { predicate = predicate.And(a => a.User_DepartId == busUserSearch2ViewModel.User_DepartId); } // predicate = predicate.And(a => a.LineName.Contains(busUserSearch2ViewModel.Bus_LineName)); predicate = predicate.And(a => a.status == (busUserSearch2ViewModel.status)); if (busUserSearch2ViewModel.Expense != "") { predicate = predicate.And(a => a.Expense == (busUserSearch2ViewModel.Expense)); } if (busUserSearch2ViewModel.carDate != null) { predicate = predicate.And(a => a.carDate.Value.Year == busUserSearch2ViewModel.carDate.Value.Year && a.carDate.Value.Month == busUserSearch2ViewModel.carDate.Value.Month); } predicate = predicate.And(a => a.Code != null); return(predicate); }
//根据条件查询报修 private Expression <Func <Flow_Node, bool> > SearchNodeWhere(FlowNodeSearchViewModel flowNodeSearchViewModel) { var predicate = WhereExtension.True <Flow_Node>();//初始化where表达式 predicate = predicate.And(p => p.status.Contains(flowNodeSearchViewModel.status)); if (flowNodeSearchViewModel.Flow_ProcedureId != null) { predicate = predicate.And(p => p.Flow_ProcedureId == flowNodeSearchViewModel.Flow_ProcedureId); } if (flowNodeSearchViewModel.Repair_InfoId != null) { predicate = predicate.And(p => p.Repair_InfoId == flowNodeSearchViewModel.Repair_InfoId); } predicate = predicate.And(p => p.operate.Contains(flowNodeSearchViewModel.operate)); if (flowNodeSearchViewModel.User_InfoId != null) { predicate = predicate.And(p => p.User_InfoId == flowNodeSearchViewModel.User_InfoId); } if (flowNodeSearchViewModel.isHandler != null) { predicate = predicate.And(p => p.Repair_Info.isHandler == flowNodeSearchViewModel.isHandler); } return(predicate); }
//根据条件查询部门 private Expression <Func <Food_Info, bool> > SearchFoodWhere(FoodInfoSearchViewModel foodInfoSearchViewModel) { var predicate = WhereExtension.True <Food_Info>();//初始化where表达式 predicate = predicate.And(p => p.Price.ToString().Contains(foodInfoSearchViewModel.Price.ToString())); predicate = predicate.And(p => p.FoodName.Contains(foodInfoSearchViewModel.FoodName)); predicate = predicate.And(p => p.FoodType.Contains(foodInfoSearchViewModel.FoodType)); predicate = predicate.And(p => p.Remark.Contains(foodInfoSearchViewModel.Remark)); if (foodInfoSearchViewModel.flag == "0")//手机,默认查询当前周 { System.Globalization.GregorianCalendar gc = new System.Globalization.GregorianCalendar(); int weekOfYear = gc.GetWeekOfYear(DateTime.Now, System.Globalization.CalendarWeekRule.FirstDay, DayOfWeek.Monday); predicate = predicate.And(p => p.WeekNumber == weekOfYear.ToString()); //默认当前周 predicate = predicate.And(p => p.Year == DateTime.Now.Year.ToString()); //默认当前年 } else//PC查询任意周 { if (foodInfoSearchViewModel.flag != "") { predicate = predicate.And(p => p.WeekNumber == foodInfoSearchViewModel.flag); } predicate = predicate.And(p => p.Year.Contains(foodInfoSearchViewModel.Year)); } predicate = predicate.And(p => p.isDelete == "0"); return(predicate); }
private Expression <Func <ResidentInfo, bool> > SearchPartResidentWhere(PartyResidentSearchViewModel partyResidentSearchViewModel) { var predicate = WhereExtension.True <ResidentInfo>();//初始化where表达式 if (partyResidentSearchViewModel.IdentityName != "") { predicate = predicate.And(p => p.Politics.Equals(partyResidentSearchViewModel.IdentityName)); } if (partyResidentSearchViewModel.Area != "") { predicate = predicate.And(p => p.InfoRelationShips.HouseInfo.Area.Equals(partyResidentSearchViewModel.Area)); } if (partyResidentSearchViewModel.Name != "") { predicate = predicate.And(p => p.Name.Equals(partyResidentSearchViewModel.Name)); } //根据出生年月范围查询 if (partyResidentSearchViewModel.StartTime != null) { predicate = predicate.And(p => DateTime.ParseExact(p.IdNumber.Substring(6, 8), "yyyyMMdd", System.Globalization.CultureInfo.CurrentCulture) >= partyResidentSearchViewModel.StartTime); } if (partyResidentSearchViewModel.EndTime != null) { predicate = predicate.And(p => DateTime.ParseExact(p.IdNumber.Substring(6, 8), "yyyyMMdd", System.Globalization.CultureInfo.CurrentCulture) <= partyResidentSearchViewModel.EndTime); } predicate = predicate.And(p => p.Status == "1"); return(predicate); }
private Expression <Func <StudentRegisterHeath_Info, bool> > SearchLineWhere(HealthInfoSearchViewModel healthInfoSearchViewModel) { var aa = DateTime.Now; var aaaaaaa = aa.ToString(); var predicate = WhereExtension.True <StudentRegisterHeath_Info>();//初始化where表达式 predicate = predicate.And(p => p.Idnumber.Trim().Contains(healthInfoSearchViewModel.Idnumber.Trim() == ""?"":Dtol.Helper.MD5.Md5Hash(healthInfoSearchViewModel.Idnumber.Trim()))); predicate = predicate.And(p => p.IsleaveJin.Contains(healthInfoSearchViewModel.IsleaveJin)); predicate = predicate.And(p => p.IsPassHubei.Contains(healthInfoSearchViewModel.IsPassHubei)); predicate = predicate.And(p => p.PassHubeiDetail.Contains(healthInfoSearchViewModel.IsPassHubei)); predicate = predicate.And(p => p.Peers.Contains(healthInfoSearchViewModel.IsPassHubei)); predicate = predicate.And(p => p.PeersTelephone.Contains(healthInfoSearchViewModel.IsPassHubei)); predicate = predicate.And(p => p.Residencetemporary.Contains(healthInfoSearchViewModel.IsPassHubei)); predicate = predicate.And(p => p.Telephone.Contains(healthInfoSearchViewModel.Telephone)); predicate = predicate.And(p => p.Temperature.Contains(healthInfoSearchViewModel.Temperature)); predicate = predicate.And(p => p.Traffic.Contains(healthInfoSearchViewModel.Traffic)); predicate = predicate.And(p => p.BackJinDate.ToString().Contains(healthInfoSearchViewModel.BackJinDate == null? "": healthInfoSearchViewModel.BackJinDate.Value.ToString("yyyy-MM-dd"))); predicate = predicate.And(p => p.BeforeTianjin.Contains(healthInfoSearchViewModel.Traffic)); predicate = predicate.And(p => p.Guardian.Contains(healthInfoSearchViewModel.Guardian)); predicate = predicate.And(p => p.Destination.Contains(healthInfoSearchViewModel.Destination)); predicate = predicate.And(p => p.ForteenDaysExcepting.Contains(healthInfoSearchViewModel.ForteenDaysExcepting)); predicate = predicate.And(p => p.CreateDate.ToString().Contains(healthInfoSearchViewModel.CreateDate == null ? "" : healthInfoSearchViewModel.CreateDate.Value.ToString("yyyy-MM-dd"))); // predicate = predicate.And(p => p.Id==lineSearchViewModel.Id); return(predicate); }
public string getToken() { string token = ""; var predicate = WhereExtension.True <V_GetToken>(); var result = DbSet.Where(predicate) .OrderByDescending(o => o.addtime).ToList(); if (result.Count != 0) { token = result.First().token; DateTime time = result.First().addtime; //token 有效期为2小时,超过2小时 token过期,返回值为空 if (DateTime.Now >= time.AddHours(2)) { token = string.Empty; } } else { token = string.Empty; } return(token); }
//根据条件查询菜单评价信息 private Expression <Func <User_Relate_Food, bool> > SearchFoodCPWhere(FoodByUserSearchCpViewModel foodByUserSearchCpViewModel) { var predicate = WhereExtension.True <User_Relate_Food>();//初始化where表达式 if (foodByUserSearchCpViewModel.User_InfoId != null) { predicate = predicate.And(p => p.User_InfoId == foodByUserSearchCpViewModel.User_InfoId.Value); } if (foodByUserSearchCpViewModel.Food_InfoId != null) { predicate = predicate.And(p => p.Food_InfoId == foodByUserSearchCpViewModel.Food_InfoId.Value); } predicate = predicate.And(p => p.status == foodByUserSearchCpViewModel.status); predicate = predicate.And(p => p.User_Info.status == "0"); predicate = predicate.And(p => p.Food_Info.isDelete == "0"); if (foodByUserSearchCpViewModel.WeekNumber != "") { predicate = predicate.And(p => p.Food_Info.WeekNumber == foodByUserSearchCpViewModel.WeekNumber); } predicate = predicate.And(p => p.Food_Info.Year.Contains(foodByUserSearchCpViewModel.Year)); predicate = predicate.And(p => p.Food_Info.Remark.Contains(foodByUserSearchCpViewModel.Remark)); return(predicate); }
//根据条件查询用户 private Expression <Func <VHelpArea, bool> > SearchVAWhere(VHelpAreaSearchViewModel VSearchViewModel) { var predicate = WhereExtension.True <VHelpArea>();//初始化where表达式 // 不显示 已删除的信息 status=3 20191111 ,不显示 居民发布未审核的信息 status=9;审核不通过信息 status=8 (20191120) predicate = predicate.And(p => !p.Status.Equals("3")); predicate = predicate.And(p => !p.Status.Equals("9")); predicate = predicate.And(p => !p.Status.Equals("8")); if (!String.IsNullOrEmpty(VSearchViewModel.ID)) { predicate = predicate.And(p => p.ID.Contains(VSearchViewModel.ID)); } if (!String.IsNullOrEmpty(VSearchViewModel.Title)) { predicate = predicate.And(p => p.Title.Contains(VSearchViewModel.Title)); } if (!String.IsNullOrEmpty(VSearchViewModel.CommunityID)) { predicate = predicate.And(p => p.CommunityID.Contains(VSearchViewModel.CommunityID)); } if (!String.IsNullOrEmpty(VSearchViewModel.Address)) { predicate = predicate.And(p => p.Address.Contains(VSearchViewModel.Address)); } if (!String.IsNullOrEmpty(VSearchViewModel.TypeID)) { predicate = predicate.And(p => p.TypeID.Contains(VSearchViewModel.TypeID)); } return(predicate); }
public Volunteer_Info SearchInfoByID(string id) { var res = new Volunteer_Info(); //查询条件 var predicate = WhereExtension.True <Volunteer_Info>();//初始化where表达式 predicate = predicate.And(p => !p.Status.Equals("4")); if (!String.IsNullOrEmpty(id)) { predicate = predicate.And(p => p.ID.Contains(id)); } var result = DbSet.Where(predicate).ToList(); if (result.Count != 0) { res = result.First(); } else { res = null; } return(res); }
private Expression <Func <Volunteer_Info, bool> > SearchVolunteerForBGWhere(VolunteerInfoSearchViewModel VSearchViewModel) { var predicate = WhereExtension.True <Volunteer_Info>();//初始化where表达式 if (VSearchViewModel.VNO != "") { predicate = predicate.And(p => p.VNO.Equals(VSearchViewModel.VNO)); } if (VSearchViewModel.Name != "") { predicate = predicate.And(p => p.Name.Contains(VSearchViewModel.Name)); } if (VSearchViewModel.CommunityID != "") { predicate = predicate.And(p => p.CommunityID.Equals(VSearchViewModel.CommunityID)); } if (VSearchViewModel.Gender != "") { predicate = predicate.And(p => p.Gender.Contains(VSearchViewModel.Gender)); } if (VSearchViewModel.Political != "") { predicate = predicate.And(p => p.Political.Contains(VSearchViewModel.Political)); } return(predicate); }
//根据条件查询部门 private Expression <Func <Flow_Relate_NodeRole, bool> > SearchDelRelateWhere(RelateRoleByNodeDelModelcs relateRoleByNodeDelModelcs) { var predicate = WhereExtension.True <Flow_Relate_NodeRole>();//初始化where表达式 predicate = predicate.And(p => p.Flow_NodeDefineId == relateRoleByNodeDelModelcs.Flow_NodeDefineId); predicate = predicate.And(p => p.User_RoleId == relateRoleByNodeDelModelcs.User_RoleId); return(predicate); }
private Expression <Func <City, bool> > SearchAllCityWhere() { var predicate = WhereExtension.True <City>();//初始化where表达式 predicate = predicate.And(p => p.FormId == null); return(predicate); }
private Expression <Func <City, bool> > SearchCityWhere(Guid FormId) { var predicate = WhereExtension.True <City>();//初始化where表达式 predicate = predicate.And(p => p.FormId.Equals(FormId)); return(predicate); }