/// <summary> /// ### FUTURE ### /// The expected/actual students list fires on doc.ready through event.js file /// might be that the 10 second div refresh isnt needed and we include a refresh button at the top of the list /// after an event closes (maybe midnight of that day) the event should be made historical and moved into a seperate table /// so that it can be reported on more accurately (against a hard event id) as opposed to datetime and room /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["id"] != null) { String eventid = Request.QueryString["id"]; Event ev1 = new Event(); ev1 = Event.LoadEvent(eventid); lblEvent.Text = ev1.Title; lblDate.Text = string.Format("{0:dd/MM/yyyy}", ev1.Start); lblTime.Text = string.Format("{0:HH:mm}", ev1.Start) + "-" + string.Format("{0:HH:mm}", ev1.End); btnRoom.Text = ev1.RoomName; btnLocation.Text = ev1.Location; lblSlot.Text = ev1.Slot; LoadQRCode(eventid, ev1.Room); chkShowImages.Checked = ev1.ShowImage; } }
public static Event LoadEvent(string slot) { SqlConnection sqlConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["AttendanceManagement"].ConnectionString); SqlCommand sqlCommand = default(SqlCommand); sqlCommand = new SqlCommand("uolsp_select_event", sqlConnection); sqlCommand.CommandType = CommandType.StoredProcedure; SqlDataAdapter myDataAdapter = new SqlDataAdapter(sqlCommand); SqlParameter p1 = new SqlParameter("@sSlotId", slot); sqlCommand.Parameters.Add(p1); Event event1 = new Event(); event1.Slot = slot; using (sqlConnection) { sqlConnection.Open(); SqlDataReader reader = sqlCommand.ExecuteReader(); if (reader.HasRows) { while (reader.Read()) { event1.Title = reader["vcTitle"].ToString(); event1.Location = reader["vcLocation"].ToString(); event1.Room = reader["vcRoom"].ToString(); event1.Start = (DateTime)reader["dtStart"]; event1.End = (DateTime)reader["dtEnd"]; event1.ShowImage = (Boolean)reader["bShowImage"]; event1.RoomName = reader["vcRoomName"].ToString(); } reader.Close(); } } return event1; }