public static List <Company> GetCustomers(int supplierID) { List <SqlParameter> parameters = new List <SqlParameter>(); parameters.Add(new SqlParameter("@supplier_id", supplierID)); string where = "where supplier_id = @supplier_id"; EntityList <AllowedStore> permissions = AllowedStore.GetAllowedStores(where, parameters); List <Company> customers = new List <Company>(); foreach (var permission in permissions) { customers.Add(permission.customer_); } return(customers); }
public static AllowedStore GetAllowedStoreByCustomerSupplier(int customerID, int supplierID) { List <SqlParameter> parameters = new List <SqlParameter>(); parameters.Add(new SqlParameter("@customer_id", customerID)); parameters.Add(new SqlParameter("@supplier_id", supplierID)); string where = "where customer_id = @customer_id and supplier_id = @supplier_id"; EntityList <AllowedStore> permissions = AllowedStore.GetAllowedStores(where, parameters); if (permissions.Count > 0) { return(permissions[0]); } else { return(null); } }