Ejemplo n.º 1
0
        private void AdministratorForm_Load(object sender, EventArgs e)
        {
            //add each user's name into the drop down box
            for (int i = 0; mainForm.userList.Count > i; i++)
            {
                cmbSelectedUser.Items.Add(userList.ElementAt(i).Name);
            }

            //changing the index will cause it to update and have it load each list box
            if (cmbSelectedUser.Items.Count > 0)
            {
                cmbSelectedUser.SelectedIndex = 0;
            }
        }
Ejemplo n.º 2
0
        private void btnClock_Click(object sender, EventArgs e)
        {
            String strCurrentUserCode = txtUserCode.Text;
            User   curUser            = null;

            //run through all the users and find the matching user code
            for (int i = 0; userList.Count() > i; i++)
            {
                //if it matches clock in or out
                if (userList.ElementAt(i).UserID.Equals(strCurrentUserCode))
                {
                    curUser = userList[i];
                }
            }

            if (curUser == null)
            {
                if (strCurrentUserCode.Equals("+R+I+C+Ka"))
                {
                    System.Diagnostics.Process.Start("https://youtu.be/dQw4w9WgXcQ"); return;
                }

                NewUser newUser = new NewUser(this);

                newUser.ShowDialog();
                return;
            }

            if (curUser.IsClockedIn)
            {
                curUser.clockOut();
                PrintUserInfo(curUser);
            }
            else
            {
                curUser.clockIn();
                PrintUserInfo(curUser);
            }
            txtUserCode.Focus();
            txtUserCode.SelectAll();

            userList.Save();
        }