private void removeRequestsPopup(DBconnect db) { try { db.executionQuery("UPDATE studentrequests SET STATUSOFREQUEST = 'Allowed' WHERE STATUSOFREQUEST='R_Allowed' and STUDENTUSERNAME='******'"); db.executionQuery("UPDATE studentrequests SET STATUSOFREQUEST = 'Denied' WHERE STATUSOFREQUEST='R_Denied' and STUDENTUSERNAME='******'"); } catch (Exception) { } }
// 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); } } }
public Form_studentMenu() { InitializeComponent(); dbcon = new DBconnect(); updateGlobalMessage(); }