Esempio n. 1
0
        protected void Button_test3_Click(object sender, EventArgs e)
        {
            //remake 9year or whatever
            string YearGroup = TextBox_YearGroup.Text;
            string GroupName = YearGroup + "Year";

            int year = DateTime.Now.Year; int month = DateTime.Now.Month;

            if (month > 8)
            {
                year++;           //so
            }
            DateTime EndDate   = new DateTime(year, 7, 31);
            DateTime StartDate = new DateTime(year - 1, 9, 4);

            GroupList gl1 = new GroupList();
            Utility   u   = new Utility();
            Group     g2  = new Group(); g2.Load(GroupName, DateTime.Now);

            if (!g2._valid)
            {
                g2._GroupCode = GroupName; g2._StartDate = StartDate; g2._EndDate = EndDate; g2._GroupName = GroupName;
                g2._CourseID  = new Guid("f0e6828f-c6e1-4105-988c-83e350a39cc4"); g2._GroupRegistrationType = 3; g2._GroupRegistrationYear = System.Convert.ToInt32(YearGroup);
                g2._GroupPrimaryAdministrative = false; g2._GroupManagedBy = Guid.Empty;
                g2.Save();
            }
            gl1.LoadList(DateTime.Now, GroupList.GroupListOrder.GroupName);
            foreach (Group g in gl1._groups)
            {
                if (g._GroupCode.ToUpper().Trim() == GroupName.ToUpper())
                {
                    //going to delete all gm here
                    StudentGroupMembershipList sgml0 = new StudentGroupMembershipList();
                    sgml0.LoadList_Group(g._GroupID, DateTime.Now);
                    foreach (StudentGroupMembership sg in sgml0.m_list)
                    {
                        sg.Delete();
                    }

                    foreach (Group g1 in gl1._groups)
                    {
                        if (g1._GroupCode.Contains("RG") && (g1._GroupCode.StartsWith(YearGroup)))
                        {
                            StudentGroupMembershipList sgml1 = new StudentGroupMembershipList();
                            sgml1.LoadList_Group(g1._GroupID, DateTime.Now);
                            foreach (StudentGroupMembership sg in sgml1.m_list)
                            {
                                StudentGroupMembership sm1 = new StudentGroupMembership();
                                sm1.m_Groupid   = g._GroupID;
                                sm1.m_Studentid = sg.m_Studentid;
                                sm1.m_ValidFrom = StartDate;
                                sm1.m_ValidTo   = EndDate;
                                sm1.Save();
                            }
                        }
                    }
                    break;
                }
            }
        }
Esempio n. 2
0
        private void ProcessMakeGroup(string p1)
        {
            string[] parameters = new string[20];
            string[] splitchar  = new string[2];
            string[] students   = new string[200];
            //parameters are students%GroupName
            splitchar[0] = "%";
            int no_students = 0;

            parameters   = p1.Split(splitchar, StringSplitOptions.RemoveEmptyEntries);
            splitchar[0] = ":";
            splitchar[1] = ",";
            students     = parameters[0].Split(splitchar, StringSplitOptions.RemoveEmptyEntries);
            //so we have a list....how many?
            no_students = students.Length; students[0] = "";
            //get current group members
            StudentGroupMembershipList sgl1 = new StudentGroupMembershipList();
            Guid g = new Guid(GroupIDS);

            sgl1.LoadList_Group(g, DateTime.Now);
            //now if not in list delete sgm or if in list delete from list;
            bool found = false;

            foreach (StudentGroupMembership sg in sgl1.m_list)
            {
                found = false;
                for (int i = 0; i < no_students; i++)
                {
                    if (sg.m_Studentid.ToString() == students[i])
                    {
                        found = true; students[i] = "";
                    }
                }
                if (!found)
                {
                    sg.Delete();
                }
            }
            //now make new ones....
            int y = DateTime.Now.Year;

            if (DateTime.Now.Month > 7)
            {
                y++;
            }
            string id = "";

            for (int i = 0; i < no_students; i++)
            {
                if (students[i] != "")
                {
                    id = students[i];
                    StudentGroupMembership sg = new StudentGroupMembership();
                    sg.m_Groupid   = new Guid(GroupIDS);
                    sg.m_Studentid = new Guid(students[i]);
                    sg.m_ValidTo   = new DateTime(y, 7, 31);
                    sg.m_ValidFrom = DateTime.Now.AddDays(-1);
                    sg.Save();
                    //remove duplicates....
                    for (int j = 0; j < no_students; j++)
                    {
                        if (students[j] == id)
                        {
                            students[j] = "";
                        }
                    }
                }
            }
        }
