/// <summary> /// Load a channelCustomer from the database given its Id. /// </summary> /// <param name="channelId">The channelCustomer identifier</param> /// <returns></returns> public ChannelCustomerSet LoadChannelCustomerByChannelId(int channelId) { var metaData = new LinqMetaData(); var channelCustomer = metaData.ChannelCustomer.Where(e => e.ChannelId == channelId); var customerCollection = ((ILLBLGenProQuery)channelCustomer).Execute <ChannelCustomerCollection>(); var channelCustomerSet = new ChannelCustomerSet(); // Fill the entity set from the data collection if (customerCollection.Count > 0) { foreach (var customerEntity in customerCollection) { var customer = new ChannelCustomer(customerEntity); channelCustomerSet.Add(customer); } } // Return the entity set return(channelCustomerSet); }
/// <summary> /// Load all channelCustomers from the database. /// </summary> /// <returns></returns> private ChannelCustomerSet LoadChannelCustomerSet() { var channelCustomerSet = new ChannelCustomerSet(); // Get the collection from the ORM data layer var metaData = new LinqMetaData(); IQueryable <ChannelCustomerEntity> channelCustomers = from c in metaData.ChannelCustomer select c; var channelCustomerCollection = ((ILLBLGenProQuery)channelCustomers).Execute <ChannelCustomerCollection>(); // Fill the entity set from the data collection if (channelCustomerCollection.Count > 0) { foreach (var channelCustomerEntity in channelCustomerCollection) { var channelCustomer = new ChannelCustomer(channelCustomerEntity); channelCustomerSet.Add(channelCustomer); } } // Return the entity set return(channelCustomerSet); }