예제 #1
0
        private void CommandBinding_Executed_2(object sender, ExecutedRoutedEventArgs e)
        {
            var dcustomer = new Solutec.Models.customers {
                id_customer = custom.id_customer
            };

            using (var context = new Solutec.Models.solutecEntities())
            {
                context.customers.Attach(dcustomer);
                context.customers.Remove(dcustomer);
                context.SaveChanges();
            }

            lblNotification.Content = "El cliente ha sido eliminado";
            notification.Visibility = Visibility.Visible;
            mainw.Succesful("customer");
            thirdParty_customer.IsEnabled = false;
            direct_customer.IsEnabled     = false;
            full_nameTextBox.IsEnabled    = false;
            phone_numberTextBox.IsEnabled = false;
            nitTextBox.IsEnabled          = false;
            nrcTextBox.IsEnabled          = false;
            duiTextBox.IsEnabled          = false;
            addressTextBox.IsEnabled      = false;
            btnModify.IsEnabled           = false;
            btnDelete.IsEnabled           = false;
        }
예제 #2
0
 private void CustomersDataGrid_MouseDoubleClick(object sender, MouseButtonEventArgs e)
 {
     if (customersDataGrid.SelectedItem != null)
     {
         Solutec.Models.customers customer = (Solutec.Models.customers)customersDataGrid.SelectedItem;
         mainw.customerSelected(customer);
     }
 }
예제 #3
0
        private void CommandBinding_Executed_1(object sender, ExecutedRoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(full_nameTextBox.Text) || string.IsNullOrEmpty(phone_numberTextBox.Text))
            {
                MessageBox.Show("Los campos nombre y telefono no deben estar vacios");
                return;
            }

            var mcustomer = new Solutec.Models.customers {
                id_customer = custom.id_customer
            };

            using (var context = new Solutec.Models.solutecEntities())
            {
                context.customers.Attach(mcustomer);
                if (direct_customer.IsChecked == true)
                {
                    mcustomer.customer_type = 1;
                    mcustomer.nrc           = "";
                }
                else
                {
                    mcustomer.customer_type = 2;
                    mcustomer.nrc           = nrcTextBox.Text;
                }
                mcustomer.full_name    = full_nameTextBox.Text;
                mcustomer.address      = addressTextBox.Text;
                mcustomer.nit          = nitTextBox.Text;
                mcustomer.dui          = duiTextBox.Text;
                mcustomer.phone_number = phone_numberTextBox.Text;
                context.Configuration.ValidateOnSaveEnabled = false;
                context.SaveChanges();
            }
            lblNotification.Content = "El cliente ha sido modificado";
            notification.Visibility = Visibility.Visible;
            mainw.Succesful("customer");
        }
예제 #4
0
 public void customerSelected(Solutec.Models.customers customer)
 {
     Solutec.Views.new_customer newCustomer = new Solutec.Views.new_customer(this, customer);
     secondary_frame.NavigationService.Navigate(newCustomer);
 }