Esempio n. 3
0
        protected void Button_Save_Click(object sender, EventArgs e)
        {
            //get current group members
            StudentGroupMembershipList sgl1 = new StudentGroupMembershipList();
            string GroupIDS = (string)ViewState["group"];
            Guid   g        = new Guid(GroupIDS);

            sgl1.LoadList_Group(g, DateTime.Now);
            //now if not in list delete sgm or if in list delete from list;
            bool found = false;

            foreach (StudentGroupMembership sg in sgl1.m_list)
            {
                found = false;
                foreach (ListItem l in ListBox_SelectedNames.Items)
                {
                    if (sg.m_Studentid.ToString() == l.Value)
                    {
                        found = true;
                        ListBox_SelectedNames.Items.Remove(l); break;
                    }
                }
                if (!found)
                {
                    sg.Delete();
                }
            }
            //now make new ones....
            int y = DateTime.Now.Year;

            if (DateTime.Now.Month > 7)
            {
                y++;
            }



            foreach (ListItem l in ListBox_SelectedNames.Items)
            {
                if (l.Value != "")
                {
                    StudentGroupMembership sg = new StudentGroupMembership();
                    sg.m_Groupid   = new Guid(GroupIDS);
                    sg.m_Studentid = new Guid(l.Value);
                    sg.m_ValidTo   = new DateTime(y, 7, 31);
                    sg.m_ValidFrom = DateTime.Now.AddDays(-1);
                    sg.Save();
                    //remove duplicates....
                    for (int i = 0; i < ListBox_SelectedNames.Items.Count; i++)
                    {
                        if (l.Value == ListBox_SelectedNames.Items[i].Value)
                        {
                            ListBox_SelectedNames.Items[i].Value = "";
                        }
                    }
                }
            }
            ListBox_Names.Items.Clear();
            SetUpYearList(DropDownList_Years.SelectedValue);
            ListBox_SelectedNames.Items.Clear();
            SetUpGroupNames(GroupIDS);
        }
Esempio n. 4
0
        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);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //first find out who we are...
                Utility u = new Utility();
                string  s = "";
                //string staff = u.GetStaffCodefromContext(Context);
                string   staff = u.GetsStaffCodefromRequest(Request);
                DateTime date1 = new DateTime(); date1 = DateTime.Now;
                //date1 = date1.AddMonths(-12); //for testing we go back a year..
                date1 = date1.AddMonths(-3);// far enough back??
                string ds = "CONVERT(DATETIME, '" + date1.ToString("yyyy-MM-dd HH:mm:ss") + "',102) ";
                Guid   g1 = new Guid(u.Get_StaffID(staff));
                //now find out our teaching program before these exams.
                GroupList gl1 = new GroupList();
                gl1.LoadStaff(staff, date1, GroupList.GroupListOrder.GroupName);

                ServerContent.InnerHtml = "<h3>Results for sets you taught this year (possibly)</h3><br />";
                string[]    titles = new string[20];
                string[]    line = new string[20];
                int         n_titles = 0; int n1 = 0;
                ResultsList rl1 = new ResultsList();
                foreach (Group g in gl1._groups)
                {
                    for (int i = 0; i < 20; i++)
                    {
                        titles[i] = "";
                    }
                    if (g._GroupCode.StartsWith("11"))
                    {
                        s = "";
                        StudentGroupMembershipList sgml1 = new StudentGroupMembershipList();
                        sgml1.LoadList_Group(g._GroupID, date1);
                        foreach (StudentGroupMembership sg in sgml1.m_list)
                        {
                            for (int i = 0; i < 20; i++)
                            {
                                line[i] = "";
                            }
                            SimplePupil pupil1 = new SimplePupil();
                            pupil1.Load(sg.m_Studentid);
                            pupil1.m_year = 11;
                            //get their results....
                            rl1.m_parameters    = 3; rl1.m_db_field2 = "dbo.tbl_Core_Results.CourseID"; rl1.m_value2 = g._CourseID.ToString();
                            rl1.m_db_extraquery = " AND (dbo.tbl_Core_Results.ResultDate > " + ds + " ) ";
                            rl1.LoadList("dbo.tbl_Core_Results.StudentId", pupil1.m_StudentId.ToString());
                            //add name
                            //string predict = "";
                            //StudentAccademicProfile sadp1 = new StudentAccademicProfile(pupil1.m_StudentId);
                            //sadp1.Load_Profile(date1, ref pupil1, ref n1, false);
                            //foreach (StudentSubjectProfile sp1 in sadp1.profile)
                            //{
                            //  if (sp1.course._CourseID == g._CourseID)
                            // predict = sp1.PredictedGrade.ToString();
                            //}
                            s += "<tr><td>" + pupil1.m_GivenName + "</td><td> " + pupil1.m_Surname + "</td>";
                            //<td>" + predict + "</td>";
                            foreach (Result r in rl1._results)
                            {
                                n1 = -1;
                                //need to find in titles
                                for (int i = 0; i < n_titles; i++)
                                {
                                    if (titles[i] == r.OptionCode)
                                    {
                                        n1 = i; break;
                                    }
                                }
                                if (n1 == -1)
                                {
                                    n1 = n_titles; n_titles++; titles[n1] = r.OptionCode;
                                }
                                line[n1] = "<td>" + r.Value + "</td>";
                            }
                            for (int i = 0; i < n_titles; i++)
                            {
                                s += line[i];
                            }
                            s += "</tr>";
                        }

                        //now done all members of group so can add header rows!!!

                        string s1 = g._GroupCode + "<br/><br /><TABLE BORDER   class=\"ResultsTbl\" style = \"font-size:small ;  \">";
                        s1 += "<tr><th>GivenName</th><th>Surname</th>";
                        //<th>Predict</th>";
                        for (int i = 0; i < n_titles; i++)
                        {
                            s1 += "<th>" + titles[i].Trim() + "</th>";
                        }
                        s1 += "</tr>";
                        s   = s1 + s + "</TABLE><br /><br />";
                        ServerContent.InnerHtml += s;
                    }
                }
                //ServerContent.InnerHtml += "<h4>Prediction is from Alis Equations for A-level results and from Yellis test for GCSE</h4><br />";
            }
        }
