protected void ButtonDeleteLeavers_Click(object sender, EventArgs e) { ISAMS_Set_List SL1 = new ISAMS_Set_List(); foreach (ISAMS_Set s1 in SL1.m_list) { if (s1.Year == 12) { string s = ""; s = s1.SetCode; ISAMS_Student_List stu1 = new ISAMS_Student_List(s1.Id); foreach (ISAMS_Student s2 in stu1.m_list) { s = s2.ISAMS_SchoolId + "," + s1.SetCode + "," + s2.Adno.ToString() + "," + s2.Surname + "," + s2.FirstName; } } } //process leavers int n = 0; StudentsOnRoleNotInRegGroup nr = new StudentsOnRoleNotInRegGroup(); foreach (SimplePupil p in nr._studentlist) { StudentLeavingDetails s1 = new StudentLeavingDetails(); s1.LeavingDate = new DateTime(2017, 9, 6); s1.Adno = p.m_adno; s1.valid = true; s1.SaveOffRole(); n++; } n = n; }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //RegisterAsyncTask(new PageAsyncTask(Test1)); ISAMS_Student_List is1 = new ISAMS_Student_List("8104", true); foreach (ISAMS_Student s1 in is1.m_list) { string s2 = s1.Surname; byte[] bytes = Encoding.Default.GetBytes(s2); string test1 = Encoding.UTF8.GetString(bytes); string s4 = s2; s4 = Encoding.Default.ToString(); s4 = s4; } return; } }
protected void Button_synClick(object sender, EventArgs e) { //sync iSAMSGroups //first going to mark all current student_group memberships as version 10 //then will be able to end all those not found in iSAMS //ResetAllStudentGroupVersion(10); //reset all current sgms to ver 10 DateTime EndDate = new DateTime(); EndDate = System.Convert.ToDateTime(TextBox_EndDate.Text); int year = System.Convert.ToInt32(TextBox_Year.Text); Utility u = new Utility(); string errors = ""; bool found = false; ISAMS_Set_List Isetl1 = new ISAMS_Set_List(); foreach (ISAMS_Set Is in Isetl1.m_list) { //for each set... if (Is.Year == year) { ISAMS_Student_List Isl1 = new ISAMS_Student_List(Is.Id); StudentGroupMembershipList sgml1 = new StudentGroupMembershipList(); Group g1 = new Group(); g1.Load(Is.SetCode, DateTime.Now); if (!g1._valid) { //ought to try to make the group errors += "Group not found in Cerval" + Is.SetCode + Environment.NewLine; } else { sgml1.LoadList_Group(g1._GroupID, DateTime.Now); foreach (ISAMS_Student iSS1 in Isl1.m_list) { found = false; foreach (StudentGroupMembership sgm1 in sgml1.m_list) { string iSAMSPupilId = u.GetStudentIsamsID("StudentId", sgm1.m_Studentid.ToString()); if (iSAMSPupilId == "") { errors += "Student not found " + sgm1.m_Studentid.ToString() + Environment.NewLine; } if (iSS1.ISAMS_SchoolId == iSAMSPupilId) { found = true; sgm1.ResetVersion(3);// it is OK break; } } if (!found) { //need to add to sgml StudentGroupMembership sgm2 = new StudentGroupMembership(); //need to find ID for this student for the iSAMSId Guid g2 = u.GetStudentIDfromiSAMS(iSS1.ISAMS_SchoolId); if (g2 == Guid.Empty) { errors += " Student not found in Cerval for iSAMSID " + iSS1.ISAMS_SchoolId + Environment.NewLine; } else { sgm2.m_ValidFrom = DateTime.Now.AddHours(-10); sgm2.m_ValidTo = EndDate; sgm2.m_Studentid = g2; sgm2.m_Groupid = g1._GroupID; //version=4 sgm2.Save(); } } errors += "Cmpleted set " + Is.SetCode + " at " + DateTime.Now.ToLongTimeString() + Environment.NewLine; } //so that iSAMS set is done.... } errors += "Cmpleted set " + Is.SetCode + " at " + DateTime.Now.ToLongTimeString() + Environment.NewLine; } } //done iSAMS sets... // so those at version 10 need closing down...... TextBox_Out.Text = errors; Encode en = new Encode(); string d = " CONVERT(DATETIME, '" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "', 102) "; string s = " UPDATE dbo.tbl_Core_Student_Groups SET MemberUntil = " + d + " WHERE Version ='10' "; //en.ExecuteSQL(s); }
private void iSAMSLoad() { //going to try to get from iSAMS data Utility u1 = new Utility(); Guid PersonID = new Guid(); PersonID = u1.GetPersonIdfromRequest(Request); //has old cerval personid will need the new iSAMS SimplePupil p = new SimplePupil(); p.Load(u1.GetStudentId(PersonID).ToString()); if (PersonID.ToString() == "20744211-d0f0-4e69-af84-020c1023dfda") //CC { p.Load("ce64da61-8505-4d07-9c9e-62dbe90d7dff"); //matt dagnal } string s = ""; if (p.m_IsamsPupilId == null) { //try to find email //need to call load on remote server string result = ""; using (System.Net.WebClient client = new System.Net.WebClient()) { try { result = client.DownloadString("http://10.1.84.230/admin/messagelist.sync?type=ISAMS_LOADSTUDENTLISTEMAIL&Id=" + p.m_GoogleAppsLogin + "¶meters=" + "10"); } catch (Exception ex) { s = "Error calling remote server : " + ex.ToString(); servercontent.InnerHtml = s; return; } } ISAMS_Student_List sl1 = new ISAMS_Student_List(); DataContractJsonSerializer js = new DataContractJsonSerializer(typeof(List <ISAMS_Student>)); using (MemoryStream stream = new MemoryStream(Encoding.Unicode.GetBytes(result))) { sl1.m_list = (js.ReadObject(stream) as List <ISAMS_Student>); } foreach (ISAMS_Student st in sl1.m_list) { p.m_IsamsPupilId = st.ISAMS_SchoolId; } } //if(p.m_IsamsPupilId== null)p.m_IsamsPupilId = "690179871718"; if (p.m_IsamsPupilId != null) { //OK we have isams id //need to call on-site server... string result = ""; using (System.Net.WebClient client = new System.Net.WebClient()) { try { result = client.DownloadString("http://10.1.84.230/admin/messagelist.sync?type=ISAMS_GETEXAMENTRIES&Id=" + p.m_IsamsPupilId + "¶meters=" + "0"); } catch (Exception ex) { s = "Error calling remote server : " + ex.ToString(); servercontent.InnerHtml = s; return; } } ISAMS_ExamsEntry_List el1 = new ISAMS_ExamsEntry_List(); DataContractJsonSerializer js = new DataContractJsonSerializer(typeof(List <ISAMS_ExamEntry>)); using (MemoryStream stream = new MemoryStream(Encoding.Unicode.GetBytes(result))) { el1.m_list = (js.ReadObject(stream) as List <ISAMS_ExamEntry>); } s += "<center><h2>Exam Timetable for " + p.m_GivenName + " " + p.m_Surname + "</h2></center>"; s += "<BR><center><TABLE BORDER><TR>"; s += "<Th>Date</Th>"; s += "<Th>Start Time</Th>"; s += "<Th>Paper Code</Th>"; s += "<Th>Paper Name</Th>"; s += "<Th>Room</Th>"; s += "<Th>Desk</Th></TR>"; foreach (ISAMS_ExamEntry ex in el1.m_list) { s += "<TR><TD>" + ex.Date + "</TD>"; s += "<TD>" + ex.Time + "</TD>"; s += "<TD>" + ex.ComponentCode + "</TD>"; s += "<TD>" + ex.OptionTitle + ": " + ex.ComponentTitle + "</TD>"; s += "<TD>" + ex.RoomName + "</TD>"; s += "<TD>" + ex.GivenSeat + "</TD></TR>"; } s += "</TABLE></center>"; } servercontent.InnerHtml = s; }