private ZhaoPinViewModel GetZhaoPins() { Paging page = InitPage(20); ZhaoPinViewModel model = ZhaoPinBLL.Instance.FindAll(page); return(model); }
public ActionResult Select(string search_jobTrade, string search_job, string search_companyName, string search_workPlace, string search_money, string search_study, string search_worktype) { ResultInfo ri = new ResultInfo(); Paging page = InitPage(20); ZhaoPinViewModel model = ZhaoPinBLL.Instance.SelectByCondition(page, search_jobTrade, search_job, search_companyName, search_workPlace, search_money, search_study, search_worktype); return(PartialView("_Search", model)); }
/// <summary> /// 分页查询 /// </summary> /// <param name="page"></param> /// <returns></returns> public ZhaoPinViewModel FindAll(Paging page, string key = null) { ZhaoPinViewModel model = new ZhaoPinViewModel(); var ds = dal.SearchByRows(page.StartIndex, page.EndIndex, key); int count = Convert.ToInt32(ds.Tables[0].Rows[0][0]); page.RecordCount = count; model.ZhaoPinList = ModelConvertHelper <_ZhaoPin> .ConvertToList(ds.Tables[1]); model.ZhaoPinPage = page; return(model); }
public ActionResult Search(string key) { ResultInfo ri = new ResultInfo(); if (key.IsNotNullOrEmpty()) { Paging page = InitPage(20); ZhaoPinViewModel model = ZhaoPinBLL.Instance.FindAll(page, key); return(PartialView("_Search", model)); } else { ri.Msg = "请输入关键词"; } return(Result(ri)); }
public ZhaoPinViewModel SelectByCondition(Paging page, string search_jobTrade, string search_job, string search_companyName, string search_workPlace, string search_money, string search_study, string search_worktype) { StringBuilder sb = new StringBuilder(); if (IsSafe(search_jobTrade)) { sb.Append(@" and a.BelongJobTrade='{0}' ".FormatWith(search_jobTrade)); } if (IsSafe(search_job)) { sb.Append(" and a.BelongJob = '{0}' ".FormatWith(search_job)); } if (IsSafe(search_companyName)) { sb.Append(" and a.CName like '%{0}%' ".FormatWith(search_companyName)); } if (IsSafe(search_workPlace)) { search_workPlace = search_workPlace.IndexOf("市") > -1 ? search_workPlace.Replace("市", string.Empty) : search_workPlace; sb.Append(" and a.WorkPlace like '%{0}%'".FormatWith(search_workPlace)); } if (IsSafe(search_money) && MatchHelper.IsNum.IsMatch(search_money)) { sb.Append(" and a.[Money]={0}".FormatWith(search_money)); } if (IsSafe(search_study) && MatchHelper.IsNum.IsMatch(search_study)) { sb.Append(" and a.Study={0}".FormatWith(search_study)); } if (IsSafe(search_worktype) && MatchHelper.IsNum.IsMatch(search_worktype)) { sb.Append(" and a.WorkeType={0}".FormatWith(search_worktype)); } var model = new ZhaoPinViewModel(); var ds = dal.SelectByCondition(page.StartIndex, page.EndIndex, sb.ToString()); int count = Convert.ToInt32(ds.Tables[0].Rows[0][0]); page.RecordCount = count; model.ZhaoPinList = ModelConvertHelper <_ZhaoPin> .ConvertToList(ds.Tables[1]); model.ZhaoPinPage = page; return(model); }