Example #1
0
 public HRManagement()
 {
     InitializeComponent();
     comboBoxModeSelection.SelectedItem = "Users";
     myEmployeeList = EmployeeDA.GetEmployees();
     myUserList     = EmployeeDA.GetUsers();
     RefreshList();
 }
Example #2
0
        //Methods
        public void RefreshList()
        {
            listViewEmployee.Items.Clear();
            listViewUser.Items.Clear();
            myEmployeeList = EmployeeDA.GetEmployees();
            myUserList     = EmployeeDA.GetUsers();
            foreach (User element in myUserList)
            {
                listViewUser.Items.Add(EmployeeDA.ConvertToListViewItemUser(element));
            }

            foreach (Employee element in myEmployeeList)
            {
                listViewEmployee.Items.Add(EmployeeDA.ConvertToListViewItemEmployee(element));
            }
        }
Example #3
0
        public static void DeleteUser(User user)
        {
            List <User> myUserList = EmployeeDA.GetUsers();

            using (StreamWriter sw = new StreamWriter(filePathTemp))
            {
                foreach (User element in myUserList)
                {
                    if (element.EmpId != user.EmpId)
                    {
                        sw.WriteLine(element.GetUserInfo());
                    }
                }
            }

            File.Replace(filePathTemp, filePathUser, filePathBackup);
        }
Example #4
0
        private void buttonLogin_Click(object sender, EventArgs e)
        {
            bool access = false;

            myUserList = EmployeeDA.GetUsers();
            foreach (User element in myUserList)
            {
                if ((textBoxUserName.Text == element.Username) && (textBoxPassword.Text == element.Password))
                {
                    access   = true;
                    LoggedIn = element;
                    FormMain formMain = new FormMain();
                    formMain.ShowDialog();
                    break;
                }
            }
            if (access == false)
            {
                MessageBox.Show("Error! Invalid User Name and/or Password entered.\nPlease try again.");
            }
        }