private void BtnAddEmployee(object sender, RoutedEventArgs e) { Employee emp = new Employee(); if (!(txtEmpId.Text.Equals("") || (txtLast.Text.Equals("") || txtFName.Text.Equals("") || txtTitle.Text.Equals("") || txtIDNo.Text.Equals("") || txtAddress.Text.Equals("") || txtReportTo.Text.Equals("") || txtEmail.Text.Equals("") || txtPass.Password.Equals("")))) { emp.EmpID = Int32.Parse(txtEmpId.Text); emp.LastName = txtLast.Text; emp.FirstName = txtFName.Text; emp.Title = txtTitle.Text; emp.IDNo = txtIDNo.Text; emp.Address = txtAddress.Text; emp.ReportTo = Int32.Parse(txtReportTo.Text); emp.Email = txtEmail.Text; emp.Username = txtUserName.Text; emp.Password = txtPass.Password; if (cPos.SelectedIndex == 0) { emp.EmployeePositionID = 1; MessageBox.Show("Cashier"); } else if (cPos.SelectedIndex == 1) { emp.EmployeePositionID = 2; MessageBox.Show("Supervisor"); } if (da.EmailIsValid(txtEmail.Text)) { if (emp.IDNo.Length == 13) { string msg = da.AddEmployee(emp); MessageBox.Show("" + msg); if (msg.Equals("Employee Added")) { MainWindow mw = Application.Current.Windows.OfType <MainWindow>().FirstOrDefault(); if (mw != null) { mw.MainFrame.Content = new ManageEmployees(); } } } else { MessageBox.Show("SA ID must be 13 digits long"); } } else { MessageBox.Show("Wrong Email"); } } else { MessageBox.Show("All textbox must be full"); } }
private void BtnAddSupplier(object sender, RoutedEventArgs e) { if (!(txtsupId.Text.Equals("") || txtCompanyName.Text.Equals("") || txtAddress.Text.Equals("") || txtCity.Text.Equals("") || txtRegion.Text.Equals("") || txtPostCode.Text.Equals("") || txtCountry.Text.Equals("") || txtPhoneNumber.Text.Equals("") || txtEmail.Text.Equals(""))) { Supplier s = new Supplier(); s.SupplierID = Int32.Parse(txtsupId.Text); s.CompanyName = txtCompanyName.Text; s.Address = txtAddress.Text; s.City = txtCity.Text; s.Region = txtRegion.Text; s.PostalCode = txtPostCode.Text; s.Country = txtCountry.Text; s.Phone = txtPhoneNumber.Text; s.Email = txtEmail.Text; if (da.EmailIsValid(txtEmail.Text)) { string msg = da.AddSupplier(s); MessageBox.Show("" + msg); if (msg.Equals("New Supplier Added")) { MainWindow mw = Application.Current.Windows.OfType <MainWindow>().FirstOrDefault(); if (mw != null) { mw.MainFrame.Content = new ManageSuppliers(); } } } else { MessageBox.Show("Wrong email please enter correct email"); } } else { MessageBox.Show("All textbox must be full"); } //is knowlegde obtained through observetion critical tested and expirinmented }