Esempio n. 6
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            Response.Redirect("../xmatrix/selectmodel.aspx");
            //ReportScale r = new ReportScale(new Guid("5e5d8ab4-aa9a-46cf-a1c2-83352bb2ef57"));
            //string s = r.AssessmentLevelDetail.LevelName;
            //s = s;

            //toclean up left students...
            return;


            SimpleStudentList          stl1 = new SimpleStudentList(SimpleStudentList.LIST_TYPE.NOFORM_ONROLE);
            Group                      g1   = new Group();
            StudentGroupMembershipList sg1  = new StudentGroupMembershipList();

            g1.Load("13year", new DateTime(2019, 4, 1));
            sg1.LoadList_Group(g1._GroupID, new DateTime(2019, 4, 1));

            //mark all as left in 2019

            foreach (StudentGroupMembership s1 in sg1.m_list)
            {
                MarkAsLeft(new DateTime(2019, 7, 31), s1.m_Studentid);
            }

            g1.Load("13year", new DateTime(2018, 4, 1));
            sg1.LoadList_Group(g1._GroupID, new DateTime(2018, 4, 1));

            foreach (StudentGroupMembership s1 in sg1.m_list)
            {
                MarkAsLeft(new DateTime(2018, 7, 31), s1.m_Studentid);
            }

            return;

            foreach (SimplePupil p in stl1._studentlist)
            {
                //so going to find last known rg group??
                sg1.LoadList(p.m_StudentId, new DateTime(2019, 4, 1));
                foreach (StudentGroupMembership s1 in sg1.m_list)
                {
                    g1.Load(s1.m_Groupid);
                    if (g1._GroupPrimaryAdministrative)
                    {
                        MarkAsLeft(new DateTime(2018, 7, 31), s1.m_Studentid);
                    }
                }

                sg1 = new StudentGroupMembershipList();
                sg1.LoadList(p.m_StudentId, new DateTime(2018, 4, 1));
                foreach (StudentGroupMembership s1 in sg1.m_list)
                {
                    g1.Load(s1.m_Groupid);
                    if (g1._GroupPrimaryAdministrative)
                    {
                        //so was here in 2018, but not in 2019
                        //so leaving date is 31/7/2018
                        MarkAsLeft(new DateTime(2018, 7, 31), s1.m_Studentid);
                    }
                }

                sg1 = new StudentGroupMembershipList();
                sg1.LoadList(p.m_StudentId, new DateTime(2017, 4, 1));
                foreach (StudentGroupMembership s1 in sg1.m_list)
                {
                    g1.Load(s1.m_Groupid);
                    if (g1._GroupPrimaryAdministrative)
                    {
                        //so was here in 2017 but not in 2018
                    }
                }
            }

            Response.Redirect("../content/TestForm.aspx");
            //Response.Redirect("../Exams/UploadComponentResults.aspx");
        }