public void getValuesFromScheduler(scheduler sch) { this.schedule_ID = sch.schedule_ID; this.start_Time = sch.start_Time; this.end_Time = sch.end_Time; this.group_ID = sch.group_ID; this.group = sch.group; this.hall_ID = sch.hall_ID; this.hall = sch.hall; this.lush_ID = sch.lush_ID; this.lush = sch.lush; this.user_ID = sch.user_ID; this.username = sch.username; this.subject_ID = sch.subject_ID; this.subject = sch.subject; }
public static scheduler SubClosestToDate(string prof_ID) { string query = "SELECT * FROM scheduler sch WHERE start_time BETWEEN CURDATE() AND timestamp(DATE_ADD(NOW(), INTERVAL 30 MINUTE)) AND user_id='" + prof_ID + "' ORDER BY start_time DESC LIMIT 1"; scheduler sch = new scheduler(); MySqlConnection myConnection = new MySqlConnection(myConnectionString); MySqlCommand myCommand = (MySqlCommand)myConnection.CreateCommand(); myCommand.CommandText = query; try { myConnection.Open(); MySqlDataReader myReader = myCommand.ExecuteReader(); try { while (myReader.Read()) { sch.schedule_ID = myReader.GetInt32(0); sch.start_Time = myReader.GetDateTime(1); sch.end_Time = myReader.GetDateTime(2); sch.group_ID = myReader.GetInt32(3); sch.hall_ID = myReader.GetInt32(4); sch.lush_ID = myReader.GetInt32(5); sch.user_ID = myReader.GetInt32(6); sch.subject_ID = myReader.GetInt32(7); } //tbName.Add(new dbTablesIdName() { ID = myReader.GetInt32(0), Name = myReader.GetString(1) }); } finally { myReader.Close(); myConnection.Close(); } } catch (MySqlException ex) { MessageBox.Show("Për momentin lidhja dështoi. Provoni më vonë"); //MessageBox.Show(ex.Message); } GetFNamesFrmSched(sch, sch.schedule_ID); return(sch); }
/// <summary> /// /// </summary> /// <param name="idProf"></param> public EvidenceWindow(string idProf) { user_ID = idProf; eW = this; p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; InitializeComponent(); now = Methods.datetimeInMysql(); string query = "SELECT * FROM devicereg"; devices = Methods.getDevices(query); stopVirtualWifi(); string cmbFirstItem = "Zgjedhni Lenden..."; string getProfSubjectsQuery = "SELECT s.subject_id, s.subject FROM cps c INNER JOIN subjects s ON s.subject_id=c.subject_id INNER JOIN users u ON u.user_id=c.user_id WHERE c.user_id='" + idProf + "'"; //Methods.fillCombo(cmbSubjects, getProfSubjectsQuery, cmbFirstItem); sch = Methods.SubClosestToDate(user_ID); cmbSubjects.Items.Add(sch.subject); cmbLush.Items.Add(sch.lush); cmbGroups.Items.Add(sch.group); }
public static void GetFNamesFrmSched(scheduler sch, int schedule_id) { string query = "CALL getFNamesFrmSched('" + schedule_id + "');"; MySqlConnection myConnection = new MySqlConnection(myConnectionString); MySqlCommand myCommand = (MySqlCommand)myConnection.CreateCommand(); myCommand.CommandText = query; try { myConnection.Open(); MySqlDataReader myReader = myCommand.ExecuteReader(); try { while (myReader.Read()) { sch.group = myReader.GetString(0); sch.hall = myReader.GetString(1); sch.lush = myReader.GetString(2); sch.username = myReader.GetString(3); sch.subject = myReader.GetString(4); } //tbName.Add(new dbTablesIdName() { ID = myReader.GetInt32(0), Name = myReader.GetString(1) }); } finally { myReader.Close(); myConnection.Close(); } } catch (MySqlException ex) { MessageBox.Show("Për momentin lidhja dështoi. Provoni më vonë"); //MessageBox.Show(ex.Message); } }