public void UserSearch(SearchWindow window) { string name = window.TxtSearchUserName.Text; string pin = window.TxtSearchUserPin.Text; bool? working = window.ChkSearchUserWorking.IsChecked; List <User> users = new UserCRUD().GetUsers(); if (!String.IsNullOrEmpty(name)) { users.RemoveAll(x => x.Name.ToLower() != name.ToLower()); } if (!String.IsNullOrEmpty(pin)) { users.RemoveAll(x => x.Pin != pin); } if (working != null) { users.RemoveAll(x => x.Working != working); } if (users.Count > 0) { BindDataGrid(users); window.Close(); } else { MessageBox.Show("There are no results", "Information"); } }
public void TimeSearch(SearchWindow window) { int selectedUserId = Convert.ToInt32(window.CbSearchTimesUserId.SelectedValue.ToString()); DateTime?selectedStartDate = window.DpSearchTimesStartDate.SelectedDate; DateTime?selectedEndDate = window.DpSearchTimesEndDate.SelectedDate; List <WorkPeriod> periods = new WorkPeriodCRUD().GetWorkPeriods(); if (selectedUserId > 0) { periods.RemoveAll(x => x.UserId != selectedUserId); } if (selectedStartDate != null) { periods.RemoveAll(x => x.Start >= Convert.ToDateTime(selectedStartDate)); } if (selectedEndDate != null) { periods.RemoveAll(x => x.End <= Convert.ToDateTime(selectedEndDate)); } if (periods.Count > 0) { BindDataGrid(periods); window.Close(); } else { MessageBox.Show("There are no results", "Information"); } }
public void InvoiceSearch(SearchWindow window) { string name = window.TxtSearchInvoiceName.Text; string statusId = window.CbSearchInvoiceStatus.Text; List <Objects.Invoice> invoices = new InvoiceCRUD().GetInvoices(); if (!String.IsNullOrEmpty(name)) { invoices.RemoveAll(x => x.InvoiceName != name); } if (!String.IsNullOrEmpty(statusId)) { invoices.RemoveAll(x => x.InvoiceTypeId != Convert.ToInt32(statusId)); } if (invoices.Count > 0) { BindDataGrid(invoices); window.Close(); } else { MessageBox.Show("There are no results", "Information"); } }
public void JobSearch(SearchWindow window) { string name = window.TxtSearchJobName.Text; string balanceDue = window.TxtSearchJobBalanceDue.Text; string city = window.TxtSearchJobCity.Text; bool? mobile = window.ChkSearchJobMobile.IsChecked; string statusId = window.CbSearchJobJobStatusId.Text; string scheduledDate = window.DpSearchJobScheduledDate.Text; List <Job> jobs = new JobCRUD().GetJobs(); if (!String.IsNullOrEmpty(name)) { jobs.RemoveAll(x => x.Name != name); } if (!String.IsNullOrEmpty(balanceDue)) { jobs.RemoveAll(x => x.BalanceDue != Convert.ToDecimal(balanceDue)); } if (!String.IsNullOrEmpty(city)) { jobs.RemoveAll(x => x.City != city); } if (mobile != null) { jobs.RemoveAll(x => x.Mobile != mobile); } if (!String.IsNullOrEmpty(statusId)) { jobs.RemoveAll(x => x.JobStatusId != Convert.ToInt32(statusId)); } if (scheduledDate.Length > 0) { jobs.RemoveAll(x => x.ScheduledDate != Convert.ToDateTime(scheduledDate)); } if (jobs.Count > 0) { BindDataGrid(jobs); window.Close(); } else { MessageBox.Show("There are no results", "Information"); } }
public void InventorySearch(SearchWindow window) { string name = window.TxtSearchItemName.Text; string price = window.TxtSearchItemPrice.Text; string quantity = window.TxtSearchItemQuantity.Text; string skuNumber = window.TxtSearchItemSkuNumber.Text; string itemTypeId = window.CbSearchItemItemTypeId.Text; string locationTypeId = window.CbSearchItemLocationTypeId.Text; List <Item> items = new ItemCRUD().GetAllItems(); if (!String.IsNullOrEmpty(name)) { items.RemoveAll(x => x.Name != name); } if (!String.IsNullOrEmpty(price)) { items.RemoveAll(x => x.Price != Convert.ToDecimal(price)); } if (!String.IsNullOrEmpty(quantity)) { items.RemoveAll(x => x.Quantity != Convert.ToInt32(quantity)); } if (!String.IsNullOrEmpty(skuNumber)) { items.RemoveAll(x => x.SkuNumber != skuNumber); } if (!String.IsNullOrEmpty(itemTypeId)) { items.RemoveAll(x => x.ItemTypeId != Convert.ToInt32(itemTypeId)); } if (!String.IsNullOrEmpty(locationTypeId)) { items.RemoveAll(x => x.LocationTypeId != Convert.ToInt32(locationTypeId)); } if (items.Count > 0) { BindDataGrid(items); window.Close(); } else { MessageBox.Show("There are no results", "Information"); } }
public void OrdersSearch(SearchWindow window) { string name = window.TxtSearchOrderName.Text; string price = window.TxtSearchOrderPrice.Text; string quantity = window.TxtSearchOrderQuantity.Text; string statusId = window.CbOrderStatusId.Text; List <Order> order = new OrderCRUD().GetOrders(); if (!String.IsNullOrEmpty(name)) { order.RemoveAll(x => x.Name.ToLower() != name.ToLower()); } if (!String.IsNullOrEmpty(price)) { order.RemoveAll(x => x.Price != Convert.ToDecimal(price)); } if (!String.IsNullOrEmpty(quantity)) { order.RemoveAll(x => x.Quantity != Convert.ToInt32(quantity)); } if (!String.IsNullOrEmpty(statusId)) { order.RemoveAll(x => x.OrderStatusId != Convert.ToInt32(statusId)); } if (order.Count > 0) { BindDataGrid(order); window.Close(); } else { MessageBox.Show("There are no results", "Information"); } }