예제 #1
0
        private string getAccessGroup()
        {
            SqlCommand cmd = new SqlCommand();

            cmd.CommandType = CommandType.Text;
            cmd.Connection  = db.getConnection();
            if (username == null || username == "")
            {
                return("Enter username");
            }
            if (password == null || password == "")
            {
                return("Enter password");
            }
            cmd.CommandText = "SELECT accessgroup FROM USERS WHERE USERNAME = @username and PASS = @password";
            cmd.Parameters.AddWithValue("username", Username);
            cmd.Parameters.AddWithValue("password", password);

            try
            {
                DataSet ds = db.generalCommand(cmd);
                return(ds.Tables[0].Rows[0].ItemArray[0].ToString());
            }
            catch
            {
                return("Bad Username/Password!");
            }
        }
예제 #2
0
        // checks if there at least one students request that have status R_Allowed or R_denied, if there are new
        // responces found, rename them to Allowed or Denied
        private void studentRequestResponsed()
        {
            DBconnect db    = new DBconnect();
            string    query = "select COUNT(*) from StudentRequests  WHERE StudentUsername = '******' AND StatusOFRequest IN ('R_Allowed','R_Denied')";

            using (SqlCommand sqlCommand = new SqlCommand(query, db.getConnection()))
            {
                db.OpenConn();

                int userCount = (int)sqlCommand.ExecuteScalar();
                if (userCount > 0)
                {
                    MessageBox.Show("You received responce to one or more of your student request\nCheck them in \" Student requests -> My requests\"");
                    removeRequestsPopup(db);
                }
            }
        }