Esempio n. 1
0
        private void SaveCustomerDataButton_OnClick(object sender, RoutedEventArgs e)
        {
            if (_errorsOnScreen == 0)
            {
                var customer = new Backend.Models.Customer
                {
                    Salutation = AnredeComboBox.Text,
                    FirstName  = VornameTextBox.Text,
                    Name       = NameTextBox.Text,
                    Company    = FirmaTextBox.Text,
                    Addition   = ZusatzTextBox.Text,
                    Mobil      = MobilTextBox.Text,
                    Phone      = Telefon1TextBox.Text,
                    Mail       = Mail1TextBox.Text,
                    Fax        = FaxTextBox.Text,
                    Comment    = BemerkungTextBox.Text
                };

                if (_customerId == 0)
                {
                    Database.InsertCustomerData(customer);
                }
                else
                {
                    customer.Id = _customerId;
                    Database.UpdateCustomerData(customer);
                }

                Close();
            }
            else
            {
                MetroMessageBox.Show("Error!", "All mandatory fields must be completed correctly!");
            }
        }
Esempio n. 2
0
        public CustomerDataWindow(int customerId, bool showsaveButton)
        {
            InitializeComponent();
            DropShadow.DropShadowToWindow(this);
            _customerId = customerId;
            SetShowSaveButton(showsaveButton);
            MakeAllTextBoxesReadOnly(showsaveButton);

            KundennummerTextBox.Visibility   = Visibility.Hidden;
            KundennummerTextBlock.Visibility = Visibility.Hidden;
            AnredeComboBox.Focus();

            DataContext = new Backend.Models.Customer();
        }
 private void CustomerDataGrid_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     SetCustomerItemsCount();
     SelectedCustomer = CustomerDataGrid.SelectedItem as Backend.Models.Customer;
 }