/*
  * Event listener for the Analysist tile
  */
 private void tile_analyst_Click(object sender, EventArgs e)
 {
     Login_Form login = new Login_Form(2, this);
     login.Show();
     this.Enabled = false;
 }
 /*
  * Event listener for the Review Analyser tile
  */
 private void tile_reviewer_Click(object sender, EventArgs e)
 {
     this.Enabled = false;
     Login_Form login = new Login_Form(3, this);
     login.Show();
 }
        public string checkLoginAuthentication(int type, string username, string password, Login_Form login)
        {
            if ((username.Equals("")) || (password.Equals("")))
            {
                MetroFramework.MetroMessageBox.Show(login, "Login attempt failed" + "\n" + "Required fields are missing", "Login was unsuccessful", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return null;
            }
            else
            {
                string encryptedPassword = encrypter.Encrypt(password,ENCRYPT_KEY);
                encryptedPassword = encryptedPassword.Trim();
                if (type == 1)
                {
                    DataSet ds = dr.getAdmin(username, encryptedPassword);
                    if (ds != null)
                    {
                        int count = ds.Tables[0].Rows.Count;
                        if (count == 0)
                        {
                            MetroFramework.MetroMessageBox.Show(login, "Username or Password is incorrect", "Login was unsuccessful", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            return null;
                        }
                        else
                        {
                            return ds.Tables[0].Rows[0]["name"].ToString();
                        }
                    }
                    return null;

                }
                else if (type == 2)
                {
                    DataSet ds = dr.getAnalyser(username, encryptedPassword);
                    if (ds != null)
                    {
                        int count = ds.Tables[0].Rows.Count;
                        if (count == 0)
                        {
                            MetroFramework.MetroMessageBox.Show(login, "Username or Password is incorrect", "Login was unsuccessful", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            return null;
                        }
                        else
                        {
                            return ds.Tables[0].Rows[0]["name"].ToString();
                        }
                    }
                    return null;

                }
                else
                {
                    DataSet ds = dr.getReviewer(username, encryptedPassword);
                    if (ds != null)
                    {
                        int count = ds.Tables[0].Rows.Count;
                        if (count == 0)
                        {
                            MetroFramework.MetroMessageBox.Show(login, "Username or Password is incorrect", "Login was unsuccessful", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            return null;
                        }
                        else
                        {
                            return ds.Tables[0].Rows[0]["name"].ToString();
                        }
                    }
                    return null;
                }
            }
        }