public IQueryable <List> ReadListForCustomer(Core.Models.SiteCatalog.UserSelectedContext catalogInfo, bool headerOnly) { if (headerOnly) { return(this.Entities.Include(t => t.Shares).Where(l => (l.CustomerId.Equals(catalogInfo.CustomerId) && l.BranchId.Equals(catalogInfo.BranchId, StringComparison.InvariantCultureIgnoreCase)) || (l.Shares.Any(s => s.CustomerId.Equals(catalogInfo.CustomerId) && s.BranchId.Equals(catalogInfo.BranchId, StringComparison.InvariantCultureIgnoreCase))))); } else { return(this.Entities.Include(i => i.Items).Include(t => t.Shares).Where(l => (l.CustomerId.Equals(catalogInfo.CustomerId) && l.BranchId.Equals(catalogInfo.BranchId, StringComparison.InvariantCultureIgnoreCase)) || (l.Shares.Any(s => s.CustomerId.Equals(catalogInfo.CustomerId) && s.BranchId.Equals(catalogInfo.BranchId, StringComparison.InvariantCultureIgnoreCase))))); } }
public void AddCustomerToUser(string userName, Core.Models.SiteCatalog.UserSelectedContext customer) { SqlCommand cmd = new SqlCommand("usp_Entree_Add_kbit_UserId_Customer", _con); cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@UserId", userName); cmd.Parameters.AddWithValue("@Division", customer.BranchId); cmd.Parameters.AddWithValue("@CustomerNbr", customer.CustomerId); _con.Open(); cmd.ExecuteNonQuery(); _con.Close(); }
public string ReadLatestOrderDate(Core.Models.SiteCatalog.UserSelectedContext catalogInfo) { return(this.Entities.Where(o => o.CustomerNumber.Equals(catalogInfo.CustomerId, StringComparison.InvariantCultureIgnoreCase) && o.BranchId.Equals(catalogInfo.BranchId, StringComparison.InvariantCultureIgnoreCase)).Select(m => m.ModifiedUtc).DefaultIfEmpty().Max().ToLongDateFormatWithTime()); }