Esempio n. 1
0
        private void EditUser_Load(object sender, EventArgs e)
        {
            LoadSelectedRow();

            if (CSULevel.Admin())
            {
                txt_ulevel.ReadOnly = false;
            }
        }
Esempio n. 2
0
        private void btn_Login_Click(object sender, EventArgs e)
        {
            SqlConnection conn = new SqlConnection(CSTool.sqlConnString());
            SqlCommand    cmd  = new SqlCommand("SP_Login", conn);

            cmd.CommandType = CommandType.StoredProcedure;

            cmd.Parameters.AddWithValue("@uname", txt_loginID.Text);
            cmd.Parameters.AddWithValue("@pass", txt_loginPW.Text);

            conn.Open();
            //cmd.ExecuteNonQuery();
            var reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                //ASSIGN USER LEVEL TO LOCAL VAR
                CSVar.userLevel = (int)reader[0];

                //CHECK IF LOGGED SUCCESSFULY
                if (CSVar.userLevel > 0)
                {
                    CSTool.infoMessage("Successfully logged in.");
                    //SHOW CPANEL if a valid user
                    if (CSULevel.User() || CSULevel.Support() || CSULevel.Admin())
                    {
                        //SHOW CPANEL
                        CPanel CPWindow = new CPanel();
                        CPWindow.Show();

                        //HIDE LOGIN PANEL
                        this.Hide();
                    }
                }
                else
                {
                    CSTool.errorMessage("Incorrect Username or password.");
                }
            }

            conn.Close();
        }
Esempio n. 3
0
        private void UserManagement_Load(object sender, EventArgs e)
        {
            DGV_GetUsers();

            if (CSULevel.Admin())
            {
                btn_add.Visible = true;
            }
            if (CSULevel.User() || CSULevel.Support() || CSULevel.Admin())
            {
                btn_view.Visible = true;
            }
            if (CSULevel.Support() || CSULevel.Admin())
            {
                btn_edit.Visible = true;
            }
            if (CSULevel.Admin())
            {
                btn_delete.Visible = true;
            }
        }
Esempio n. 4
0
        private void btn_Login_Click(object sender, EventArgs e)
        {
            SqlConnection conn = new SqlConnection(CSTool.sqlConnString());
            SqlCommand    cmd  = new SqlCommand("SP_Login", conn);

            cmd.CommandType = CommandType.StoredProcedure;

            cmd.Parameters.AddWithValue("@uname", txt_loginID.Text);
            cmd.Parameters.AddWithValue("@pass", txt_loginPW.Text);

            conn.Open();

            var reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                CSVar.userLevel = (int)reader[0];

                if (CSVar.userLevel > 0)
                {
                    CSTool.infoMessage("Successfully logged in.");

                    if (CSULevel.User() || CSULevel.Support() || CSULevel.Admin())
                    {
                        CPanel CPWindow = new CPanel();
                        CPWindow.Show();

                        this.Hide();
                    }
                }
                else
                {
                    CSTool.errorMessage("Incorrect Username or password.");
                }
            }

            conn.Close();
        }