public static List <XLMain.EntityCouplet> StaffList(XLMain.Staff user, XLMain.Client client, Boolean incSec, Boolean incML = false, List <XLMain.EntityCouplet> userList = null) { //create list List <XLMain.EntityCouplet> users = new List <XLMain.EntityCouplet>(); //check whether we have been given a list if (userList == null) { //populate it with everyone userList = XLMain.Staff.AllStaff(); } users = userList; //assign list to temporary list for further adjustment int i = 0; //place current and connected users at the top of the list if (user != null) { users.Insert(i, new XLMain.EntityCouplet(user.crmID, user.name)); i++; } if (client != null) { if (client.partner != null) { users.Insert(i, new XLMain.EntityCouplet(client.partner.crmID, client.partner.name)); i++; } if (client.manager != null) { users.Insert(i, new XLMain.EntityCouplet(client.manager.crmID, client.manager.name)); i++; } List <XLMain.Staff> conStaff = XLMain.Staff.connectedStaff(client.crmID); if (conStaff != null) { foreach (XLMain.Staff staff in conStaff) { users.Insert(i, new XLMain.EntityCouplet(staff.crmID, staff.name)); i++; } } //add secretarial if (incSec) { XLMain.EntityCouplet secretarial = new XLMain.EntityCouplet(); secretarial.name = "Secretarial - " + client.manager.office; users.Insert(i, secretarial); i++; } } //add ML if (incML) { XLMain.EntityCouplet mL = new XLMain.EntityCouplet(); mL.name = "Milsted Langdon LLP"; users.Insert(i, mL); i++; } List <XLMain.EntityCouplet> dedupedList = users.GroupBy(p => p.crmID).Select(g => g.First()).ToList(); return(dedupedList); }
public static void Clear(this XLMain.EntityCouplet eC) { eC.crmID = ""; eC.name = ""; }