Example #1
0
        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();
        }
Example #2
0
        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;
        }
Example #3
0
 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));
     }
 }
Example #4
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);
         }
     }
 }
Example #5
0
 private void SaveAllButton_Click(object sender, RoutedEventArgs e)
 {
     CompanyHelper.SaveChanges((DataCompany)DataContext);
 }