Beispiel #1
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     try
     {
         if (CheckValid() && addNew)
         {
             Receptionist re = new Receptionist()
             {
                 FirstName = txtFirstname.Text,
                 LastName  = txtLastname.Text,
                 Address   = txtAdress.Text,
                 Country   = cbCountry.SelectedItem.ToString(),
                 Email     = txtEmail.Text,
                 Phone     = txtPhone.Text,
                 Username  = txtUsername.Text,
                 Password  = txtPass.Text
             };
             if (ManagerDAL.AddNewRecept(re))
             {
                 ManagerDAL.AddNewLog(new Log()
                 {
                     StaffID = StaffID, ActionTime = DateTime.Now, Main = "Add new Receptionist: " + txtReceptID.Text
                 });
                 MessageBox.Show("Add successful!");
                 BindingStatus = false;
                 LoadData();
                 addNew = false;
             }
             else
             {
                 MessageBox.Show("Add failed!");
             }
         }
         else
         {
             MessageBox.Show("Invalid to Update!");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }