public static string ProjectName(this CompanyRelationship item) { if (item.Project != null) { return(item.Project.Name); } else { return(CH.GetDataById <Project>(item.ProjectID).Name); } }
public static string CopamyName(this CompanyRelationship item) { if (item.Company != null) { return(item.Company.Name); } else { return(CH.GetDataById <Company>(item.CompanyID).Name); } }
public static string CategoryString(this CompanyRelationship item) { //重读,确保读到refernced的category var cs = CH.GetDataById <CompanyRelationship>(item.ID); string result = string.Empty; cs.Categorys.ForEach(c => { if (string.IsNullOrEmpty(result)) { result = c.Name; } else { result += "|" + c.Name; } }); item.CategoryString = result; return(result); }
public static string WhoCallTheCompanyMemberName(this CompanyRelationship item, List <Member> members = null) { var ml = item.WhoCallTheCompanyMember(members); string ms = string.Empty; ml.ForEach(m => { if (ms == string.Empty) { ms += m.Name; } else { ms += "|" + m.Name; } }); return(ms); }
/// <summary> /// 查看当前谁在给这家公司打电话 /// </summary> /// <param name="companyid"></param> /// <param name="projectid"></param> /// <returns></returns> public static List <Member> WhoCallTheCompanyMember(this CompanyRelationship item, List <Member> members) { if (members == null) { members = CH.GetAllData <Member>(m => m.ProjectID == item.ProjectID); } var ms = members.FindAll(m => m.CompanyRelationships.Any(c => c.ID == item.ID)); List <Member> result = new List <Member>(); result.AddRange(ms); //如果公司上没有直接指定,按字头分配查找 if (result.Count == 0) { var project = CH.GetAllData <Project>(p => p.ID == item.ProjectID, "Members").FirstOrDefault(); project.Members.ForEach(m => { if (!string.IsNullOrEmpty(m.Characters)) { var chars = m.Characters.Split('|').ToList(); chars.ForEach(ch => { if ((!string.IsNullOrEmpty(item.Company.Name_CH) && item.Company.Name_CH.StartsWith(ch)) || (!string.IsNullOrEmpty(item.Company.Name_EN) && item.Company.Name_EN.StartsWith(ch.ToUpper()))) { result.Add(m); } }); } }); } return(result); }