Example #1
0
        private async void Window_Loaded(object sender, RoutedEventArgs e)
        {
            txtInvoiceNumber.Text = currentInvoice.InvoiceID;
            txtOrderNumber.Text   = currentInvoice.OrderID;
            txtBalance.Text       = currentInvoice.InvoiceTotal;
            txtAmountPaid.Text    = currentInvoice.PaymentTotal;
            invoiceUser           = await UserProcessor.GetUsers(currentUser.Token, currentInvoice.CustomerID);

            userAddress = await UserProcessor.GetAddress(currentUser.Token, invoiceUser.UserID);

            //invoiceOrder = await OrderProcessor.GetOrderByOrderID(currentInvoice.OrderID, currentUser.Token);
            txtClientName.Text   = invoiceUser.Firstname + " " + invoiceUser.Lastname;
            txtEmail.Text        = invoiceUser.Email;
            txtStartDtae1.Text   = currentInvoice.InvoiceDate;
            txtEndDate1.Text     = currentInvoice.InvoiceDueDate;
            txtPaymentDate1.Text = currentInvoice.PaymentDate;
            txtAddress.Text      = userAddress.Line1;
            txtCity.Text         = userAddress.City;
            txtState.Text        = userAddress.State;
            txtZIp.Text          = userAddress.ZipCode;
            txtPhone.Text        = userAddress.Phone;
        }
Example #2
0
        private async void lstUsers_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (lstUsers.SelectedIndex != -1)
            {
                try
                {
                    selectedUser = (UserModel)lstUsers.SelectedItem;
                    userAddress  = await UserProcessor.GetAddress(currentUser.Token, selectedUser.UserID);

                    lblHireDate.Visibility  = Visibility.Hidden;
                    txtHireDate.Visibility  = Visibility.Hidden;
                    lblBirthDate.Visibility = Visibility.Hidden;
                    txtBirthDate.Visibility = Visibility.Hidden;
                    ClearPetInfo();
                    ClearUserInfo();
                    EnableUserTextbox();
                    EnablePetTextbox();

                    btnCreateUser.IsEnabled = false;
                    btnClear.IsEnabled      = true;
                    btnCreatePet.IsEnabled  = true;

                    // User related text boxes become populated
                    txtFirstName.Text = selectedUser.Firstname;
                    txtLastName.Text  = selectedUser.Lastname;
                    txtEmail.Text     = selectedUser.Email;
                    txtUsername.Text  = selectedUser.Username;
                    txtPassword.Text  = "";

                    txtAddress.Text = userAddress.Line1;
                    txtCity.Text    = userAddress.City;
                    txtState.Text   = userAddress.State;
                    txtZip.Text     = userAddress.ZipCode;
                    txtPhone.Text   = userAddress.Phone;

                    if (selectedUser.Privileges == "Admin")
                    {
                        comboPriv.SelectedIndex = 1;
                        lstInvoices.Items.Clear();
                        DisablePetTextbox();
                        lstPets.Items.Clear();
                        lstOrders.Items.Clear();
                    }
                    else if (selectedUser.Privileges == "Employee")
                    {
                        comboPriv.SelectedIndex = 2;
                        lblHireDate.Visibility  = Visibility.Visible;
                        txtHireDate.Visibility  = Visibility.Visible;
                        lblBirthDate.Visibility = Visibility.Visible;
                        txtBirthDate.Visibility = Visibility.Visible;
                        txtHireDate.Text        = selectedUser.HireDate;
                        txtBirthDate.Text       = selectedUser.BirthDate;
                        lstInvoices.Items.Clear();
                        lstPets.Items.Clear();
                        lstOrders.Items.Clear();
                        DisablePetTextbox();
                    }
                    else
                    {
                        comboPriv.SelectedIndex = 3;
                        FillOrderListBox();
                        FillPetListBox();
                        FillInvoiceListBox(selectedUser);
                    }
                }
                catch (Exception)
                {
                    MessageBox.Show("This user has incomplete data");
                }
            }
        }