/// <summary> /// 数量 /// </summary> /// <param name="entity"></param> /// <returns></returns> public static int GetCustomerCount(SearchTmp entity) { var where = new Where <Customer>(); where.And(Customer._.BelongUser == entity.UserName); if (entity.MediaSource.Count > 0) { where.And(Customer._.MediaSource.In(entity.MediaSource)); } if (entity.CallBackStatus.Count > 0) { where.And(Customer._.CallBackStatus.In(entity.CallBackStatus)); } where.And(Customer._.ConsultantDate >= Convert.ToDateTime(entity.ConsultantDate[0])); where.And(Customer._.ConsultantDate <= Convert.ToDateTime(entity.ConsultantDate[1])); return(DB.Context.From <Customer>().Where(where).ToList().Count); }
/// <summary> /// GetCustomerLst /// </summary> /// <param name="entity"></param> /// <returns></returns> public static List <TmpCustomer> GetCustomerLst(SearchTmp entity) { var where = new Where <Customer>(); where.And(Customer._.BelongUser == entity.UserName); if (entity.MediaSource.Count > 0) { where.And(Customer._.MediaSource.In(entity.MediaSource)); } if (entity.CallBackStatus.Count > 0) { where.And(Customer._.CallBackStatus.In(entity.CallBackStatus)); } where.And(Customer._.ConsultantDate >= Convert.ToDateTime(entity.ConsultantDate[0])); where.And(Customer._.ConsultantDate <= Convert.ToDateTime(entity.ConsultantDate[1])); var tmpLst = DB.Context.From <Customer>() .Where(where) .OrderBy(Customer._.ConsultantDate.Desc) .Page(entity.PageSize, entity.CurrentPage) .ToList(); List <TmpCustomer> tmpCustomerLst = new List <TmpCustomer>(); if (tmpLst.Count > 0) { tmpCustomerLst.AddRange(tmpLst.Select(d => new TmpCustomer { Id = d.Id, CustomerName = d.CustomerName, Sex = d.Sex == "male" ? "男" : "女", CellPhone = d.CellPhone, QQ = d.QQ, BelongType = DegreeFormHeler.GetDreeFormName(d.ConsultantDegreeType.ToString()), CollegeNo = CollegeHelper.GetCollegeName(d.CollegeNo.ToString()), LevelNo = d.LevelNo == 1 ? "高起专" : "专升本", MajorNo = majorHelper.GetMajorName(d.MajorNo.ToString()), ConsultantDetail = d.ConsultantDetail, ConsultantDate = Convert.ToDateTime(d.ConsultantDate).ToString("yyyy-MM-dd"), CallBackStatus = CallBackStatusHelper.GetStatusName(d.CallBackStatus.ToString()), CustomeStatus = d.CustomeStatus == true ? "有效" : "无效", MediaSource = SecondLevelHelper.GetLevelItem(d.MediaSource.ConvertTo <int>()).ItemName, IsExpress = d.IsExpress == true ? "1" : "0" })); } return(tmpCustomerLst); }