public UsersForm(MainForm mf)
 {
     this.mf = mf;
     InitializeComponent();
     lvwColumnSorter = new ListViewColumnSorter();
     this.lvUsersList.ListViewItemSorter = lvwColumnSorter;
 }
 private void btnLogin_Click(object sender, EventArgs e)
 {
     bool invalidUsername = true;
     adminList = DataServices.GetAdmins();
     if (tfUsername.Text.Trim() == "" || tfPassword.Text.Trim() == "")
     {
         MessageBox.Show("Please enter your username and password.", "Admin Login Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     {
         foreach (Admin a in adminList)
         {
             if (a.username.ToLower() == tfUsername.Text.ToLower())
             {
                 invalidUsername = false;
                 if (a.password == tfPassword.Text)
                 {
                     MainForm mf = new MainForm(this, a);
                     tfPassword.Clear();
                     tfUsername.Clear();
                     mf.Show();
                     this.Hide();
                 }
                 else
                 {
                     MessageBox.Show("Incorrect Password.", "Admin Login Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 }
             }
         }
         if (invalidUsername == true)
         {
             MessageBox.Show("Invalid Username.", "Admin Login Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
 }
 public AdminUserProfileForm(MainForm mf)
 {
     this.mf = mf;
     InitializeComponent();
     this.Size = new Size(this.Width, 470);
 }