Exemplo n.º 1
0
        private void saveBtn(object sender, RoutedEventArgs e)
        {
            try
            {
                var suppModel = new supplier
                {
                    SupplierID  = int.Parse(SuppIdBox.Text),
                    FirstName   = FirstNameBox.Text,
                    LastName    = LastNameBox.Text,
                    Address     = AddressBox.Text,
                    City        = CityBox.Text,
                    PinCode     = int.Parse(PinCodeBox.Text),
                    PhoneNumber = int.Parse(PhoneNrBox.Text),
                    Email       = EmailBox.Text,
                    DateJoin    = DateJoinPicker.SelectedDate,
                    SupplierOf  = SuppBox.Text,
                };

                SuppIdBox.Clear();
                FirstNameBox.Clear();
                LastNameBox.Clear();
                AddressBox.Clear();
                CityBox.Clear();
                PinCodeBox.Clear();
                PhoneNrBox.Clear();
                EmailBox.Clear();
                SuppBox.Clear();

                dc.suppliers.InsertOnSubmit(suppModel);
                dc.SubmitChanges();

                MessageBox.Show("Supplier has been added");
                LoadData();
                LoadWindow();
            }
            catch
            {
                MessageBox.Show("u need to fill out all fields correct");
            }
        }
 partial void Deletesupplier(supplier instance);
 partial void Updatesupplier(supplier instance);
 partial void Insertsupplier(supplier instance);