public static List<Organisation> ListOrganisation(Guid? roleId) { DataLayer dataLayer = new DataLayer(); List<Organisation> result = dataLayer.ListOrganisation(); if (roleId.HasValue) { foreach (Organisation org in result) { org.ContactInformation = dataLayer.ListContactInformation(org.ContactInformationId).FirstOrDefault(); org.OrgAdminUsers = dataLayer.ListUserRoleAuth(org.OrganisationId, null, roleId.Value); } } return result; }
public static List<Site> ListSiteBySiteGroup(int? siteGroupId, bool? showLegacy, bool loadContact) { DataLayer dataLayer = new DataLayer(); List<Site> result = dataLayer.ListSiteBySiteGroup(siteGroupId, showLegacy); if (loadContact) { foreach (Site site in result) { if (site.ContactInformationID > 0) { List<ContactInformation> contacts = dataLayer.ListContactInformation(site.ContactInformationID); if (contacts.Count > 0) { site.ContactInformation = contacts[0]; } } } } return result; }
public static List<Customer> ListCustomer(int? orgId, int? customerId, string firstName, string lastName, int? siteId, bool hasContracts, DateTime? contractDateStart, DateTime? contractDateEnd, bool includeLegacy) { DataLayer dl = new DataLayer(); List<Customer> result = dl.ListCustomer(orgId, customerId, firstName, lastName, siteId, hasContracts, contractDateStart, contractDateEnd, includeLegacy); if (result != null) { foreach (Customer cus in result) { cus.ContactInformation = dl.ListContactInformation(cus.ContactInformationId).FirstOrDefault(); } } return result; }