private void OnCompanyClicked(object sender, RoutedEventArgs e) { var d = (DataInvoice)((Label)sender).DataContext; CompanyPage window = new CompanyPage(); window.DataContext = CompanyHelper.GetCompany(d.ABN); window.Owner = Application.Current.MainWindow; window.Show(); }
public async void GetAllCompanies() { DataCompany[] allCompanies = await CompanyHelper.GetAllCompanies(); for (int i = 0; i < allCompanies.Length; i++) { DataCompany c = allCompanies[i]; Companies.Add(c); } ListboxCompanies.ItemsSource = Companies; }
private bool SearchBarFilter(object item) { if (string.IsNullOrEmpty(Searchbar.Text)) { return(true); } else { return(((item as DataInvoice).CompanyName.IndexOf(Searchbar.Text, StringComparison.OrdinalIgnoreCase) >= 0) || ((item as DataInvoice).ABN.IndexOf(Searchbar.Text, StringComparison.OrdinalIgnoreCase) >= 0) || ((item as DataInvoice).DisplayName.IndexOf(Searchbar.Text, StringComparison.OrdinalIgnoreCase) >= 0) || (CompanyHelper.GetCompany((item as DataInvoice).ABN).Contacts.Where(a => a.Name.IndexOf(Searchbar.Text, StringComparison.OrdinalIgnoreCase) >= 0).Count() > 0)); } }
private void EditButton_Click(object sender, RoutedEventArgs e) { ReadOnly = !ReadOnly; EditingLabel.Visibility = ReadOnly ? Visibility.Collapsed : Visibility.Visible; if (ReadOnly) { var r = MessageBox.Show("Are you sure you wish to make changes to the company? This cannot be undone.", "Are you sure?", MessageBoxButton.OKCancel); if (r == MessageBoxResult.OK) { var dataCompany = (DataCompany)DataContext; dataCompany.ABN = TextboxABN.Text; dataCompany.CompanyName = TextboxCompanyName.Text; dataCompany.OfficeNumber = TextboxOfficeNumber.Text; dataCompany.Email = TextboxEmail.Text; CompanyHelper.SaveChanges(dataCompany); } } }
private void SaveAllButton_Click(object sender, RoutedEventArgs e) { CompanyHelper.SaveChanges((DataCompany)DataContext); }