private void LoadSearchGridControlData(string productTitle, string productDescription, string partNumber, string customerNumber) { using (var dbContext = new FarnahadManufacturingDbContext()) { var productsQueryable = dbContext.Products .Include(item => item.ProductPrices) .Include(item => item.ProductSubstitutes) .Include(item => item.ProductAssociatePrices) .OrderBy(item => item.Id).AsQueryable(); if (!string.IsNullOrEmpty(productTitle)) { productsQueryable = productsQueryable.Where(item => item.Title.Contains(productTitle)); } if (!string.IsNullOrEmpty(productDescription)) { productsQueryable = productsQueryable.Where(item => item.Description.Contains(productDescription)); } if (!string.IsNullOrEmpty(partNumber)) { productsQueryable = productsQueryable.Where(item => item.Part.Number.Contains(partNumber)); } // TODO: Customer Number //if (!string.IsNullOrEmpty(customerNumber)) // productsQueryable = productsQueryable.Where(item => item.Customer.Number.Contains(customerNumber)); var totalRecordsCount = productsQueryable.Count(); _products = productsQueryable.Paginate(PaginationUserControl.CurrentPage); SearchGridControl.ItemsSource = _products; PaginationUserControl.UpdateRecordsDetail(_products.Count, totalRecordsCount); } }
private void LoadSearchGridControlData(string partNumber, string description, object partType) { using (var dbContext = new FarnahadManufacturingDbContext()) { var partsQueryable = dbContext.Parts.OrderBy(item => item.Id) .Include(item => item.PartCosts) .Include(item => item.PartReorderInformations) .Include(item => item.LastChangedByUser) .AsQueryable(); if (!string.IsNullOrEmpty(partNumber)) { partsQueryable = partsQueryable.Where(item => item.Number.Contains(partNumber)); } if (!string.IsNullOrEmpty(description)) { partsQueryable = partsQueryable.Where(item => item.Description.Contains(description)); } if (partType is PartType partTypeValue) { partsQueryable = partsQueryable.Where(item => item.PartType == partTypeValue); } _parts = partsQueryable.Paginate(PaginationUserControl.CurrentPage); SearchGridControl.ItemsSource = _parts; PaginationUserControl.UpdateRecordsDetail(_parts.Count, partsQueryable.Count()); } }
private void LoadProducts(string productName = null, string productDescription = null, string customerNumber = null, string partNumber = null) { using (var dbContext = new FarnahadManufacturingDbContext()) { var productsQueryable = dbContext.Products.OrderBy(item => item.Id).AsQueryable(); if (!string.IsNullOrEmpty(productName)) { productsQueryable = productsQueryable.Where(item => item.Title.Contains(productName)); } if (!string.IsNullOrEmpty(productDescription)) { productsQueryable = productsQueryable.Where(item => item.Description.Contains(productDescription)); } // TODO: add customer... //if (!string.IsNullOrEmpty(customerNumber)) // productsQueryable = productsQueryable.Where(item => item.c); if (!string.IsNullOrEmpty(partNumber)) { productsQueryable = productsQueryable.Where(item => item.Part.Number.Contains(partNumber)); } var products = productsQueryable.Paginate(PaginationUserControl.CurrentPage); SearchGridControl.ItemsSource = products; PaginationUserControl.UpdateRecordsDetail(products.Count, productsQueryable.Count()); } }
private void LoadSearchGridControlData(string searchName = null, int?provinceId = null, int?cityId = null) { using (var dbContext = new FarnahadManufacturingDbContext()) { var vendorsQueryable = dbContext.Vendors.OrderBy(item => item.Id) .Include(item => item.Addresses) .Include("Addresses.ContactInformations") .Include(item => item.CreatedByUser).AsQueryable(); if (!string.IsNullOrEmpty(searchName)) { vendorsQueryable = vendorsQueryable.Where(item => item.Title.Contains(searchName)); } if (provinceId != null) { vendorsQueryable = vendorsQueryable.Where(item => item.Addresses.Any(a => a.ProvinceId == provinceId)); } if (cityId != null) { vendorsQueryable = vendorsQueryable.Where(item => item.Addresses.Any(a => a.CityId == cityId)); } var totalRecordsCount = vendorsQueryable.Count(); _vendors = vendorsQueryable.Paginate(PaginationUserControl.CurrentPage); SearchGridControl.ItemsSource = _vendors; PaginationUserControl.UpdateRecordsDetail(_vendors.Count, totalRecordsCount); } }
private void LoadSearchGridControlData(string title) { using (var dbContext = new FarnahadManufacturingDbContext()) { var addressTypesQueryable = dbContext.AddressTypes.OrderBy(item => item.Id).AsQueryable(); if (!string.IsNullOrEmpty(title)) { addressTypesQueryable = addressTypesQueryable.Where(item => item.Title.Contains(title)); } var totalRecordsCount = addressTypesQueryable.Count(); _addressTypes = addressTypesQueryable.Paginate(PaginationUserControl.CurrentPage); SearchGridControl.ItemsSource = _addressTypes; PaginationUserControl.UpdateRecordsDetail(_addressTypes.Count, totalRecordsCount); } }
private void LoadSearchGridControlData(string searchTitle = null) { using (var dbContext = new FarnahadManufacturingDbContext()) { var countryQueryable = dbContext.Countries.OrderBy(item => item.Id).AsQueryable(); if (!string.IsNullOrEmpty(searchTitle)) { countryQueryable = countryQueryable.Where(item => item.Title.Contains(searchTitle) || item.Description.Contains(searchTitle)); } var totalRecordsCount = countryQueryable.Count(); _countries = countryQueryable.Paginate(PaginationUserControl.CurrentPage); SearchGridControl.ItemsSource = _countries; PaginationUserControl.UpdateRecordsDetail(_countries.Count, totalRecordsCount); } }
private void LoadSearchGridControlData(string title) { using (var dbContext = new FarnahadManufacturingDbContext()) { var userGroupQueryable = dbContext.UsersGroups .Include(item => item.MembersUsers) .OrderBy(item => item.Id).AsQueryable(); if (!string.IsNullOrEmpty(title)) { userGroupQueryable = userGroupQueryable.Where(item => item.Title.Contains(title)); } var totalRecordsCount = userGroupQueryable.Count(); _userGroups = userGroupQueryable.Paginate(PaginationUserControl.CurrentPage); SearchGridControl.ItemsSource = _userGroups; PaginationUserControl.UpdateRecordsDetail(_userGroups.Count, totalRecordsCount); } }
private void LoadSearchGridControlData(string title, string abbreviation) { using (var dbContext = new FarnahadManufacturingDbContext()) { var uomQueryable = dbContext.Uoms.OrderBy(item => item.Id).AsQueryable(); if (!string.IsNullOrEmpty(title)) { uomQueryable = uomQueryable.Where(item => item.Title.Contains(title)); } if (!string.IsNullOrEmpty(abbreviation)) { uomQueryable = uomQueryable.Where(item => item.Abbreviation.Contains(abbreviation)); } var totalRecordsCount = uomQueryable.Count(); _uoms = uomQueryable.Paginate(PaginationUserControl.CurrentPage); SearchGridControl.ItemsSource = _uoms; PaginationUserControl.UpdateRecordsDetail(_uoms.Count, totalRecordsCount); } }
private void LoadSearchGridControlData(string title, object statusComboBox) { using (var dbContext = new FarnahadManufacturingDbContext()) { var paymentTermsQueryable = dbContext.PaymentTerms.OrderBy(item => item.Id).AsQueryable(); if (!string.IsNullOrEmpty(title)) { paymentTermsQueryable = paymentTermsQueryable.Where(item => item.Title.Contains(title)); } if (statusComboBox is bool isActive) { paymentTermsQueryable = paymentTermsQueryable.Where(item => item.IsActive == isActive); } var totalRecordsCount = paymentTermsQueryable.Count(); _paymentTerms = paymentTermsQueryable.Paginate(PaginationUserControl.CurrentPage); SearchGridControl.ItemsSource = _paymentTerms; PaginationUserControl.UpdateRecordsDetail(_paymentTerms.Count, totalRecordsCount); } }
private void LoadSearchGridControlData(string searchTitle = null, object searchStatus = null) { using (var dbContext = new FarnahadManufacturingDbContext()) { var carrierQueryable = dbContext.Carriers.OrderBy(item => item.Id).AsQueryable(); if (!string.IsNullOrEmpty(searchTitle)) { carrierQueryable = carrierQueryable.Where(item => item.Title.Contains(searchTitle)); } if (searchStatus != null) { var searchStatusIsActive = searchStatus as Tuple <bool, string>; carrierQueryable = carrierQueryable.Where(item => item.IsActive == searchStatusIsActive.Item1); } var totalRecordsCount = carrierQueryable.Count(); _carriers = carrierQueryable.Paginate(PaginationUserControl.CurrentPage); SearchGridControl.ItemsSource = _carriers; PaginationUserControl.UpdateRecordsDetail(_carriers.Count, totalRecordsCount); } }
private void LoadSearchGridControlData(string title, string country) { using (var dbContext = new FarnahadManufacturingDbContext()) { var provincesQueryable = dbContext.Provinces.OrderBy(item => item.Id).AsQueryable(); if (!string.IsNullOrEmpty(title)) { provincesQueryable = provincesQueryable.Where(item => item.Title.Contains(title) || item.Abbreviation.Contains(title)); } if (!string.IsNullOrEmpty(country)) { provincesQueryable = provincesQueryable.Where(item => item.Country.Title.Contains(country) || item.Country.Abbreviation.Contains(country)); } var totalRecordsCount = provincesQueryable.Count(); _provinces = provincesQueryable.Paginate(PaginationUserControl.CurrentPage); SearchGridControl.ItemsSource = _provinces; PaginationUserControl.UpdateRecordsDetail(_provinces.Count, totalRecordsCount); } }
private void LoadSearchGridControlData(string userName = null, string name = null) { using (var dbContext = new FarnahadManufacturingDbContext()) { var usersQueryable = dbContext.Users .OrderBy(item => item.Id) .Include(item => item.LocationGroupMembers).AsQueryable(); if (!string.IsNullOrEmpty(userName)) { usersQueryable = usersQueryable.Where(item => item.UserName.Contains(userName)); } if (!string.IsNullOrEmpty(name)) { usersQueryable = usersQueryable.Where(item => item.LastName.Contains(name) || item.LastName.Contains(name)); } var totalRecordsCount = usersQueryable.Count(); _users = usersQueryable.Paginate(PaginationUserControl.CurrentPage); SearchGridControl.ItemsSource = _users; PaginationUserControl.UpdateRecordsDetail(_users.Count, totalRecordsCount); } }
private void LoadSearchGridControlData(string title, object statusComboValue) { using (var dbContext = new FarnahadManufacturingDbContext()) { var locationGroupsQueryable = dbContext.LocationGroups .OrderBy(item => item.Id) .Include(item => item.Users) .AsQueryable(); if (!string.IsNullOrEmpty(title)) { locationGroupsQueryable = locationGroupsQueryable.Where(item => item.Title.Contains(title)); } if (statusComboValue is bool status) { locationGroupsQueryable = locationGroupsQueryable.Where(item => item.IsActive == status); } var totalRecordsCount = locationGroupsQueryable.Count(); _locationGroups = locationGroupsQueryable.Paginate(PaginationUserControl.CurrentPage); SearchGridControl.ItemsSource = _locationGroups; PaginationUserControl.UpdateRecordsDetail(_locationGroups.Count, totalRecordsCount); } }
private void LoadSearchGridControlData(string title, string description, object locationGroup, object statusComboBox, object locationNumber) { using (var dbContext = new FarnahadManufacturingDbContext()) { var locationQueryable = dbContext.Locations.OrderBy(item => item.Id).AsQueryable(); if (!string.IsNullOrEmpty(title)) { locationQueryable = locationQueryable.Where(item => item.Title.Contains(title)); } if (!string.IsNullOrEmpty(description)) { locationQueryable = locationQueryable.Where(item => item.Description.Contains(description)); } if (locationGroup is int locationGroupId) { locationQueryable = locationQueryable.Where(item => item.LocationGroupId == locationGroupId); } if (statusComboBox is bool status) { locationQueryable = locationQueryable.Where(item => item.IsActive == status); } if (locationNumber != null) { var locationNumberValue = Convert.ToInt32(locationNumber); if (locationNumberValue != 0) { locationQueryable = locationQueryable.Where(item => item.Number == locationNumberValue); } } var totalRecordsCount = locationQueryable.Count(); _locations = locationQueryable.Paginate(PaginationUserControl.CurrentPage); SearchGridControl.ItemsSource = _locations; PaginationUserControl.UpdateRecordsDetail(_locations.Count, totalRecordsCount); } }