Ejemplo n.º 1
0
        private void pictureBox1_Click(object sender, EventArgs e)
        {
            main_landing_page blp = new main_landing_page();

            blp.Show();
            this.Hide();
        }
Ejemplo n.º 2
0
        private void pictureBox1_Click(object sender, EventArgs e)
        {
            //navigate back to admin landing page
            main_landing_page blp = new main_landing_page();

            blp.Show();
            this.Hide();
        }
Ejemplo n.º 3
0
 private void Get_role()
 {
     try
     {
         con.Open();
         SqlCommand cmd = con.CreateCommand();
         cmd.CommandType = CommandType.Text;
         // same command, getting the username information
         cmd.CommandText = "SELECT * FROM [dbo].[users] where Full_name ='" + username + "'";
         cmd.ExecuteNonQuery();
         DataTable      dt = new DataTable();
         SqlDataAdapter da = new SqlDataAdapter(cmd);
         // reading the userinfo
         SqlDataReader dr = cmd.ExecuteReader();
         if (dr.Read())
         {
             // getting the role of the user to redirect user properly
             rolestring   = (dr["Role"].ToString());
             branchstring = (dr["Branch"].ToString());
             // if role is emploee or the user is from the 3 branches
             // open branch landing page
             if (rolestring == "employee")
             {
                 Branch_landing_page blp = new Branch_landing_page();
                 blp.Show();
             }
             // if role is admin or the user is from the main branch
             // open main branch landing page
             else if (rolestring == "admin")
             {
                 main_landing_page mlp = new main_landing_page();
                 mlp.Show();
             }
             this.Hide();
         }
         con.Close();
     }catch (Exception e)
     {
         MessageBox.Show(e.ToString(), "error!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }