protected void Button_OK_Click(object sender, EventArgs e) { Panel1.Visible = true; Panel2.Visible = false; //do it string s = ""; foreach (GridViewRow r in GridView2.Rows) { if (r.BackColor == System.Drawing.Color.DarkGray) { s = r.Cells[0].Text; Exam_Entry ex1 = new Exam_Entry(); ex1.Load(s); if (ex1.CanDelete()) { s = "delete"; ex1.Delete(); } else { s = "withdraw"; ex1.Withdraw(); } } } SqlDataSource2.SelectCommand = GetQueryString(); Encode en = new Encode(); SqlDataSource2.ConnectionString = en.GetDbConnection(); SqlDataSource2.DataBind(); Button_Delete.Visible = false; }
protected void Button_Save_Prediction_Click(object sender, EventArgs e) { string s = Label_EntryID_for_edit.Text; Exam_Entry ex1 = new Exam_Entry(); ex1.Load(s); s = ListBox_PredictedGrades.SelectedItem.Text; ex1.m_PredictedGrade = s; ex1.Save(); GridView1.DataBind(); visibility(GetDisplayType(Label_type.Text)); }
protected void Button_PullEntries_Click(object sender, EventArgs e) { ISAMS_SimpleExamEntry_List IEntries = new ISAMS_SimpleExamEntry_List(); int c = 0; c = System.Convert.ToInt32(TextBox_CycleNumber.Text); IEntries.LoadList(c); foreach (ISAMS_SimpleExamEntry Ien in IEntries.m_list) { //need to find Guids for Pupil, OPtion etc... Utility u = new Utility(); Guid SId = new Guid(); SId = u.GetStudentIDfromiSAMS(Ien.m_PupilId); Exam_Board eb1 = new Exam_Board(Ien.m_UABCode); ExamOption eo1 = new ExamOption(); eo1.Load(Ien.m_OptionCode, SeasonCode.ToString(), YearCode.ToString(), Ien.m_UABCode.ToString()); Exam_Entry Ex1 = new Exam_Entry(); Ex1.Load(Ien.m_OptionCode, SeasonCode.ToString(), YearCode.ToString(), eb1.m_ExamBoardId, SId); if (!Ex1.m_valid) { Ex1.m_Date_Created = DateTime.Now; Ex1.m_OptionID = eo1.m_OptionID; Ex1.m_season = SeasonCode.ToString(); Ex1.m_StudentID = SId; Ex1.m_withdrawn = false; Ex1.m_year = Year.ToString(); Ex1.m_EntryStatus = 7; Ex1.Save(); } else { bool f = Ex1.m_valid; } } }
void GridView1_RowCommand(Object sender, GridViewCommandEventArgs e) { //calls here for any command - including a sort if (e.CommandName == "Edit_Grade") { Cerval_Configuration c = new Cerval_Configuration("StaffIntranet_Forecast_Grade_Edit"); string s1 = c.Value; if (!c.valid)//try revert to config file { System.Configuration.AppSettingsReader ar = new AppSettingsReader(); s1 = ar.GetValue("Exam Entries Forecast Grade Edit", s1.GetType()).ToString(); } if (s1 == "none") { visibility(4); { ListBox_PredictedGrades.Visible = false; Button_Save_Prediction.Visible = false; Label_Title_for_Edit.Text = "Predicted grades can't be edited at present"; return; } } int row = Convert.ToInt32(e.CommandArgument); GridViewRow row1 = GridView1.Rows[row]; string s = Server.HtmlDecode(row1.Cells[0].Text);//is id Exam_Entry ex1 = new Exam_Entry(); ex1.Load(s); SimplePupil p1 = new SimplePupil(); p1.Load(ex1.m_StudentID.ToString()); ExamOption exo1 = new ExamOption(); exo1.Load(ex1.m_OptionID); Utility u = new Utility(); bool valid = false; PupilPeriodList PPLlist1 = new PupilPeriodList(); PPLlist1.LoadList("StudentID", ex1.m_StudentID.ToString(), true, DateTime.Now); //now I'd like to find the cse... but we dont know these CourseList cselist1 = new CourseList(ex1.m_OptionID); GroupList_SL grplist1 = new GroupList_SL(Label_staffCode.Text.Trim()); foreach (Course c1 in cselist1._courses) { foreach (ScheduledPeriod scp in PPLlist1.m_pupilTTlist) { if (scp.m_groupcode.Substring(2, 2).ToUpper().Trim() == c1.CourseCode.ToUpper().Trim()) { if (scp.m_staffcode.Trim().ToUpper() == Label_staffCode.Text.Trim().ToUpper()) { if (s1 == "staff") { valid = true; } } foreach (Group g1 in grplist1._groups) { if (g1._GroupCode == scp.m_groupcode) { valid = true; //is SL } } } } } if (s1 == "all") { valid = true; } visibility(4); if (!valid) { ListBox_PredictedGrades.Visible = false; Button_Save_Prediction.Visible = false; Label_Title_for_Edit.Text = "Can't edit this grade as you don't teach the student"; return; } Label_Title_for_Edit.Text = "Predicted Grade for " + p1.m_GivenName + " " + p1.m_Surname + " for " + exo1.m_OptionCode + ": " + exo1.m_OptionTitle; Label_EntryID_for_edit.Text = s; ListBox_PredictedGrades.Items.Clear(); if (exo1.m_OptionQualification == "GCE") { ListBox_PredictedGrades.Items.Add("A*"); ListBox_PredictedGrades.Items.Add("A"); ListBox_PredictedGrades.Items.Add("B"); ListBox_PredictedGrades.Items.Add("C"); ListBox_PredictedGrades.Items.Add("D"); ListBox_PredictedGrades.Items.Add("E"); ListBox_PredictedGrades.Items.Add("U"); } if (exo1.m_OptionQualification == "GCSE") { ListBox_PredictedGrades.Items.Add("A*"); ListBox_PredictedGrades.Items.Add("A"); ListBox_PredictedGrades.Items.Add("B"); ListBox_PredictedGrades.Items.Add("C"); ListBox_PredictedGrades.Items.Add("D"); ListBox_PredictedGrades.Items.Add("E"); ListBox_PredictedGrades.Items.Add(""); } if (ListBox_PredictedGrades.Items.FindByText(Server.HtmlDecode(row1.Cells[7].Text)) != null) { ListBox_PredictedGrades.Items.FindByText(Server.HtmlDecode(row1.Cells[7].Text)).Selected = true; Button_Save_Prediction.Visible = true; } else { //ListBox_PredictedGrades.Visible = false; //Button_Save_Prediction.Visible = false; //Label_Title_for_Edit.Text = "Can't edit this grade"; } Button_Save_Prediction.Visible = true; } if (e.CommandName == "Edit_Button") { int row = Convert.ToInt32(e.CommandArgument); GridViewRow row1 = GridView1.Rows[row]; string s = Server.HtmlDecode(row1.Cells[0].Text);//is id Exam_Entry ex1 = new Exam_Entry(); ex1.Load(s); ExamsEntries_sql.UpdateCommand = "UPDATE dbo.tbl_Exams_Entries SET PredictedGrade = '?' WHERE ExamEntryID ='" + s + "' "; } if (e.CommandName == "Delete_Button") { int row = Convert.ToInt32(e.CommandArgument); GridViewRow row1 = GridView1.Rows[row]; string s = Server.HtmlDecode(row1.Cells[0].Text); //do delete... } }
protected int AddControls(ResultsList rl, bool setup) { int cost = 0; Guid[] listID = new Guid[100]; Exam_ResitEntry ExamResit1 = new Exam_ResitEntry(); Exam_Entry entry1 = new Exam_Entry(); Table1.Visible = true; Table tb1 = (Table)content.FindControl("table1"); tb1.Width = 700; tb1.EnableViewState = true; TableRow r0 = new TableRow(); tb1.Controls.Add(r0); TableCell c01 = new TableCell(); r0.Controls.Add(c01); SetCellStyle(c01, tb1); TableCell c02 = new TableCell(); r0.Controls.Add(c02); SetCellStyle(c02, tb1); TableCell c03 = new TableCell(); r0.Controls.Add(c03); SetCellStyle(c03, tb1); TableCell c04 = new TableCell(); r0.Controls.Add(c04); SetCellStyle(c04, tb1); TableCell c05 = new TableCell(); r0.Controls.Add(c05); SetCellStyle(c05, tb1); c01.Text = "Code"; c02.Text = "Title"; c03.Text = "Result"; c04.Text = "Date Taken"; c05.Text = "Retake ?"; foreach (Result res1 in rl._results) { if (res1.OptionItem == "U") {//we have a module result TableRow r1 = new TableRow(); tb1.Controls.Add(r1); r1.BorderStyle = BorderStyle.Solid; r1.BorderColor = tb1.BorderColor; r1.BorderWidth = tb1.BorderWidth; TableCell c1 = new TableCell(); r1.Controls.Add(c1); SetCellStyle(c1, tb1); TableCell c2 = new TableCell(); r1.Controls.Add(c2); SetCellStyle(c2, tb1); TableCell c3 = new TableCell(); r1.Controls.Add(c3); SetCellStyle(c3, tb1); TableCell c4 = new TableCell(); r1.Controls.Add(c4); SetCellStyle(c4, tb1); TableCell c5 = new TableCell(); r1.Controls.Add(c5); SetCellStyle(c5, tb1); if ((res1.Valid) && ((CheckBox)content.FindControl(res1.OptionId.ToString()) == null)) { entry1.Load(res1.OptionId, res1.StudentID); //now if already entered we don't want to offer..... if (entry1.m_valid) { c5.Text = "Entered"; } else { CheckBox cb1 = new CheckBox(); cb1.ID = res1.OptionId.ToString(); c5.Controls.Add(cb1); //decide if we already have an entry.... if (setup) { ExamResit1.Load(res1.StudentID, res1.OptionId); if (ExamResit1.m_valid) { cb1.Checked = true; ExamOption exo1 = new ExamOption(); exo1.Load(res1.OptionId); cost += exo1.m_feeInt + RetakeCoverCost(); } } cb1.CheckedChanged += new EventHandler(cb_CheckedChanged); cb1.AutoPostBack = true; } } else { c5.Text = "Not available"; } c1.Text = res1.OptionCode; c2.Text = res1.OptionTitle; c3.Text = res1.Value; c4.Text = res1.Date.ToShortDateString(); } } return(cost); }