Beispiel #1
0
        private void saveBtn(object sender, RoutedEventArgs e)
        {
            try
            {
                var empModel = new employee
                {
                    EmployeeID  = int.Parse(EmpIdBox.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,
                    JoinDate    = DateJoinPicker.SelectedDate
                };

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

                dc.employees.InsertOnSubmit(empModel);
                dc.SubmitChanges();

                MessageBox.Show("Employee has been added");
                LoadData();
                LoadWindow();
            }
            catch
            {
                MessageBox.Show("Thats not a valid action");
            }
        }
 partial void Deleteemployee(employee instance);
 partial void Updateemployee(employee instance);
 partial void Insertemployee(employee instance);