Example #1
0
 private void Btn_AdminSave_Click(object sender, RoutedEventArgs e)
 {
     glob_User.Emp_FirstName = tb_AdminFirstName.Text;
     glob_User.Emp_LastName = tb_AdminLastName.Text;
     glob_User.Emp_GenderID = comboBox_AdminGender.SelectedIndex;
     glob_User.Emp_AddLine1 = tb_AdminAddLine1.Text;
     glob_User.Emp_AddLine2 = tb_AdminAddLine2.Text;
     glob_User.Emp_HouseNo = Convert.ToInt64(tb_AdminHouseNo.Text);
     glob_User.Emp_MobileNo = Convert.ToInt64(tb_AdminMobileNo.Text);
     glob_User.Emp_Password = tb_AdminPassword.Text;
     glob_User.Emp_PrivelegeID = Convert.ToBoolean(comboBox_AdminPrivilege.SelectedIndex);
     glob_User.Emp_LastLogin = DateTime.Now;
     AdminDAL aD = new AdminDAL();
     if (aD.SaveChangesToEmployee(glob_User))
         MessageBox.Show($"Changes have been saved.");
     else
         MessageBox.Show($"No changes were saved.");
 }
Example #2
0
 private void Btn_AdminAdd_Click(object sender, RoutedEventArgs e)
 {
     if (tb_AdminFirstName.Text == "" || tb_AdminFirstName.Text == "*" ||
         tb_AdminAddLine1.Text == "" || tb_AdminAddLine1.Text == "*" ||
         tb_AdminMobileNo.Text == "" || tb_AdminMobileNo.Text == "*" ||
         tb_AdminPassword.Text == "" || tb_AdminPassword.Text == "*")
     {
         MessageBox.Show("Please fill up necessary fields. (marked with *)");
         Clear_EmpDetails(1);
     }
     else
     {
         EmpDetails newRecord = new EmpDetails();
         newRecord.Emp_FirstName = tb_AdminFirstName.Text;
         newRecord.Emp_LastName  = tb_AdminLastName.Text;
         newRecord.Emp_GenderID  = comboBox_AdminGender.SelectedIndex;
         newRecord.Emp_AddLine1  = tb_AdminAddLine1.Text;
         newRecord.Emp_AddLine2  = tb_AdminAddLine2.Text;
         if (tb_AdminHouseNo.Text != "")
         {
             newRecord.Emp_HouseNo = Convert.ToInt64(tb_AdminHouseNo.Text);
         }
         else
         {
             newRecord.Emp_HouseNo = 0;
         }
         newRecord.Emp_MobileNo    = Convert.ToInt64(tb_AdminMobileNo.Text);
         newRecord.Emp_Password    = tb_AdminPassword.Text;
         newRecord.Emp_PrivelegeID = Convert.ToBoolean(comboBox_AdminPrivilege.SelectedIndex);
         newRecord.Emp_LastLogin   = null;
         AdminDAL aD = new AdminDAL();
         if (aD.AddNewEmployee(newRecord))
         {
             MessageBox.Show($"User {newRecord.Emp_FirstName} has been successfully added.");
             glob_User = newRecord;
         }
         else
         {
             MessageBox.Show($"User {newRecord.Emp_FirstName} was not added.");
         }
     }
 }
Example #3
0
 private void Btn_AdminSearch_Click(object sender, RoutedEventArgs e)
 {
     if (tb_AdminEmpId.Text == "")
     {
         MessageBox.Show("Please enter Employee ID to search.");
     }
     else
     {
         long       searchID = Convert.ToInt64(tb_AdminEmpId.Text);
         AdminDAL   aD       = new AdminDAL();
         EmpDetails results  = aD.SearchByEmpID(searchID);
         tb_AdminFirstName.Text                = results.Emp_FirstName;
         tb_AdminLastName.Text                 = results.Emp_LastName;
         tb_AdminAddLine1.Text                 = results.Emp_AddLine1;
         tb_AdminAddLine2.Text                 = results.Emp_AddLine2;
         tb_AdminMobileNo.Text                 = Convert.ToString(results.Emp_MobileNo);
         tb_AdminHouseNo.Text                  = Convert.ToString(results.Emp_HouseNo);
         comboBox_AdminGender.SelectedIndex    = results.Emp_GenderID;
         tb_AdminPassword.Text                 = results.Emp_Password;
         comboBox_AdminPrivilege.SelectedIndex = Convert.ToInt32(results.Emp_PrivelegeID);
         glob_User = results;
     }
 }