public static void UpdateOrAddedUrl(string url, EightHundredBaseContext context, int configId) { var listofurls = context.tbl_HVAC_ConfigLogoUrl.Where(item => item.ConfigID == configId).ToList(); if (listofurls.Count != 0) { var urlTemp = listofurls.First(); urlTemp.Logourl = url; } else { var urlTemp = new tbl_HVAC_ConfigLogoUrl { ConfigID = configId, Logourl = url }; context.tbl_HVAC_ConfigLogoUrl.AddObject(urlTemp); } }
private static IQueryable <CustomerInformation> GetCustomers(EightHundredBaseContext dbContext, int[] searchFranchises, int?customerId, bool isBillTo) { return(from cust in dbContext.tbl_Customer join ci in dbContext.tbl_Customer_Info on cust.CustomerID equals ci.CustomerID join l in dbContext.tbl_Locations on cust.CustomerID equals isBillTo ? l.BilltoCustomerID.Value : l.ActvieCustomerID.Value join primaryContact in dbContext.tbl_Contacts on new { cust.CustomerID, PhoneTypeID = 2, l.LocationID } equals new { primaryContact.CustomerID, primaryContact.PhoneTypeID, primaryContact.LocationID } join cellContact in dbContext.tbl_Contacts on new { primaryContact.CustomerID, PhoneTypeID = 4, l.LocationID } equals new { cellContact.CustomerID, cellContact.PhoneTypeID, cellContact.LocationID } into joined let member = (from m in dbContext.tbl_Customer_Members where m.CustomerID == cust.CustomerID && (m.StartDate ?? DateTime.Now) <= DateTime.Now && (m.EndDate ?? DateTime.Now) >= DateTime.Now orderby m.StartDate descending select m).FirstOrDefault() from secContact in joined.DefaultIfEmpty() where searchFranchises.Contains(ci.FranchiseID) && (customerId == null || customerId == cust.CustomerID) select new CustomerInformation { CustomerID = cust.CustomerID, CustomerName = cust.CustomerName, ContactID = primaryContact.ContactID, SecondaryContactID = secContact == null ? 0 : secContact.ContactID, SecondaryContactNumber = secContact == null ? string.Empty : secContact.PhoneNumber, ContactName = primaryContact.ContactName, Address = l.Address, City = l.City, CompanyName = cust.CompanyName, Country = l.Country, Email = cust.EMail, PhoneNumber = primaryContact.PhoneNumber, State = l.State, Zip = l.PostalCode, LocationID = l.LocationID, FranchiseID = ci.FranchiseID, MemberFrom = member == null || !member.StartDate.HasValue ? DateTime.MinValue : member.StartDate.Value, MemberTo = member == null || !member.EndDate.HasValue ? DateTime.MaxValue : member.EndDate.Value, IsMember = member != null && (!member.StartDate.HasValue || member.StartDate.Value <= DateTime.Now) && (!member.EndDate.HasValue || member.EndDate.Value >= DateTime.Now) }); }
public LogoModel(int configId, EightHundredBaseContext context) { var listofurls = context.tbl_HVAC_ConfigLogoUrl.Where(item => item.ConfigID == configId).ToList(); _url = listofurls.Count != 0 ? listofurls.First().Logourl : "../../../Areas/hvac_app/content/bigimage.png"; }