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... } }
public bool AddEntry(Guid StudentId, Exam_Board exbde1, int Year, int YearCode, int Season, string option, int EntryStatusCode, bool checkDisallowed, ref string ErrorMessage, ref Guid EntryId) { //Year is 2 digit code..... bool disallowed = false; ErrorMessage = ""; ExamOption ex01 = new ExamOption(); ExamOption ex02 = new ExamOption(); ExamFiles ef1 = new ExamFiles(); ex01.Load(option, Season.ToString(), YearCode.ToString(), exbde1.m_ExamBoardId); if (!ex01.m_valid) { //need to search basedata... ex01 = ef1.Find_Option(option, exbde1, Season.ToString(), YearCode.ToString()); } if (ex01 != null) { ExamEntries_List exen1 = new ExamEntries_List(); exen1.Load(StudentId, Year.ToString(), Season.ToString()); if (checkDisallowed) { foreach (Exam_Entry ex1 in exen1.m_list) { if (!ex1.m_withdrawn) { ex02.Load(ex1.m_OptionID); disallowed = ef1.CombinationDisallowed(exbde1, ex01.m_OptionCode, ex02.m_OptionCode, ex01.m_SeriesIdentifier, ex01.m_year_Code); if (disallowed) { ErrorMessage = "Combination of " + ex01.m_OptionCode + " and " + ex02.m_OptionCode + " not allowed!"; return(false); } } } } if (!disallowed) { Exam_Entry entry1 = new Exam_Entry(); entry1.m_OptionID = ex01.m_OptionID; entry1.m_StudentID = StudentId; entry1.m_Date_Created = DateTime.Now; entry1.m_season = Season.ToString(); entry1.m_year = Year.ToString(); entry1.m_ExamEntryID = Guid.Empty; entry1.m_EntryStatus = EntryStatusCode; foreach (Exam_Entry ex1 in exen1.m_list) { if (ex1.m_OptionID == ex01.m_OptionID) { //found this student, this series, this option entry1.m_ExamEntryID = ex1.m_ExamEntryID; } } entry1.Save(); EntryId = entry1.m_ExamEntryID; return(true); } } else { ErrorMessage = "Option code " + option + " not found"; return(false); } return(false); }
protected void Button_CheckTime_Click(object sender, EventArgs e) { string s = TextBox1.Text; string ErrorMsg = ""; TextFileType ftype1 = TextFileType.Unknown; try { ftype1 = (TextFileType)ViewState["TextFileType"]; } catch { Label_Text.Text = "File Type not recognised"; return; } char[] ct1 = new char[1]; ct1[0] = (char)0x09; string[] fields = new string[20]; ExamsUtility u = new ExamsUtility(); PupilGroupList pgl = new PupilGroupList(); ExamConversions Ec = new ExamConversions(); SimplePupil pupil1 = new SimplePupil(); Guid g1 = new Guid(); g1 = Guid.Empty; DateTime t1 = new DateTime(); t1 = DateTime.Now; using (StringReader sr = new StringReader(s)) { string firstline = sr.ReadLine(); string line = sr.ReadLine(); fields = line.Split(ct1); Exam_Board exbde1 = Ec.GetExamBoard(fields[1]); switch (ftype1) { case TextFileType.Unknown: Label_Text.Text = "File Type not recognised"; break; case TextFileType.Students: //Admission Number,Surname, GivenName,Board,Syllabus,Option..."; try { pupil1.Load_StudentIdOnly(System.Convert.ToInt32(fields[0])); ///loads lft students aswell if (!u.AddEntry(pupil1.m_StudentId, exbde1, Year, YearCode, SeasonCode, fields[3], 3, true, ref ErrorMsg, ref g1)) { Label_Text.Text = ErrorMsg; return; } else { Exam_Entry en1 = new Exam_Entry(); en1.m_ExamEntryID = g1; en1.Delete(); } } catch (Exception ex) { Label_Text.Text = ex.ToString(); return; } break; case TextFileType.Sets: pgl.m_pupilllist.Clear(); pgl.AddToList(fields[0], DateTime.Now); foreach (SimplePupil p in pgl.m_pupilllist) { try { if (!u.AddEntry(p.m_StudentId, exbde1, Year, YearCode, SeasonCode, fields[3], 3, true, ref ErrorMsg, ref g1)) { Label_Text.Text = ErrorMsg; return; } else { Exam_Entry en1 = new Exam_Entry(); en1.m_ExamEntryID = g1; en1.Delete(); } } catch (Exception ex) { Label_Text.Text = ex.ToString(); return; } } break; default: break; } //done one set or one student...scale up.... TimeSpan ts1 = DateTime.Now - t1; TimeSpan ts2 = new TimeSpan(); ts2 = ts1; while ((line = sr.ReadLine()) != null) { ts2 += ts1; } TextBox_Warning.Text = "WARNING: This operation is likely to take about " + ts2.ToString() + Environment.NewLine + "Press Process Button to continue..."; TextBox_Warning.Visible = true; Button_CheckTime.Visible = false; Button_Process.Visible = true; } }
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); }