/// <summary> /// Customer 格式化 /// </summary> /// <param name="userName"></param> /// <param name="currentPage"></param> /// <param name="pageSize"></param> /// <returns></returns> public static List <TmpCustomer> GetCustomerLst(string userName, int currentPage, int pageSize) { var tmpLst = DB.Context.From <Customer>().Where(Customer._.BelongUser == userName && Customer._.CallBackStatus.NotIn(5)) .OrderBy(Customer._.CreateDate.Desc) .Page(pageSize, 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); }
public static bool FillDegrees(dynamic obj, int userID) { if (obj.education == null) return false; var degrees = GetDegreesByUser(userID); bool imported = false; foreach (dynamic edu in obj.education) { //check if the edu record is already in if (edu.concentration != null && !degrees.Any( p => p.College.FormalName.Equals(edu.school.name.ToString(), StringComparison.InvariantCultureIgnoreCase) && p.MajorType.Name.Equals(edu.concentration[0].name.ToString(), StringComparison.InvariantCultureIgnoreCase))) { if (edu.type == "College") { var degree = new Degree { CollegeID = CollegeHelper.GetCreateCollege(edu.school.name.ToString()).ID, MajorTypeID = CollegeHelper.GetCreateMajorType(edu.concentration[0].name.ToString(), "").ID, // todo handle cases when associate degree DegreeTypeID = (int)GeneralHelper.DegreeType.Bachelor }; if (edu.year != null) { degree.GraduationDate = new DateTime(Convert.ToInt32(edu.year.name.ToString()), 8, 1); } CreateDegree(userID, degree.DegreeTypeID, degree.CollegeID, degree.MajorTypeID, degree.MajorTypeID2, degree.GraduationDate, null, null, null); imported = true; } else if (edu.type == "Graduate School") { var degree = new Degree { CollegeID = CollegeHelper.GetCreateCollege(edu.school.name.ToString()).ID, MajorTypeID = CollegeHelper.GetCreateMajorType(edu.concentration[0].name.ToString(), "").ID }; string degreeType = edu.degree.name.ToString(); degree.DegreeTypeID = CollegeHelper.GetCreateDegreeType(degreeType).ID; if (edu.year != null) { degree.GraduationDate = new DateTime(Convert.ToInt32(edu.year.name.ToString()), 8, 1); } CreateDegree(userID, degree.DegreeTypeID, degree.CollegeID, degree.MajorTypeID, degree.MajorTypeID2, degree.GraduationDate, null, null, null); imported = true; } } } return imported; }