private void ButtonDashboard_Click(object sender, RoutedEventArgs e) { TextblockPanelName.Text = "Dashboard"; RoleCache.GetInstance().Clear(); EmployeeCache.GetInstance().Clear(); ResourceCache.GetInstance().Clear(); CustomerCache.GetInstance().Clear(); ProcessCache.GetInstance().Clear(); ProjectCache.GetInstance().Clear(); List <Resource> recs = ResourceCache.GetInstance().Resources; recs = ResourceCache.GetInstance().UpdateAllQSizes(); recs = recs.OrderByDescending(r => r.QSize).ToList <Resource>(); var emps = EmployeeCache.GetInstance().Employees; emps = EmployeeCache.GetInstance().UpdateAllQSizes(); emps = emps.OrderByDescending(e => e.QSize).ToList <Employee>(); DataContext = new DashboardViewModel { Resources = new ObservableCollection <Resource>(recs), SelectedResource = recs[0], Employees = new ObservableCollection <Employee>(emps), SelectedEmployee = emps[0] }; }
private void ProjectViewNewProjectClickHandler(ProjectsViewModel viewModel) { TextblockPanelName.Text = "Create New Project"; RoleCache.GetInstance().Clear(); EmployeeCache.GetInstance().Clear(); ResourceCache.GetInstance().Clear(); CustomerCache.GetInstance().Clear(); ProcessCache.GetInstance().Clear(); ProjectCache.GetInstance().Clear(); var resources = ResourceCache.GetInstance().Resources; resources = ResourceCache.GetInstance().UpdateAllQSizes(); DataContext = new AddEditProjectViewModel { Project = new Project { Id = 0, Processes = new List <Process>(), StartDate = DateTimeOffset.UtcNow, PoDate = DateTimeOffset.UtcNow, Quantity = 1, OrderStatus = Project.ProjectOrderStatus.WaitingQuote, }, BackClickedHandler = AddEditProjectViewBackClickHandler, Customers = CustomerCache.GetInstance().Customers, Processes = new ObservableCollection <Process>(new List <Process>()), Resources = resources.OrderByDescending(r => r.QSize).ToList <Resource>(), Employees = EmployeeCache.GetInstance().Employees }; }
public Customer SyncCustomer(Customer customer) { if (GetCustomerByName(customer.Name) == null) { CustomerCache.GetInstance().InsertNewCustomer(customer); } return(GetCustomerByName(customer.Name)); }
public string[] GetNamesOfCustomers() { List <string> nameList = new List <string>(); foreach (Customer customer in CustomerCache.GetInstance().Customers) { nameList.Add(customer.Name); } return(nameList.ToArray()); }
public void Refresh() { CustomerCache.GetInstance().Clear(); EmployeeCache.GetInstance().Clear(); Customers = new ObservableCollection <Customer>(CustomerCache.GetInstance().Customers); Employees = new ObservableCollection <Employee>(EmployeeCache.GetInstance().Employees); ListViewCustomers.ItemsSource = Customers; ComboboxCustomerManager.ItemsSource = Employees; ListViewCustomers.SelectedItem = GetFirstCustomer(); }
private void SaveCustomer(Customer itemToSave) { if (itemToSave.Id > 0) { CustomerCache.GetInstance().Update(itemToSave); } else { CustomerCache.GetInstance().Insert(itemToSave); } Customers = new ObservableCollection <Customer>(CustomerCache.GetInstance().Customers); }
public void UpdateCustomerByID(Customer changedCustomer) { if (changedCustomer.ID < 0) { CustomerCache.GetInstance().InsertNewCustomer(changedCustomer); } else { CustomerCache.GetInstance().UpdateCustomer(changedCustomer); //force cache reload on next access CustomerCache.GetInstance().Clear(); } }
public void DeleteCustomer(int selectedCustomerID) { CustomerCache.GetInstance().DeleteCustomer(selectedCustomerID); //>>replace the deleted customer's id with empty customer id //1. find the empty customer Customer defaultCustomer = GetCustomerByName(string.Empty); if (defaultCustomer != null) { //use the id to replace deleted Customer's ID in all transactions. (new TransactionManager()).ReplaceCustomer(selectedCustomerID, defaultCustomer.ID); } //force cache reload on next access CustomerCache.GetInstance().Clear(); }
private void ProjectViewOpenProectClickHandler(ProjectsViewModel viewModel) { TextblockPanelName.Text = "Project Details"; RoleCache.GetInstance().Clear(); EmployeeCache.GetInstance().Clear(); ResourceCache.GetInstance().Clear(); CustomerCache.GetInstance().Clear(); ProcessCache.GetInstance().Clear(); ProjectCache.GetInstance().Clear(); var resources = ResourceCache.GetInstance().Resources; resources = ResourceCache.GetInstance().UpdateAllQSizes(); DataContext = new AddEditProjectViewModel { Project = viewModel.SelectedProject, BackClickedHandler = AddEditProjectViewBackClickHandler, Customers = CustomerCache.GetInstance().Customers, Processes = new ObservableCollection <Process>(viewModel.SelectedProject.Processes), Resources = resources.OrderByDescending(r => r.QSize).ToList <Resource>(), Employees = EmployeeCache.GetInstance().Employees }; }
public List <Customer> GetAllCustomers() { return(CustomerCache.GetInstance().Customers); }
internal void RefreshCache() { CustomerCache.GetInstance().Clear(); CustomerCache.GetInstance(); }
public double GetPendingAmountTill(int customerID, DateTime tillDate) { return(CustomerCache.GetInstance().GetPendingAmountBefore(customerID, tillDate)); }
public Customer GetCustomerByName(string name) { return(CustomerCache.GetInstance().GetCustomerByName(name.Trim().ToLower())); }
public Customer GetCustomerByID(int ID) { return(CustomerCache.GetInstance().GetCustomerById(ID)); }
private void DeleteSelectedCustomer() { CustomerCache.GetInstance().Delete(ListViewCustomers.SelectedItem as Customer); Customers = new ObservableCollection <Customer>(CustomerCache.GetInstance().Customers); }
public Customer GetCustomerByName(string name) { return(CustomerCache.GetInstance().GetCustomerByName(name)); }