protected void Page_Load(object sender, EventArgs e) { string RoomID = Request.Url.Query.ToString().Substring(1); Label2.Text = RoomID; System.Data.SqlClient.SqlConnection MyConnection; System.Data.SqlClient.SqlCommand MyCommand; System.Data.SqlClient.SqlDataReader MyDataReader; MyConnection = new System.Data.SqlClient.SqlConnection("Data Source=co-web-3.lboro.ac.uk;Initial Catalog=team17;User ID=team17;Password=g6g88fcv"); MyConnection.Open(); MyCommand = new System.Data.SqlClient.SqlCommand(); MyCommand.Connection = MyConnection; MyCommand.CommandText = "SELECT Capacity FROM Room WHERE RoomID = '" + RoomID + "' "; MyDataReader = MyCommand.ExecuteReader(); string nocap = ""; while (MyDataReader.Read()) { nocap = MyDataReader.GetSqlValue(0).ToString(); } MyDataReader.Close(); MyDataReader = null; Label3.Text = nocap; NoStudentsValidation.MaximumValue = nocap; NoStudentsValidation.ErrorMessage = "Number of Students must be between 1 and " + nocap + "."; }
protected void titles1() { System.Data.SqlClient.SqlConnection MyConnection; System.Data.SqlClient.SqlCommand MyCommand; System.Data.SqlClient.SqlDataReader MyDataReader; MyConnection = new System.Data.SqlClient.SqlConnection("Data Source=co-web-3.lboro.ac.uk;Initial Catalog=team17;User ID=team17;Password=g6g88fcv"); MyConnection.Open(); MyCommand = new System.Data.SqlClient.SqlCommand(); MyCommand.Connection = MyConnection; MyCommand.CommandText = "SELECT RequestID FROM Request WHERE (Status = 'Pending') AND (UserID = '" + Session["login_name"] + "') AND (RoundID IN (SELECT RoundID From Round WHERE (SemesterID = '" + DropDownList1.SelectedValue + "')))"; MyDataReader = MyCommand.ExecuteReader(); while (MyDataReader.Read()) { if (MyDataReader.GetSqlValue(0).ToString() == "Null") { Label2.Visible = false; } else { Label2.Visible = true; } } MyDataReader.Close(); MyDataReader = null; MyCommand.CommandText = "SELECT RequestID FROM Request WHERE (Status = 'Allocated') AND (UserID = '" + Session["login_name"] + "') AND (RoundID IN (SELECT RoundID From Round WHERE (SemesterID = '" + DropDownList1.SelectedValue + "')))"; MyDataReader = MyCommand.ExecuteReader(); while (MyDataReader.Read()) { if (MyDataReader.GetSqlValue(0).ToString() == "Null") { Label1.Visible = false; } else { Label1.Visible = true; } } MyDataReader.Close(); MyDataReader = null; MyCommand.CommandText = "SELECT RequestID FROM Request WHERE (Status = 'Denied') AND (UserID = '" + Session["login_name"] + "') AND (RoundID IN (SELECT RoundID From Round WHERE (SemesterID = '" + DropDownList1.SelectedValue + "')))"; MyDataReader = MyCommand.ExecuteReader(); while (MyDataReader.Read()) { if (MyDataReader.GetSqlValue(0).ToString() == "Null") { Label3.Visible = false; } else { Label3.Visible = true; } } MyDataReader.Close(); MyDataReader = null; }
protected void chooserooms(string RequestID) { System.Data.SqlClient.SqlConnection MyConnection; System.Data.SqlClient.SqlCommand MyCommand; System.Data.SqlClient.SqlDataReader MyDataReader; MyConnection = new System.Data.SqlClient.SqlConnection("Data Source=co-web-3.lboro.ac.uk;Initial Catalog=team17;User ID=team17;Password=g6g88fcv"); MyConnection.Open(); MyCommand = new System.Data.SqlClient.SqlCommand(); MyCommand.Connection = MyConnection; MyCommand.CommandText = "SELECT RoomID FROM RequestRoom WHERE (RequestID = " + RequestID + ")"; MyDataReader = MyCommand.ExecuteReader(); int p = 1; while (MyDataReader.Read()) { if (p == 1) { RoomBox1.SelectedValue = MyDataReader.GetSqlValue(0).ToString(); } if (p == 2) { RoomBox2.SelectedValue = MyDataReader.GetSqlValue(0).ToString(); } if (p == 3) { RoomBox3.SelectedValue = MyDataReader.GetSqlValue(0).ToString(); } if (p == 4) { RoomBox4.SelectedValue = MyDataReader.GetSqlValue(0).ToString(); } p++; } MyDataReader.Close(); MyDataReader = null; }
protected void DropDownList3_DataBound(object sender, EventArgs e) { string RequestID = Request.Url.Query.ToString().Substring(1); string RoundID = ""; System.Data.SqlClient.SqlConnection MyConnection; System.Data.SqlClient.SqlCommand MyCommand; System.Data.SqlClient.SqlDataReader MyDataReader; MyConnection = new System.Data.SqlClient.SqlConnection("Data Source=co-web-3.lboro.ac.uk;Initial Catalog=team17;User ID=team17;Password=g6g88fcv"); MyConnection.Open(); MyCommand = new System.Data.SqlClient.SqlCommand(); MyCommand.Connection = MyConnection; MyCommand.CommandText = "SELECT ModuleID,RoundID FROM Request WHERE (RequestID = " + RequestID + ")"; MyDataReader = MyCommand.ExecuteReader(); while (MyDataReader.Read()) { ModuleID = MyDataReader.GetSqlValue(0).ToString(); RoundID = MyDataReader.GetSqlValue(1).ToString(); } MyDataReader.Close(); MyDataReader = null; DropDownList3.SelectedValue = RoundID; rounddec(); }
protected void buildTable() { for (int p = 2; p < 7; p++) { for (int q = 1; q < 10; q++) { Table2.Rows[p].Cells[q].Text = ""; Table2.Rows[p].Cells[q].BackColor = System.Drawing.Color.White; } } System.Data.SqlClient.SqlConnection MyConnection; System.Data.SqlClient.SqlCommand MyCommand; System.Data.SqlClient.SqlDataReader MyDataReader; MyConnection = new System.Data.SqlClient.SqlConnection("Data Source=co-web-3.lboro.ac.uk;Initial Catalog=team17;User ID=team17;Password=g6g88fcv"); MyConnection.Open(); MyCommand = new System.Data.SqlClient.SqlCommand(); MyCommand.Connection = MyConnection; if (RadioButtonList2.SelectedValue == "Allocated" || RadioButtonList2.SelectedValue == "Both") { string Command1 = ""; if (DropDownWeeks0.SelectedValue == "All1") { Command1 = "SELECT DISTINCT RequestTime.TimeID, Request.RequestID, Request.ModuleID FROM RequestTime INNER JOIN Request ON RequestTime.RequestID = Request.RequestID WHERE (RequestTime.Week < 13) AND (RequestTime.RequestID IN(SELECT RequestID FROM Request WHERE (UserID = '" + Session["login_name"] + "') AND (Status = 'Allocated') AND (RoundID IN(SELECT RoundID FROM Round WHERE (SemesterID = '" + DropDownList1.SelectedValue + "')))))"; } if (DropDownWeeks0.SelectedValue == "All2") { Command1 = "SELECT DISTINCT RequestTime.TimeID, Request.RequestID, Request.ModuleID FROM RequestTime INNER JOIN Request ON RequestTime.RequestID = Request.RequestID WHERE (RequestTime.RequestID IN(SELECT RequestID FROM Request WHERE (UserID = '" + Session["login_name"] + "') AND (Status = 'Allocated') AND (RoundID IN(SELECT RoundID FROM Round WHERE (SemesterID = '" + DropDownList1.SelectedValue + "')))))"; } if (DropDownWeeks0.SelectedValue != "All1" && DropDownWeeks0.SelectedValue != "All2") { Command1 = "SELECT DISTINCT RequestTime.TimeID, Request.RequestID, Request.ModuleID FROM RequestTime INNER JOIN Request ON RequestTime.RequestID = Request.RequestID WHERE (RequestTime.Week = " + DropDownWeeks0.SelectedValue + ") AND (RequestTime.RequestID IN(SELECT RequestID FROM Request WHERE (UserID = '" + Session["login_name"] + "') AND (Status = 'Allocated') AND (RoundID IN(SELECT RoundID FROM Round WHERE (SemesterID = '" + DropDownList1.SelectedValue + "')))))"; } MyCommand.CommandText = Command1; MyDataReader = MyCommand.ExecuteReader(); while (MyDataReader.Read()) { for (int a = 0; a < 45; a++) { if (MyDataReader.GetSqlValue(0).ToString() == a.ToString()) { if (a < 9) { Table2.Rows[2].Cells[a + 1].BackColor = System.Drawing.ColorTranslator.FromHtml("#EBEBEB"); Table2.Rows[2].Cells[a + 1].Text += "<span style='color:Green'><b>ID</b> - " + MyDataReader.GetSqlValue(1).ToString() + ", <b>Mod</b> - "; Table2.Rows[2].Cells[a + 1].Text += MyDataReader.GetSqlValue(2).ToString(); Table2.Rows[2].Cells[a + 1].Text += "<a href='view.aspx?" + MyDataReader.GetSqlValue(1).ToString() + "'>(View)</a><br /></span>"; } if (a > 8 && a < 18) { int b = (a - 9); Table2.Rows[3].Cells[b + 1].BackColor = System.Drawing.ColorTranslator.FromHtml("#EBEBEB"); Table2.Rows[3].Cells[b + 1].Text += "<span style='color:Green'><b>ID</b> - " + MyDataReader.GetSqlValue(1).ToString() + ", <b>Mod</b> - "; Table2.Rows[3].Cells[b + 1].Text += MyDataReader.GetSqlValue(2).ToString(); Table2.Rows[3].Cells[b + 1].Text += "<a href='view.aspx?" + MyDataReader.GetSqlValue(1).ToString() + "'>(View)</a><br /></span>"; } if (a > 17 && a < 27) { int b = (a - 18); Table2.Rows[4].Cells[b + 1].BackColor = System.Drawing.ColorTranslator.FromHtml("#EBEBEB"); Table2.Rows[4].Cells[b + 1].Text += "<span style='color:Green'><b>ID</b> - " + MyDataReader.GetSqlValue(1).ToString() + ", <b>Mod</b> - "; Table2.Rows[4].Cells[b + 1].Text += MyDataReader.GetSqlValue(2).ToString(); Table2.Rows[4].Cells[b + 1].Text += "<a href='view.aspx?" + MyDataReader.GetSqlValue(1).ToString() + "'>(View)</a><br /></span>"; } if (a > 26 && a < 36) { int b = (a - 27); Table2.Rows[5].Cells[b + 1].BackColor = System.Drawing.ColorTranslator.FromHtml("#EBEBEB"); Table2.Rows[5].Cells[b + 1].Text += "<span style='color:Green'><b>ID</b> - " + MyDataReader.GetSqlValue(1).ToString() + ", <b>Mod</b> - "; Table2.Rows[5].Cells[b + 1].Text += MyDataReader.GetSqlValue(2).ToString(); Table2.Rows[5].Cells[b + 1].Text += "<a href='view.aspx?" + MyDataReader.GetSqlValue(1).ToString() + "'>(View)</a><br /></span>"; } if (a > 35 && a < 45) { int b = (a - 36); Table2.Rows[6].Cells[b + 1].BackColor = System.Drawing.ColorTranslator.FromHtml("#EBEBEB"); Table2.Rows[6].Cells[b + 1].Text += "<span style='color:Green'><b>ID</b> - " + MyDataReader.GetSqlValue(1).ToString() + ", <b>Mod</b> - "; Table2.Rows[6].Cells[b + 1].Text += MyDataReader.GetSqlValue(2).ToString(); Table2.Rows[6].Cells[b + 1].Text += "<a href='view.aspx?" + MyDataReader.GetSqlValue(1).ToString() + "'>(View)</a><br /></span>"; } } } } MyDataReader.Close(); MyDataReader = null; } if (RadioButtonList2.SelectedValue == "Pending" || RadioButtonList2.SelectedValue == "Both") { string Command1 = ""; if (DropDownWeeks0.SelectedValue == "All1") { Command1 = "SELECT DISTINCT RequestTime.TimeID, Request.RequestID, Request.ModuleID FROM RequestTime INNER JOIN Request ON RequestTime.RequestID = Request.RequestID WHERE (RequestTime.Week < 13) AND (RequestTime.RequestID IN(SELECT RequestID FROM Request WHERE (UserID = '" + Session["login_name"] + "') AND (Status = 'Pending') AND (RoundID IN(SELECT RoundID FROM Round WHERE (SemesterID = '" + DropDownList1.SelectedValue + "')))))"; } if (DropDownWeeks0.SelectedValue == "All2") { Command1 = "SELECT DISTINCT RequestTime.TimeID, Request.RequestID, Request.ModuleID FROM RequestTime INNER JOIN Request ON RequestTime.RequestID = Request.RequestID WHERE (RequestTime.RequestID IN(SELECT RequestID FROM Request WHERE (UserID = '" + Session["login_name"] + "') AND (Status = 'Pending') AND (RoundID IN(SELECT RoundID FROM Round WHERE (SemesterID = '" + DropDownList1.SelectedValue + "')))))"; } if (DropDownWeeks0.SelectedValue != "All1" && DropDownWeeks0.SelectedValue != "All2") { Command1 = "SELECT DISTINCT RequestTime.TimeID, Request.RequestID, Request.ModuleID FROM RequestTime INNER JOIN Request ON RequestTime.RequestID = Request.RequestID WHERE (RequestTime.Week = " + DropDownWeeks0.SelectedValue + ") AND (RequestTime.RequestID IN(SELECT RequestID FROM Request WHERE (UserID = '" + Session["login_name"] + "') AND (Status = 'Pending') AND (RoundID IN(SELECT RoundID FROM Round WHERE (SemesterID = '" + DropDownList1.SelectedValue + "')))))"; } MyCommand.CommandText = Command1; MyDataReader = MyCommand.ExecuteReader(); while (MyDataReader.Read()) { for (int a = 0; a < 45; a++) { if (MyDataReader.GetSqlValue(0).ToString() == a.ToString()) { if (a < 9) { Table2.Rows[2].Cells[a + 1].BackColor = System.Drawing.ColorTranslator.FromHtml("#EBEBEB"); Table2.Rows[2].Cells[a + 1].Text += "<span style='color:Orange'><b>ID</b> - " + MyDataReader.GetSqlValue(1).ToString() + ", <b>Mod</b> - "; Table2.Rows[2].Cells[a + 1].Text += MyDataReader.GetSqlValue(2).ToString(); Table2.Rows[2].Cells[a + 1].Text += "<a href='view.aspx?" + MyDataReader.GetSqlValue(1).ToString() + "'>(View)</a><br /></span>"; } if (a > 8 && a < 18) { int b = (a - 9); Table2.Rows[3].Cells[b + 1].BackColor = System.Drawing.ColorTranslator.FromHtml("#EBEBEB"); Table2.Rows[3].Cells[b + 1].Text += "<span style='color:Orange'><b>ID</b> - " + MyDataReader.GetSqlValue(1).ToString() + ", <b>Mod</b> - "; Table2.Rows[3].Cells[b + 1].Text += MyDataReader.GetSqlValue(2).ToString(); Table2.Rows[3].Cells[b + 1].Text += "<a href='view.aspx?" + MyDataReader.GetSqlValue(1).ToString() + "'>(View)</a><br /></span>"; } if (a > 17 && a < 27) { int b = (a - 18); Table2.Rows[4].Cells[b + 1].BackColor = System.Drawing.ColorTranslator.FromHtml("#EBEBEB"); Table2.Rows[4].Cells[b + 1].Text += "<span style='color:Orange'><b>ID</b> - " + MyDataReader.GetSqlValue(1).ToString() + ", <b>Mod</b> - "; Table2.Rows[4].Cells[b + 1].Text += MyDataReader.GetSqlValue(2).ToString(); Table2.Rows[4].Cells[b + 1].Text += "<a href='view.aspx?" + MyDataReader.GetSqlValue(1).ToString() + "'>(View)</a><br /></span>"; } if (a > 26 && a < 36) { int b = (a - 27); Table2.Rows[5].Cells[b + 1].BackColor = System.Drawing.ColorTranslator.FromHtml("#EBEBEB"); Table2.Rows[5].Cells[b + 1].Text += "<span style='color:Orange'><b>ID</b> - " + MyDataReader.GetSqlValue(1).ToString() + ", <b>Mod</b> - "; Table2.Rows[5].Cells[b + 1].Text += MyDataReader.GetSqlValue(2).ToString(); Table2.Rows[5].Cells[b + 1].Text += "<a href='view.aspx?" + MyDataReader.GetSqlValue(1).ToString() + "'>(View)</a><br /></span>"; } if (a > 35 && a < 45) { int b = (a - 36); Table2.Rows[6].Cells[b + 1].BackColor = System.Drawing.ColorTranslator.FromHtml("#EBEBEB"); Table2.Rows[6].Cells[b + 1].Text += "<span style='color:Orange'><b>ID</b> - " + MyDataReader.GetSqlValue(1).ToString() + ", <b>Mod</b> - "; Table2.Rows[6].Cells[b + 1].Text += MyDataReader.GetSqlValue(2).ToString(); Table2.Rows[6].Cells[b + 1].Text += "<a href='view.aspx?" + MyDataReader.GetSqlValue(1).ToString() + "'>(View)</a><br /></span>"; } } } } MyDataReader.Close(); MyDataReader = null; } }
protected void ListBox4_SelectedIndexChanged(object sender, EventArgs e) { InfoPanel.Visible = true; string BuildingID = ""; string RoomID = ListBoxRooms.SelectedItem.Text; System.Data.SqlClient.SqlConnection MyConnection; System.Data.SqlClient.SqlCommand MyCommand; System.Data.SqlClient.SqlDataReader MyDataReader; MyConnection = new System.Data.SqlClient.SqlConnection("Data Source=co-web-3.lboro.ac.uk;Initial Catalog=team17;User ID=team17;Password=g6g88fcv"); MyConnection.Open(); MyCommand = new System.Data.SqlClient.SqlCommand(); MyCommand.Connection = MyConnection; MyCommand.CommandText = "SELECT * FROM Room WHERE (RoomID = '" + RoomID + "')"; MyDataReader = MyCommand.ExecuteReader(); while (MyDataReader.Read()) { Label8.Text = MyDataReader.GetSqlValue(0).ToString(); BuildingID = MyDataReader.GetSqlValue(1).ToString(); Label11.Text = MyDataReader.GetSqlValue(2).ToString(); ImageRoom.ImageUrl = "http://www.lboro.ac.uk/service/fm/services/ts/roompics/" + MyDataReader.GetSqlValue(3).ToString(); } MyDataReader.Close(); MyDataReader = null; MyCommand.CommandText = "SELECT * FROM Building WHERE (BuildingID = '" + BuildingID + "')"; MyDataReader = MyCommand.ExecuteReader(); while (MyDataReader.Read()) { Label9.Text = MyDataReader.GetSqlValue(0).ToString(); Label10.Text = MyDataReader.GetSqlValue(2).ToString(); } MyDataReader.Close(); MyDataReader = null; MyCommand.CommandText = "SELECT * FROM RoomFacility WHERE (RoomID = '" + RoomID + "')"; MyDataReader = MyCommand.ExecuteReader(); ArrayList facList = new ArrayList(); while (MyDataReader.Read()) { facList.Add(MyDataReader.GetSqlValue(1).ToString()); } MyDataReader.Close(); MyDataReader = null; int count = 0; BulletedListFacilities.Items.Clear(); foreach (string i in facList) { MyCommand.CommandText = "SELECT * FROM Facility WHERE (FacilityID = '" + i + "')"; MyDataReader = MyCommand.ExecuteReader(); while (MyDataReader.Read()) { if (count == 0) { Label12.Text = MyDataReader.GetSqlValue(1).ToString(); } if (count == 1) { Label13.Text = MyDataReader.GetSqlValue(1).ToString(); } if (count > 1) { BulletedListFacilities.Items.Add(MyDataReader.GetSqlValue(1).ToString()); } } MyDataReader.Close(); MyDataReader = null; count = count + 1; } MyCommand = null; MyConnection.Close(); MyConnection = null; buildTable(); }
protected void buildTable() { for (int p = 2; p < 7; p++) { for (int q = 1; q < 10; q++) { Table1.Rows[p].Cells[q].BackColor = System.Drawing.Color.White; } } string RoomID = ListBoxRooms.SelectedItem.Text; System.Data.SqlClient.SqlConnection MyConnection; System.Data.SqlClient.SqlCommand MyCommand; System.Data.SqlClient.SqlDataReader MyDataReader; MyConnection = new System.Data.SqlClient.SqlConnection("Data Source=co-web-3.lboro.ac.uk;Initial Catalog=team17;User ID=team17;Password=g6g88fcv"); MyConnection.Open(); MyCommand = new System.Data.SqlClient.SqlCommand(); MyCommand.Connection = MyConnection; string Command1 = ""; if (DropDownWeeks0.SelectedValue == "All1") { Command1 = "SELECT DISTINCT TimeID, RequestID FROM RequestTime WHERE (Week < 13) AND (RequestID IN(SELECT RequestID FROM Request WHERE (Status = 'Allocated') AND (RoundID IN(SELECT RoundID FROM Round WHERE (SemesterID = '" + DropDownList1.SelectedValue + "'))))) AND RequestID IN(SELECT RequestID FROM RequestRoom WHERE RoomID = '" + ListBoxRooms.SelectedValue + "')"; } if (DropDownWeeks0.SelectedValue == "All2") { Command1 = "SELECT DISTINCT TimeID, RequestID FROM RequestTime WHERE (RequestID IN(SELECT RequestID FROM Request WHERE (RequestID IN(SELECT RequestID FROM Request WHERE (Status = 'Allocated') AND (RoundID IN(SELECT RoundID FROM Round WHERE (SemesterID = '" + DropDownList1.SelectedValue + "'))))))) AND RequestID IN(SELECT RequestID FROM RequestRoom WHERE RoomID = '" + ListBoxRooms.SelectedValue + "')"; } if (DropDownWeeks0.SelectedValue != "All1" && DropDownWeeks0.SelectedValue != "All2") { Command1 = "SELECT DISTINCT TimeID, RequestID FROM RequestTime WHERE (Week=" + DropDownWeeks0.SelectedValue + ") AND (RequestID IN(SELECT RequestID FROM Request WHERE (Week = " + DropDownWeeks0.SelectedValue + ") AND (RequestTime.RequestID IN(SELECT RequestID FROM Request WHERE (Status = 'Allocated') AND (RoundID IN(SELECT RoundID FROM Round WHERE (SemesterID = '" + DropDownList1.SelectedValue + "'))))))) AND RequestID IN(SELECT RequestID FROM RequestRoom WHERE RoomID = '" + ListBoxRooms.SelectedValue + "')"; } MyCommand.CommandText = Command1; MyDataReader = MyCommand.ExecuteReader(); while (MyDataReader.Read()) { for (int a = 0; a < 45; a++) { if (MyDataReader.GetSqlValue(0).ToString() == a.ToString()) { if (a < 9) { Table1.Rows[2].Cells[a + 1].BackColor = System.Drawing.Color.Red; } if (a > 8 && a < 18) { int b = (a - 9); Table1.Rows[3].Cells[b + 1].BackColor = System.Drawing.Color.Red; } if (a > 17 && a < 27) { int b = (a - 18); Table1.Rows[4].Cells[b + 1].BackColor = System.Drawing.Color.Red; } if (a > 26 && a < 36) { int b = (a - 27); Table1.Rows[5].Cells[b + 1].BackColor = System.Drawing.Color.Red; } if (a > 35 && a < 45) { int b = (a - 36); Table1.Rows[6].Cells[b + 1].BackColor = System.Drawing.Color.Red; } } } } MyDataReader.Close(); MyDataReader = null; }
protected void rounddec() { System.Data.SqlClient.SqlConnection MyConnection; System.Data.SqlClient.SqlCommand MyCommand; System.Data.SqlClient.SqlDataReader MyDataReader; MyConnection = new System.Data.SqlClient.SqlConnection("Data Source=co-web-3.lboro.ac.uk;Initial Catalog=team17;User ID=team17;Password=g6g88fcv"); MyConnection.Open(); MyCommand = new System.Data.SqlClient.SqlCommand(); MyCommand.Connection = MyConnection; MyCommand.CommandText = "SELECT Round FROM Round WHERE (RoundID = '" + DropDownList3.SelectedValue + "')"; MyDataReader = MyCommand.ExecuteReader(); string roundname = ""; while (MyDataReader.Read()) { roundname = MyDataReader.GetSqlValue(0).ToString(); } MyDataReader.Close(); MyDataReader = null; if (roundname == "Ad hoc") { Label2.Text = "You are booking in Ad hoc mode, your request will be instantly allocated"; Button1.Text = "Submit Instant Request"; RadioButtonList2.Visible = false; RadioButtonList2.Items[1].Selected = true; CheckBoxList1.Enabled = true; CheckBoxList1.Items[0].Enabled = false; CheckBoxList1.Items[0].Selected = false; CheckBoxList1.Items[1].Enabled = false; CheckBoxList1.Items[1].Selected = false; CheckBoxList1.Items[2].Enabled = false; CheckBoxList1.Items[2].Selected = false; CheckBoxList1.Items[3].Enabled = false; CheckBoxList1.Items[3].Selected = false; CheckBoxList1.Items[4].Enabled = false; CheckBoxList1.Items[4].Selected = false; CheckBoxList1.Items[5].Enabled = false; CheckBoxList1.Items[5].Selected = false; CheckBoxList1.Items[6].Enabled = false; CheckBoxList1.Items[6].Selected = false; CheckBoxList1.Items[7].Enabled = false; CheckBoxList1.Items[7].Selected = false; CheckBoxList1.Items[8].Enabled = false; CheckBoxList1.Items[8].Selected = false; CheckBoxList1.Items[9].Enabled = false; CheckBoxList1.Items[9].Selected = false; CheckBoxList1.Items[10].Selected = false; CheckBoxList1.Items[11].Selected = false; CheckBoxList1.Items[12].Selected = false; } else { RadioButtonList2.Visible = true; CheckBoxList1.Enabled = false; CheckBoxList1.Items[0].Enabled = true; CheckBoxList1.Items[1].Enabled = true; CheckBoxList1.Items[2].Enabled = true; CheckBoxList1.Items[3].Enabled = true; CheckBoxList1.Items[4].Enabled = true; CheckBoxList1.Items[5].Enabled = true; CheckBoxList1.Items[6].Enabled = true; CheckBoxList1.Items[7].Enabled = true; CheckBoxList1.Items[8].Enabled = true; CheckBoxList1.Items[9].Enabled = true; RadioButtonList2.SelectedValue = "All"; CheckBoxList1.Items[0].Selected = true; CheckBoxList1.Items[1].Selected = true; CheckBoxList1.Items[2].Selected = true; CheckBoxList1.Items[3].Selected = true; CheckBoxList1.Items[4].Selected = true; CheckBoxList1.Items[5].Selected = true; CheckBoxList1.Items[6].Selected = true; CheckBoxList1.Items[7].Selected = true; CheckBoxList1.Items[8].Selected = true; CheckBoxList1.Items[9].Selected = true; CheckBoxList1.Items[10].Selected = true; CheckBoxList1.Items[11].Selected = false; CheckBoxList1.Items[12].Selected = false; CheckBoxList1.Items[13].Selected = false; CheckBoxList1.Items[14].Selected = false; Label2.Text = ""; Button1.Text = "Submit Request"; } }
protected void startup() { string RequestID = Request.Url.Query.ToString().Substring(1); string ModuleID = ""; string NoStudents = ""; string NoRooms = ""; string RoundID = ""; string ParkOnly = ""; string BuildingID = ""; System.Data.SqlClient.SqlConnection MyConnection; System.Data.SqlClient.SqlCommand MyCommand; System.Data.SqlClient.SqlDataReader MyDataReader; MyConnection = new System.Data.SqlClient.SqlConnection("Data Source=co-web-3.lboro.ac.uk;Initial Catalog=team17;User ID=team17;Password=g6g88fcv"); MyConnection.Open(); MyCommand = new System.Data.SqlClient.SqlCommand(); MyCommand.Connection = MyConnection; MyCommand.CommandText = "SELECT ModuleID,NoStudents,NoRooms,RoundID,ParkOnly,BuildingID,Notes FROM Request WHERE (RequestID = " + RequestID + ")"; MyDataReader = MyCommand.ExecuteReader(); while (MyDataReader.Read()) { ModuleID = MyDataReader.GetSqlValue(0).ToString(); NoStudents = MyDataReader.GetSqlValue(1).ToString(); NoRooms = MyDataReader.GetSqlValue(2).ToString(); RoundID = MyDataReader.GetSqlValue(3).ToString(); ParkOnly = MyDataReader.GetSqlValue(4).ToString(); BuildingID = MyDataReader.GetSqlValue(5).ToString(); Label1.Text = MyDataReader.GetSqlValue(6).ToString(); } MyDataReader.Close(); MyDataReader = null; ListBoxModCodes.SelectedValue = ModuleID; ListBoxModNames.SelectedValue = ModuleID; TextBoxStudents.Text = NoStudents; DropDownList2.SelectedValue = NoRooms; DropDownList3.SelectedValue = RoundID; if (ParkOnly != "Null") { DropDownListPark.SelectedValue = ParkOnly; } if (BuildingID != "Null") { DropDownList4.SelectedValue = BuildingID; } MyCommand.CommandText = "SELECT FacilityID FROM RequestFacility WHERE (RequestID = " + RequestID + ") AND (FacilityID >5)"; MyDataReader = MyCommand.ExecuteReader(); while (MyDataReader.Read()) { CheckBoxListFacilities.Items.FindByValue(MyDataReader.GetSqlValue(0).ToString()).Selected = true; } MyDataReader.Close(); MyDataReader = null; MyCommand.CommandText = "SELECT FacilityID FROM RequestFacility WHERE (RequestID = " + RequestID + ") AND (FacilityID <5)"; MyDataReader = MyCommand.ExecuteReader(); while (MyDataReader.Read()) { if (MyDataReader.GetSqlValue(0).ToString() == "0") { DropDownListRoomType.SelectedIndex = 0; } if (MyDataReader.GetSqlValue(0).ToString() == "1") { DropDownListRoomType.SelectedIndex = 1; } if (MyDataReader.GetSqlValue(0).ToString() == "2") { DropDownListRoomType.SelectedIndex = 2; } if (MyDataReader.GetSqlValue(0).ToString() == "3") { DropDownListRoomStyle.SelectedIndex = 0; } if (MyDataReader.GetSqlValue(0).ToString() == "4") { DropDownListRoomStyle.SelectedIndex = 1; } } MyDataReader.Close(); MyDataReader = null; string allweeks = "no"; MyCommand.CommandText = "SELECT TimeID,Week FROM RequestTime WHERE (RequestID = " + RequestID + ")"; MyDataReader = MyCommand.ExecuteReader(); while (MyDataReader.Read()) { for (int a = 0; a < 45; a++) { if (MyDataReader.GetSqlValue(0).ToString() == a.ToString()) { CheckBoxList2.Items[a].Selected = true; } if (MyDataReader.GetSqlValue(0).ToString() == "20" && allweeks == "no") { allweeks = "yes"; } } } if (allweeks == "yes") { RadioButtonList2.SelectedValue = "All"; CheckBoxList1.Enabled = false; CheckBoxList1.Items[0].Selected = true; CheckBoxList1.Items[1].Selected = true; CheckBoxList1.Items[2].Selected = true; CheckBoxList1.Items[3].Selected = true; CheckBoxList1.Items[4].Selected = true; CheckBoxList1.Items[5].Selected = true; CheckBoxList1.Items[6].Selected = true; CheckBoxList1.Items[7].Selected = true; CheckBoxList1.Items[8].Selected = true; CheckBoxList1.Items[9].Selected = true; CheckBoxList1.Items[10].Selected = true; CheckBoxList1.Items[11].Selected = true; CheckBoxList1.Items[12].Selected = false; CheckBoxList1.Items[13].Selected = false; CheckBoxList1.Items[14].Selected = false; } MyDataReader.Close(); MyDataReader = null; roomSQL(RequestID); rounddec(); }
protected void Button1_Click(object sender, EventArgs e) { string reqID1 = Request.Url.Query.ToString().Substring(1); string delete = "DELETE FROM RequestFacility WHERE (RequestID = " + reqID1 + ")"; InsertNewBooking.DeleteCommand = delete; InsertNewBooking.Delete(); delete = "DELETE FROM RequestTime WHERE (RequestID = " + reqID1 + ")"; InsertNewBooking.DeleteCommand = delete; InsertNewBooking.Delete(); delete = "DELETE FROM RequestRoom WHERE (RequestID = " + reqID1 + ")"; InsertNewBooking.DeleteCommand = delete; InsertNewBooking.Delete(); delete = "DELETE FROM Request WHERE (RequestID = " + reqID1 + ")"; InsertNewBooking.DeleteCommand = delete; InsertNewBooking.Delete(); string status = ""; if (Button1.Text == "Submit Instant Request") { status = "Allocated"; } if (Button1.Text == "Submit Request") { status = "Pending"; } string insertstring = "INSERT INTO Request (ModuleID, RoundID, UserID, NoStudents, Status, ParkOnly, BuildingID, NoRooms) VALUES('" + ListBoxModCodes.SelectedItem.Text + "'," + DropDownList3.SelectedValue + ",@UserID," + TextBoxStudents.Text + ",'" + status + "',"; if (DropDownListPark.SelectedItem.Text == "All" || RoomBox1.SelectedIndex != -1) { insertstring += "null,"; } else { insertstring += "'" + DropDownListPark.SelectedItem.Text + "',"; } if (DropDownList4.SelectedItem.Text == "All" || RoomBox1.SelectedIndex != -1) { insertstring += "null,"; } else { insertstring += "'" + DropDownList4.SelectedValue + "',"; } insertstring += " " + DropDownList2.SelectedValue + ")"; InsertNewBooking.InsertCommand = insertstring; InsertNewBooking.Insert(); System.Data.SqlClient.SqlConnection MyConnection; System.Data.SqlClient.SqlCommand MyCommand; System.Data.SqlClient.SqlDataReader MyDataReader; MyConnection = new System.Data.SqlClient.SqlConnection("Data Source=co-web-3.lboro.ac.uk;Initial Catalog=team17;User ID=team17;Password=g6g88fcv"); MyConnection.Open(); MyCommand = new System.Data.SqlClient.SqlCommand(); MyCommand.Connection = MyConnection; MyCommand.CommandText = "SELECT RequestID FROM REQUEST"; MyDataReader = MyCommand.ExecuteReader(); string reqID = ""; while (MyDataReader.Read()) { reqID = MyDataReader.GetSqlValue(0).ToString(); } MyDataReader.Close(); MyDataReader = null; for (int d = 0; d <= DropDownList2.SelectedIndex; d++) { if (d == 0 && RoomBox1.SelectedIndex != -1) { MyCommand.CommandText = "INSERT INTO RequestRoom (RequestID, RoomID) VALUES('" + reqID + "', '" + RoomBox1.SelectedValue + "')"; MyDataReader = MyCommand.ExecuteReader(); MyDataReader.Close(); MyDataReader = null; } if (d == 1 && RoomBox2.SelectedIndex != -1) { MyCommand.CommandText = "INSERT INTO RequestRoom (RequestID, RoomID) VALUES('" + reqID + "', '" + RoomBox2.SelectedValue + "')"; MyDataReader = MyCommand.ExecuteReader(); MyDataReader.Close(); MyDataReader = null; } if (d == 2 && RoomBox3.SelectedIndex != -1) { MyCommand.CommandText = "INSERT INTO RequestRoom (RequestID, RoomID) VALUES('" + reqID + "', '" + RoomBox3.SelectedValue + "')"; MyDataReader = MyCommand.ExecuteReader(); MyDataReader.Close(); MyDataReader = null; } if (d == 3 && RoomBox4.SelectedIndex != -1) { MyCommand.CommandText = "INSERT INTO RequestRoom (RequestID, RoomID) VALUES('" + reqID + "', '" + RoomBox4.SelectedValue + "')"; MyDataReader = MyCommand.ExecuteReader(); MyDataReader.Close(); MyDataReader = null; } } if (DropDownListRoomType.SelectedValue != "All") { MyCommand.CommandText = "INSERT INTO RequestFacility (RequestID, FacilityID) VALUES(" + reqID + ", " + DropDownListRoomType.SelectedValue + ") "; MyDataReader = MyCommand.ExecuteReader(); MyDataReader.Close(); MyDataReader = null; } if (DropDownListRoomStyle.SelectedValue != "All") { MyCommand.CommandText = "INSERT INTO RequestFacility (RequestID, FacilityID) VALUES(" + reqID + ", " + (DropDownListRoomStyle.SelectedValue + 3) + ") "; MyDataReader = MyCommand.ExecuteReader(); MyDataReader.Close(); MyDataReader = null; } int noFacilities = CheckBoxListFacilities.Items.Count; for (int x = 0; x < noFacilities; x++) { if (CheckBoxListFacilities.Items[x].Selected == true) { MyCommand.CommandText = "INSERT INTO RequestFacility (RequestID, FacilityID) VALUES(" + reqID + ", " + (x + 5) + ") "; MyDataReader = MyCommand.ExecuteReader(); MyDataReader.Close(); MyDataReader = null; } } for (int z = 0; z < CheckBoxList1.Items.Count; z++) { if (CheckBoxList1.Items[z].Selected == true) { for (int b = 0; b < CheckBoxList2.Items.Count; b++) { if (CheckBoxList2.Items[b].Selected == true) { MyCommand.CommandText = "INSERT INTO RequestTime (RequestID, Week, TimeID) VALUES(" + reqID + ", " + (z + 1) + ", " + b + ") "; MyDataReader = MyCommand.ExecuteReader(); MyDataReader.Close(); MyDataReader = null; } } } } MyCommand = null; MyConnection.Close(); MyConnection = null; Response.Redirect("~/Secure/booked.aspx?" + reqID); }
protected void Button1_Click(object sender, EventArgs e) { string status = ""; if (Button1.Text == "Submit Instant Request") { status = "Allocated"; } if (Button1.Text == "Submit Request") { status = "Pending"; } string insertstring = "INSERT INTO Request (ModuleID, RoundID, UserID, NoStudents, Status, NoRooms) VALUES('" + ListBoxModCodes.SelectedItem.Text + "'," + DropDownList3.SelectedValue + ",@UserID," + TextBoxStudents.Text + ",'" + status + "',1) "; InsertNewBooking.InsertCommand = insertstring; InsertNewBooking.Insert(); System.Data.SqlClient.SqlConnection MyConnection; System.Data.SqlClient.SqlCommand MyCommand; System.Data.SqlClient.SqlDataReader MyDataReader; MyConnection = new System.Data.SqlClient.SqlConnection("Data Source=co-web-3.lboro.ac.uk;Initial Catalog=team17;User ID=team17;Password=g6g88fcv"); MyConnection.Open(); MyCommand = new System.Data.SqlClient.SqlCommand(); MyCommand.Connection = MyConnection; MyCommand.CommandText = "SELECT RequestID FROM REQUEST"; MyDataReader = MyCommand.ExecuteReader(); string reqID = ""; while (MyDataReader.Read()) { reqID = MyDataReader.GetSqlValue(0).ToString(); } MyDataReader.Close(); MyDataReader = null; MyCommand.CommandText = "INSERT INTO RequestRoom (RequestID, RoomID) VALUES('" + reqID + "', '" + Label2.Text + "')"; MyDataReader = MyCommand.ExecuteReader(); MyDataReader.Close(); MyDataReader = null; for (int z = 0; z < CheckBoxList1.Items.Count; z++) { if (CheckBoxList1.Items[z].Selected == true) { for (int b = 0; b < CheckBoxList2.Items.Count; b++) { if (CheckBoxList2.Items[b].Selected == true) { MyCommand.CommandText = "INSERT INTO RequestTime (RequestID, Week, TimeID) VALUES(" + reqID + ", " + (z + 1) + ", " + b + ") "; MyDataReader = MyCommand.ExecuteReader(); MyDataReader.Close(); MyDataReader = null; } } } } MyCommand = null; MyConnection.Close(); MyConnection = null; Response.Redirect("~/Secure/booked.aspx?" + reqID); }
protected void updatetimes() { string Roomid = Label2.Text; System.Data.SqlClient.SqlConnection MyConnection; System.Data.SqlClient.SqlCommand MyCommand; System.Data.SqlClient.SqlDataReader MyDataReader; MyConnection = new System.Data.SqlClient.SqlConnection("Data Source=co-web-3.lboro.ac.uk;Initial Catalog=team17;User ID=team17;Password=g6g88fcv"); MyConnection.Open(); MyCommand = new System.Data.SqlClient.SqlCommand(); MyCommand.Connection = MyConnection; for (int a = 0; a < 45; a++) { CheckBoxList2.Items[a].Enabled = true; } string Command1 = ""; int count = 0; Command1 = "SELECT DISTINCT TimeID FROM RequestTime WHERE (RequestID IN(SELECT RequestID FROM Request WHERE (Status = 'Allocated') AND (RoundID IN(SELECT RoundID FROM Round WHERE SemesterID =(SELECT SemesterID FROM Round WHERE RoundID='" + DropDownList3.SelectedValue + "'))))) AND RequestID IN(SELECT RequestID FROM RequestRoom WHERE RoomID = '" + Label2.Text + "')"; for (int r = 0; r < 15; r++) { if (CheckBoxList1.Items[r].Selected == true && count == 0) { count++; Command1 += "AND ((Week = " + (r + 1) + ")"; } if (CheckBoxList1.Items[r].Selected == true && count > 0) { count++; Command1 += "OR (Week = " + (r + 1) + ")"; } } if (count > 0) { Command1 += ")"; } MyCommand.CommandText = Command1; if (count != 0) { MyDataReader = MyCommand.ExecuteReader(); while (MyDataReader.Read()) { for (int a = 0; a < 45; a++) { if (MyDataReader.GetSqlValue(0).ToString() == a.ToString()) { CheckBoxList2.Items[a].Selected = false; CheckBoxList2.Items[a].Enabled = false; } } } MyDataReader.Close(); MyDataReader = null; } }
protected void Page_Load(object sender, EventArgs e) { string ModID = ""; string RequestID = Request.Url.Query.ToString().Substring(1); Label11.Text = RequestID; System.Data.SqlClient.SqlConnection MyConnection; System.Data.SqlClient.SqlCommand MyCommand; System.Data.SqlClient.SqlDataReader MyDataReader; MyConnection = new System.Data.SqlClient.SqlConnection("Data Source=co-web-3.lboro.ac.uk;Initial Catalog=team17;User ID=team17;Password=g6g88fcv"); MyConnection.Open(); MyCommand = new System.Data.SqlClient.SqlCommand(); MyCommand.Connection = MyConnection; MyCommand.CommandText = "SELECT ModuleID,NoStudents,ParkOnly,BuildingID, Status FROM Request WHERE (RequestID = " + RequestID + ")"; MyDataReader = MyCommand.ExecuteReader(); while (MyDataReader.Read()) { Label1.Text = MyDataReader.GetSqlValue(0).ToString(); ModID = MyDataReader.GetSqlValue(0).ToString(); Label9.Text = MyDataReader.GetSqlValue(1).ToString(); Label10.Text = MyDataReader.GetSqlValue(4).ToString(); if (MyDataReader.GetSqlValue(2).ToString() == "Null") { Label5.Text = "Any"; } else { Label5.Text = MyDataReader.GetSqlValue(2).ToString(); } if (MyDataReader.GetSqlValue(3).ToString() == "Null") { Label6.Text = "Any"; } else { Label6.Text = MyDataReader.GetSqlValue(3).ToString(); } } MyDataReader.Close(); MyDataReader = null; MyCommand.CommandText = "SELECT Name FROM Module WHERE (ModuleID = '" + ModID + "')"; MyDataReader = MyCommand.ExecuteReader(); while (MyDataReader.Read()) { Label2.Text = MyDataReader.GetSqlValue(0).ToString(); } MyDataReader.Close(); MyDataReader = null; MyCommand.CommandText = "SELECT team17.Function3(" + RequestID + ")"; MyDataReader = MyCommand.ExecuteReader(); while (MyDataReader.Read()) { Label8.Text = MyDataReader.GetSqlValue(0).ToString(); } MyDataReader.Close(); MyDataReader = null; MyCommand.CommandText = "SELECT team17.ConcatRooms(" + RequestID + ")"; MyDataReader = MyCommand.ExecuteReader(); while (MyDataReader.Read()) { if (MyDataReader.GetSqlValue(0).ToString() != "Null") { Label3.Text = MyDataReader.GetSqlValue(0).ToString(); } else { Label3.Text = "Any"; } } MyDataReader.Close(); MyDataReader = null; MyCommand.CommandText = "SELECT team17.ConcatTimes(" + RequestID + ",0,8,-1)"; MyDataReader = MyCommand.ExecuteReader(); while (MyDataReader.Read()) { if (MyDataReader.GetSqlValue(0).ToString() != "Null") { Label7.Text += "Mon - Period " + MyDataReader.GetSqlValue(0).ToString() + ", "; } } MyDataReader.Close(); MyDataReader = null; MyCommand.CommandText = "SELECT team17.ConcatTimes(" + RequestID + ",9,17,8)"; MyDataReader = MyCommand.ExecuteReader(); while (MyDataReader.Read()) { if (MyDataReader.GetSqlValue(0).ToString() != "Null") { Label7.Text += "Tue - Period " + MyDataReader.GetSqlValue(0).ToString() + ", "; } } MyDataReader.Close(); MyDataReader = null; MyCommand.CommandText = "SELECT team17.ConcatTimes(" + RequestID + ",18,26,17)"; MyDataReader = MyCommand.ExecuteReader(); while (MyDataReader.Read()) { if (MyDataReader.GetSqlValue(0).ToString() != "Null") { Label7.Text += "Wed - Period " + MyDataReader.GetSqlValue(0).ToString() + ", "; } } MyDataReader.Close(); MyDataReader = null; MyCommand.CommandText = "SELECT team17.ConcatTimes(" + RequestID + ",27,35,26)"; MyDataReader = MyCommand.ExecuteReader(); while (MyDataReader.Read()) { if (MyDataReader.GetSqlValue(0).ToString() != "Null") { Label7.Text += "Thurs - Period " + MyDataReader.GetSqlValue(0).ToString() + ", "; } } MyDataReader.Close(); MyDataReader = null; MyCommand.CommandText = "SELECT team17.ConcatTimes(" + RequestID + ",36,44,35)"; MyDataReader = MyCommand.ExecuteReader(); while (MyDataReader.Read()) { if (MyDataReader.GetSqlValue(0).ToString() != "Null") { Label7.Text += "Fri - Period " + MyDataReader.GetSqlValue(0).ToString() + ", "; } } MyDataReader.Close(); MyDataReader = null; int written1 = 0; int written2 = 0; MyCommand.CommandText = "SELECT Name FROM Facility WHERE FacilityID IN(SELECT FacilityID FROM RequestFacility WHERE (RequestID =" + RequestID + ") AND (FacilityID < 3))"; MyDataReader = MyCommand.ExecuteReader(); while (MyDataReader.Read()) { if (MyDataReader.GetSqlValue(0).ToString() != "Null") { Label12.Text = MyDataReader.GetSqlValue(0).ToString(); written1 = 1; } } MyDataReader.Close(); MyDataReader = null; if (written1 == 0) { Label12.Text = "Any"; } MyCommand.CommandText = "SELECT Name FROM Facility WHERE FacilityID IN(SELECT FacilityID FROM RequestFacility WHERE (RequestID =" + RequestID + ") AND (FacilityID > 2) AND (FacilityID < 5))"; MyDataReader = MyCommand.ExecuteReader(); while (MyDataReader.Read()) { if (MyDataReader.GetSqlValue(0).ToString() != "Null") { Label13.Text = MyDataReader.GetSqlValue(0).ToString(); written2 = 1; } } MyDataReader.Close(); MyDataReader = null; if (written2 == 0) { Label13.Text = "Any"; } MyCommand.CommandText = "SELECT team17.Function4(" + RequestID + ")"; MyDataReader = MyCommand.ExecuteReader(); while (MyDataReader.Read()) { if (MyDataReader.GetSqlValue(0).ToString() != "Null") { Label4.Text += MyDataReader.GetSqlValue(0).ToString(); } else { Label4.Text += "None"; } } MyDataReader.Close(); MyDataReader = null; MyCommand.CommandText = "SELECT DISTINCT TimeID FROM RequestTime WHERE (RequestID = " + RequestID + ") "; MyDataReader = MyCommand.ExecuteReader(); while (MyDataReader.Read()) { for (int a = 0; a < 45; a++) { if (MyDataReader.GetSqlValue(0).ToString() == a.ToString()) { if (a < 9) { Table1.Rows[2].Cells[a + 1].BackColor = System.Drawing.Color.Red; } if (a > 8 && a < 18) { int b = (a - 9); Table1.Rows[3].Cells[b + 1].BackColor = System.Drawing.Color.Red; } if (a > 17 && a < 27) { int b = (a - 18); Table1.Rows[4].Cells[b + 1].BackColor = System.Drawing.Color.Red; } if (a > 26 && a < 36) { int b = (a - 27); Table1.Rows[5].Cells[b + 1].BackColor = System.Drawing.Color.Red; } if (a > 35 && a < 45) { int b = (a - 36); Table1.Rows[6].Cells[b + 1].BackColor = System.Drawing.Color.Red; } } } } MyDataReader.Close(); MyDataReader = null; }