Ejemplo n.º 1
0
        private void CustomerSave_Click(object sender, RoutedEventArgs e)
        {
            var customer = new CustomerCl()
            {
                Name        = customerName.Text,
                Email       = email.Text,
                PhoneNumber = long.Parse(phoneNumber.Text)
            };

            db.Customer.Add(customer);
            db.SaveChanges();

            customerName.Clear();
            email.Clear();
            phoneNumber.Clear();

            MessageBox.Show("Customer Added Successfully", "Alert");
            //var stuf = new MainWindow();
            //stuf.ShowBiz.Content = new Sales();
            this.Hide();
            var sale = new Sales();

            sale.myCustomerComboBox.ItemsSource = db.Customer.ToList();
        }
Ejemplo n.º 2
0
        private void CustomerSave_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                var customer = new CustomerCl()
                {
                    Name        = customerName.Text,
                    Email       = email.Text,
                    PhoneNumber = long.Parse(phoneNumber.Text)
                };

                db.Customer.Add(customer);
                db.SaveChanges();
                dataGrid.ItemsSource = db.Customer.ToList();


                customerName.Clear();
                email.Clear();
                phoneNumber.Clear();
            }
            catch (Exception)
            {
            }
        }