예제 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Request.QueryString.Count >= 2)
                {
                    string s   = "test";
                    string id0 = Request.QueryString["StudentId"];
                    ViewState.Add("StudentId", id0);
                    string id1 = Request.QueryString["OptionId"];
                    ExamComponentResultList ecrl1 = new ExamComponentResultList();
                    ecrl1.Load_OptionStudent(new Guid(id1), new Guid(id0));
                    SimplePupil   pupil1 = new SimplePupil(); pupil1.Load(id0);
                    ExamOption    exo1   = new ExamOption(); exo1.Load(new Guid(id1));
                    ExamComponent ec1    = new ExamComponent();
                    ResultsList   rl1    = new ResultsList();
                    rl1.LoadListSimple(" WHERE (ExamsOptionId = '" + id1 + "') AND (StudentID = '" + id0 + "')");
                    Result r1 = new Result();
                    r1 = (Result)rl1._results[0];
                    s  = " <p><h3> Component Scores for ";
                    s += pupil1.m_GivenName + " " + pupil1.m_Surname + " for " + exo1.m_OptionTitle + "(" + r1.Text + ")</h3></p>";
                    s += "This table gives your component marks for this subject. Please note these are <b>not</b> UMS marks. ";
                    s += "<br/> The sum of the component marks gives your TQM (Total Qualification Mark), which leads to your final grade.";
                    s += "The table below tells you how the TQM is related to the final grade, i.e. the grade boundaries, if we know them! If not, please speak to a member of staff in school.";

                    s += "<br/><br /> Note that for Drama and Music the non-integer Scaling factors may mean that the component marks do not exactly add up to the TQM. In this case the TQM is CORRECT!<br/>";

                    s += "<br/><br /><TABLE BORDER   class=\"ResultsTbl\" style = \"font-size:small\"   align=\"center\">";
                    s += "<TR><th>Syllabus Code</th><th>Option Code</th><th>Component Code</th><th>Component Name</th>";
                    s += "<th>Mark</th> <th>Max Mark</th></tr>";
                    foreach (ExamComponentResult r in ecrl1.m_list)
                    {
                        ec1.Load(r.ComponentId);
                        s += "<tr align=\"center\">";
                        s += "<td>" + exo1.m_Syllabus_Code + "</td>";
                        s += "<td>" + exo1.m_OptionCode + "</td>";
                        s += "<td>" + ec1.m_ComponentCode + "</td>";
                        s += "<TD>" + ec1.m_ComponentTitle + "</td>";
                        s += "<td>" + r.ComponentScaledMark.ToString() + "</td>";
                        s += "<td>" + ec1.m_MaximumMark.ToString() + "</td>";
                        s += " </tr>";
                    }
                    s += "</table>";
                    ExamTQMBoundaryList bl1 = new ExamTQMBoundaryList();//will be ordered largest first
                    bl1.LoadList(new Guid(id1), exo1.m_year_Code, exo1.m_Season_code);

                    s += "<br/><br/>"; s += " <p><h3 align=\"center\" > TQM Grade Boundaries</h3></p>";
                    s += "<TABLE BORDER   class=\"TimetableTable\" style = \"font-size:small\" align=\"center\"  >";
                    s += "<tr><th>Grade</th><th>  TQM   </th></tr>";
                    foreach (ExamTQMBoundary eb in bl1.m_list)
                    {
                        s += "<tr><td>" + eb.Grade + "</td><td>" + eb.Mark + "</td></tr>";
                    }

                    s += "</table>";

                    content.InnerHtml = s;
                }
            }
        }
예제 #2
0
        protected void SaveResult(string stud_id, string grade, string CourseID)
        {
            Utility     u     = new Utility();
            string      s     = "";
            bool        found = false;
            ResultsList rl1   = new ResultsList();

            DateTime ResultDate = new DateTime();

            ResultDate          = System.Convert.ToDateTime(TextBox2.Text);
            rl1.m_parameters    = 3; rl1.m_db_field2 = "ResultType"; rl1.m_value2 = "5";
            rl1.m_db_extraquery = " AND (dbo.tbl_Core_Results.ResultDate >= CONVERT(DATETIME, '" + ResultDate.ToString("yyyy-MM-dd HH:mm:ss") + "', 102) )";
            rl1.LoadList("dbo.tbl_Core_Students.StudentId", stud_id);
            foreach (Result r in rl1._results)
            {
                if (r.CourseID.ToString() == TextBox3.Text)
                {
                    // we have a value...
                    //update
                    found = true;
                    s     = "UPDATE tbl_Core_Results SET ResultValue='" + grade + "' ";
                    s    += "WHERE ResultID = '" + r.ResultID.ToString() + "'";
                    Encode en1 = new Encode();
                    en1.ExecuteSQL(s);
                }
            }
            if (!found)
            {
                string struser    = Context.User.Identity.Name;
                string staff_code = "";
                //Guid personID = u.GetPersonID(struser, out staff_code);
                Guid personID = u.GetPersonIdfromRequest(Request);
                staff_code = u.GetsStaffCodefromRequest(Request);
                SimplePupil pupil1 = new SimplePupil(); pupil1.Load(stud_id.ToString());
                if (personID != Guid.Empty)
                {
                    struser = u.Get_StaffCode(personID);
                }
#if DEBUG
                struser = "******";
#endif
                s = DateTime.Now.ToShortDateString() + "," + DateTime.Now.ToShortTimeString() + "," + TextBox1.Text + "," + struser + "," + pupil1.m_GivenName + "," + pupil1.m_Surname + "," + pupil1.m_adno.ToString() + "," + grade;
                //u.WriteToLogFile("resultslog.txt", s);
                s  = "INSERT INTO dbo.tbl_Core_Results (ResultType, StudentID, ResultValue, ResultDate, ResultText, ";
                s += "CourseId  )";
                s += " VALUES ( '5', '";
                s += stud_id + "', '";
                s += grade + "', ";
                s += " CONVERT(DATETIME, '" + ResultDate.ToString("yyyy-MM-dd HH:mm:ss") + "', 102), '";
                s += " ',  '";
                s += CourseID + "' )";
                Encode en1 = new Encode();
                en1.ExecuteSQL(s);
            }
        }
예제 #3
0
        private void EnterResult(string ID)
        {
            SimplePupil p1 = new SimplePupil();

            p1.Load(ID);
            Label_Student.Text    = "Predicted Grade for " + p1.m_GivenName + " " + p1.m_Surname;
            Button_Astar.Visible  = true;
            Button_A.Visible      = true; Button_B.Visible = true;
            Button_C.Visible      = true; Button_D.Visible = true;
            Button_E.Visible      = true; Button_U.Visible = true;
            Label1.Visible        = false; GroupListBox.Visible = false;
            Label_Student.Visible = true; Button1.Visible = false;
        }
예제 #4
0
        protected void ListBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            Utility u = new Utility();
            int     i = u.GetAdmissionNumber(ListBox1.SelectedValue);

            StudentAdno = i.ToString();
            SimplePupil p  = new SimplePupil(); p.Load_Left(i);
            Encode      en = new Encode();

            SqlDataSource2.SelectCommand    = GetQueryString();
            SqlDataSource2.ConnectionString = en.GetDbConnection();
            SqlDataSource2.DataBind();
            string s = "SELECT COUNT (ExamEntryID)  FROM dbo.qry_Cerval_Exams_Entries " + GetWhereString();

            Label_Grid.Text = "Entries for " + p.m_GivenName + " " + p.m_Surname + " (" + StudentAdno + ") ....  Total Entries =" + en.Execute_one_SQL(s);
        }
        protected void TextBox1_TextChanged(object sender, EventArgs e)
        {
            int i = 0;

            try
            {
                i = System.Convert.ToInt32(TextBox_StudentAdno.Text);
                SimplePupil p = new SimplePupil(); p.Load_Left(i);
                StudentID = p.m_StudentId.ToString();
                Encode en = new Encode();
                SqlDataSource1.SelectCommand    = GetQueryString();
                SqlDataSource1.ConnectionString = en.GetDbConnection();
                SqlDataSource1.DataBind();
                Label_Grid.Text = "Entries for " + p.m_GivenName + " " + p.m_Surname + " (" + p.m_adno.ToString() + ")";
            }
            catch { }
        }
예제 #6
0
 protected void TextBox1_TextChanged(object sender, EventArgs e)
 {
     switch (DisplayType)
     {
     case "Student":
         //so new Adno
         int i = 0;
         try
         {
             i           = System.Convert.ToInt32(TextBox1.Text);
             StudentAdno = i.ToString();
             SimplePupil p  = new SimplePupil(); p.Load_Left(i);
             Encode      en = new Encode();
             SqlDataSource2.SelectCommand    = GetQueryString();
             SqlDataSource2.ConnectionString = en.GetDbConnection();
             SqlDataSource2.DataBind();
             string s = "SELECT COUNT (ExamEntryID)  FROM dbo.qry_Cerval_Exams_Entries " + GetWhereString();
             Label_Grid.Text = "Entries for " + p.m_GivenName + " " + p.m_Surname + " (" + p.m_adno.ToString() + ") ....  Total Entries =" + en.Execute_one_SQL(s);
         }
         catch { }
         break;
     }
 }
예제 #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Utility u = new Utility();
                Display_List.Items.FindByValue("Medical").Enabled = u.CheckStaffInConfigGroup(Context, "Medical");
                Display_List.Items.FindByValue("StudentDevelopment Log").Enabled = u.CheckStaffInConfigGroup(Context, "StudentDevelopment");
                StudentDetail1.Visible    = false;
                TimetableControl1.Visible = false;
                e1.Finished        += new EventHandler(e1_Finished);
                e1.Submit          += new EventHandler(e1_Finished);
                ResultGrid1.Visible = false;
                Label_Year.Text     = "";

                if (Request.QueryString.Count >= 1)
                {
                    string type = Request.QueryString["Type"];
                    ViewState.Add("ListType", type);// type = left for past students...
                    if (type == "Student")
                    {
                        string id1  = Request.QueryString["Id"];
                        string name = Request.QueryString["Name"];
                        TextBox_mask.Visible = false;
                        NameList.Visible     = true;
                        Label_Year.Text      = "Single Student";
                        Display_List.Visible = true;
                        ListItem Item = new ListItem(name, id1);
                        NameList.Items.Add(Item); Item.Selected = true; Display(); return;
                    }
                    if (type == "StudentByAdno")
                    {
                        string adno = Request.QueryString["Adno"];
                        try {
                            int         Adno = Convert.ToInt32(adno);
                            SimplePupil p1   = new SimplePupil(); p1.Load_Left(Adno);
                            string      id1  = p1.m_StudentId.ToString();
                            string      name = p1.m_GivenName + " " + p1.m_Surname;
                            TextBox_mask.Visible = false;
                            NameList.Visible     = true;
                            Label_Year.Text      = "Single Student";
                            Display_List.Visible = true;
                            ListItem Item = new ListItem(name, id1);
                            NameList.Items.Add(Item); Item.Selected = true; Display(); return;
                        }
                        catch { }
                    }
                    if ((Request.QueryString["Year"] == "0") || (Request.QueryString["Year"] == ""))
                    {
                        //do mask...
                        TextBox_mask.Visible = true;
                        NameList.Visible     = false;
                        Label_Year.Text      = "Type mask and return";
                        Display_List.Visible = false;
                    }
                    else
                    {
                        Build_NameList(Request.QueryString["Year"]);
                        if (type == "Left")
                        {
                            TextBox_mask.Visible = true;
                        }
                        Label_Year.Text = "Type mask and return";
                        Display();
                    }
                }
                RadioButtonList rbl1 = Display_List;
                try
                {
                    //going to read display keys
                    //StaffIntranet_StudentDetail_Disable
                    Cerval_Configuration c1 = new Cerval_Configuration("StaffIntranet_StudentDetail_Disable");
                    string[]             v1 = c1.Value.Split(',');
                    for (int i = 0; i < 12; i++)
                    {
                        rbl1.Items[i].Enabled = (v1[i] == "1") ? true : false;
                    }
                }
                catch {}
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            string s = Request.QueryString["Year"];

            //YearDisplay(); return;
#if DEBUG
            if (s != null)
            {
                YearDisplay(); return;
            }
#else
#endif
            s = Request.QueryString["Id"];
            StudentAccademicProfile StudentProfile = new StudentAccademicProfile(new Guid(s));
            SimplePupil             p = new SimplePupil(); int KeyStage = 0;
            DateTime date1 = new DateTime(); date1 = DateTime.Now;
            //this is when we load tt etc... so if in summer gap... alter
            if (date1.Month == 8)
            {
                date1 = date1.AddMonths(2);
            }
            StudentProfile.Load_Profile(date1, ref p, ref KeyStage, true);
            StudentIncidentList stinl = new StudentIncidentList();
            stinl.LoadListDate(StudentProfile.StudentId, DateTime.Now.AddMonths(-1), DateTime.Now);

            Double d = 0; int n = 0;
            //so now to display...
            // vary this with Key Stage...???
            string class1 = "";
            s  = "<h3>Academic Profile for " + p.m_GivenName + " " + p.m_Surname + "</h3><br />";
            s += "<table class=\"EventsTable\" > ";
            s += "<tr><th>Subject</th>";
            s += "<th>Current Grade</th>";
            //s += "<th>Prof Grade</th>";
            //s += "<th>Max grade</th>";
            s += "<th>Target Grade </th>";
            s += "<th>Commitment</th>";
            s += "<th>Last Internal Exam</th>";
            s += "<th>Year Average</th>";
            s += "<th>Year Position (percentile)</th>";
            s += "</tr>";
            double margin = 1;
            double xgrade = 20;
            double pgrade = 0;
            string Profile_approx = ""; string Target_approx = "";
            foreach (StudentSubjectProfile sp in StudentProfile.profile)
            {
                s     += "<tr><td>" + sp.course.CourseName + "</td>";
                pgrade = sp.PredictedGrade;
                pgrade = sp.Convert_to_scale(ref xgrade, ref d, ref Target_approx, ref Profile_approx);
                if (sp.latestProfileGrade != null)

                {
                    //pgrade = sp.Convert_to_scale(ref xgrade, ref d,ref Target_approx, ref Profile_approx);
                    margin = xgrade / 2;//half a grade
                    class1 = " class=\"tableHighlight3\"";
                    if ((pgrade - d) > margin)
                    {
                        class1 = " class=\"tableHighlight4\"";
                    }
                    if ((pgrade - d) > 2 * margin)
                    {
                        class1 = " class=\"tableHighlight5\"";
                    }
                    if ((d - pgrade) > margin)
                    {
                        class1 = " class=\"tableHighlight2\"";
                    }
                    if ((d - pgrade) > 2 * margin)
                    {
                        class1 = " class=\"tableHighlight1\"";
                    }
                    if (sp.PredictedGrade == 0)
                    {
                        class1 = " class=\"tableHighlight3\"";
                    }
                    //s += "<td"+class1+" >" + d.ToString() + "</td>";
                    s += "<td" + class1 + " >" + Profile_approx + "</td>";
                    //s+= "<td >" + sp.latestProfileGrade.Value.ToString() + "</td>";
                    //s += "<td >" + sp.latestProfileGradeScale.MaxValue.ToString() + "</td>";
                }
                else
                {
                    s += "<td></td>";
                }
                //s+="<td></td><td></td>";

                //if (pgrade != 0) s += "<td>" + pgrade.ToString() + "</td>";else s += "<td></td>";
                if (pgrade != 0)
                {
                    s += "<td>" + Target_approx + "</td>";
                }
                else
                {
                    s += "<td></td>";
                }
                if (sp.latestCommintmentGrade != null)
                {
                    class1 = " class=\"tableHighlight3\"";
                    d      = System.Convert.ToDouble(sp.latestCommintmentGrade.Value);
                    if (d > 3)
                    {
                        class1 = " class=\"tableHighlight2\"";
                    }
                    if (d > 4)
                    {
                        class1 = " class=\"tableHighlight1\"";
                    }
                    if (d < 2)
                    {
                        class1 = " class=\"tableHighlight4\"";
                    }
                    if (d < 1)
                    {
                        class1 = " class=\"tableHighlight5\"";
                    }
                    s += "<td" + class1 + " >" + sp.latestCommintmentGrade.Value.ToString() + "</td>";
                }
                else
                {
                    s += "<td></td>";
                }

                if (sp.latestInternalExamResult != null)
                {
                    s     += "<td>" + sp.latestInternalExamResult.Value + "</td>";
                    s     += "<td>" + sp.AvgInternalResult.ToString() + "</td>";
                    n      = (int)Round1(100 * ((double)sp.PositionInternalResult / (double)sp.NumberInternalResult));
                    class1 = " class=\"tableHighlight3\"";
                    if (n < 30)
                    {
                        class1 = " class=\"tableHighlight2\"";
                    }
                    if (n < 15)
                    {
                        class1 = " class=\"tableHighlight1\"";
                    }
                    if (n > 70)
                    {
                        class1 = " class=\"tableHighlight4\"";
                    }
                    if (n > 85)
                    {
                        class1 = " class=\"tableHighlight5\"";
                    }
                    s += "<td" + class1 + " >" + n.ToString() + "</td>";
                }
                else
                {
                    s += "<td></td>";
                    s += "<td></td>";
                    s += "<td></td>";
                }
                s += "</tr>";
            }
            s += "</table>";

            content0.InnerHtml = s; s = "";
            if (stinl.m_list.Count > 0)
            {
                Utility u = new Utility();
                s  = "Incdents in past month :<br />";
                s += "<table class=\"EventsTable\" > ";
                s += "<tr><th>Date</th>";
                s += "<th>Text</th>";
                s += "<th>Incident Pairs</th>";
                s += "<th>Staff</th>";
                s += "</tr>";
                foreach (StudentIncident si in stinl.m_list)
                {
                    s += "<tr>";
                    s += "<td>" + si.Date.ToShortDateString() + "</td>";
                    s += "<td>" + si.Text + "</td>";
                    s += "<td>" + si.IncidentPairs + "</td>";
                    s += "<td>" + u.Get_StaffCodefromStaffID(si.StaffID) + "</td>";
                    s += "</tr>";
                }
                s += "</table>";
            }
            else
            {
                s += "No recorded Incidents in past month";
            }
            content1.InnerHtml = 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 />";
            }
        }
예제 #10
0
        protected void Button_FileUpload_Click(object sender, EventArgs e)
        {
            SimplePupil pupil1 = new SimplePupil();

            if (FileUpload_picker.FileName.ToUpper().Contains("WHOLEYEAR"))//should be WholeYear10 or etc
            {
                try
                {
                    string s1 = FileUpload_picker.FileName.Substring(9);
                    if (s1.StartsWith("1"))
                    {
                        s1 = s1.Substring(0, 2);
                    }
                    else
                    {
                        s1 = s1.Substring(0, 1);
                    }
                    int year = System.Convert.ToInt32(s1);
                    int k    = 4;
                    if (year < 10)
                    {
                        k = 3;
                    }
                    if (year > 11)
                    {
                        k = 5;
                    }
                    //need to set up the date for result
                    string   s2          = "";
                    DateTime SetListDate = new DateTime();
                    Utility  u           = new Utility();
                    TextBox2.Text = u.GetResultDate(s1, ref s2, ref SetListDate).ToShortDateString();
                    ProcessYearFile(k);
                    return;
                }
                catch
                {
                }
            }
            string s = "DataUpload_" + TextBox1.Text + "_" + DateTime.Now.ToLongTimeString() + ".txt";

            s = s.Replace(":", "-");
            string path = Server.MapPath(@"../App_Data/") + s;

            //String username = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
            FileUpload_picker.SaveAs(path);
            Stream mystream = FileUpload_picker.FileContent;

            byte[] buffer = new byte[mystream.Length];
            mystream.Read(buffer, 0, (int)mystream.Length);

            Cerval_Library.TextReader text1 = new Cerval_Library.TextReader();
            Cerval_Library.TextRecord t     = new TextRecord();
            FileStream f = new FileStream(path, FileMode.Open);

            while (text1.ReadTextLine(f, ref t) == Cerval_Library.TextReader.READ_LINE_STATUS.VALID)
            {
                //if all goes well col 2 is adno....
                s = t.field[2];
                try
                {
                    pupil1.Load(System.Convert.ToInt32(s));
                    TextBox tst1 = (TextBox)content0.FindControl(pupil1.m_StudentId.ToString());
                    if (tst1 != null)
                    {
                        //so we have the adno of a student in the list...
                        s = t.field[3];//and a grade
                        try
                        {
                            int r = System.Convert.ToInt32(s);
                            if ((r > 0) && (r < 101))
                            {
                                SaveResult(pupil1.m_StudentId.ToString(), s, TextBox3.Text);
                            }
                        }
                        catch
                        {
                        }
                    }
                }
                catch
                {
                }
            }
            f.Close();
            //File.Delete(path);
            Table1.Controls.Clear();
            AddControls(true);
        }
예제 #11
0
        protected void ProcessYearFile(int Key_stage)
        {
            string s = "DataUpload_YearFile_" + DateTime.Now.ToLongTimeString() + ".txt";

            s = s.Replace(":", "-");
            string path = Server.MapPath(@"../App_Data/") + s;

            //String username = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
            FileUpload_picker.SaveAs(path);
            Cerval_Library.TextReader text1 = new Cerval_Library.TextReader();
            Cerval_Library.TextRecord t     = new TextRecord();
            FileStream f  = new FileStream(path, FileMode.Open);
            string     s2 = "";

            string[] Course_Name = new string[20];
            string[] Course_ID   = new string[20];
            text1.ReadTextLine(f, ref t);//header row
            s = t.field[2]; int n = t.number_fields;
            SimplePupil         pupil1 = new SimplePupil();

            if ((s != "Adno") || (n < 4))
            {
                f.Close(); return;
            }

            CourseList cl1 = new CourseList(Key_stage);

            for (int i = 3; i < n; i++)
            {
                Course_Name[i] = t.field[i];
                foreach (Course c in cl1._courses)
                {
                    if (c.CourseCode == Course_Name[i])
                    {
                        Course_ID[i] = c._CourseID.ToString();
                    }
                }
            }

            while (text1.ReadTextLine(f, ref t) == Cerval_Library.TextReader.READ_LINE_STATUS.VALID)
            {
                //if all goes well col 2 is adno....
                s = t.field[2];
                for (int i = 3; i < n; i++)
                {
                    s2 = t.field[i];//result
                    try
                    {
                        pupil1.Load(System.Convert.ToInt32(s));

                        try
                        {
                            int r = System.Convert.ToInt32(s2);
                            if ((r > 0) && (r < 101))
                            {
                                SaveResult(pupil1.m_StudentId.ToString(), s2, Course_ID[i]);
                            }
                        }
                        catch
                        {
                        }
                    }
                    catch
                    {
                    }
                }
            }
            f.Close();
        }
예제 #12
0
        protected void Button_Process_Click(object sender, EventArgs e)
        {
            string       s      = TextBox1.Text;
            TextFileType ftype1 = TextFileType.Unknown;

            try
            {
                ftype1 = (TextFileType)ViewState["TextFileType"];
            }
            catch
            {
                Label_Text.Text = "File Type not recognised"; return;
            }
            if (ftype1 == TextFileType.Unknown)
            {
                Label_Text.Text = "Board Not Set!!!"; 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;
            Exam_Board      eb1    = new Exam_Board();
            SimplePupil     p1     = new SimplePupil();
            ExamComponent   ec1    = new ExamComponent();

            ExamOption exo1 = new ExamOption();
            ExamComponentResultList ecrl1 = new ExamComponentResultList();
            string component_code         = "";
            int    adno1           = 0;
            string Option_Code     = "";
            string ScaledMark      = "";
            string ComponentUMS    = "";
            string ComponentStatus = "";
            string TQM_value       = "";

            int n_Year          = (int)ViewState["n_Year"];
            int n_Season        = (int)ViewState["n_Season"];
            int n_OptionCode    = (int)ViewState["n_OptionCode"];
            int n_TQM           = (int)ViewState["n_TQM"];
            int n_ComponentCode = (int)ViewState["n_ComponentCode"];
            int n_ComponentUMS  = (int)ViewState["n_ComponentUMS"];
            int n_ScaledMark    = (int)ViewState["n_ScaledMark"];
            int n_Status        = (int)ViewState["n_Status"];
            int n_CandNo        = (int)ViewState["n_CandNo"];


            int number_entered = 0;

            //get exam board....
            switch (ftype1)
            {
            case TextFileType.Unknown:
                return;

            case TextFileType.AQA_GCE:
                eb1 = new Exam_Board("70");
                break;

            case TextFileType.OCR_GCE:
                eb1 = new Exam_Board("01");
                break;

            case TextFileType.EDEXCEL_GCE:
                eb1 = new Exam_Board("11");
                break;

            case TextFileType.AQA_GCSE:
                eb1 = new Exam_Board("70");
                break;

            case TextFileType.OCR_GCSE:
                break;

            case TextFileType.EDEXCEL_GCSE:
                eb1 = new Exam_Board("10");
                break;

            case TextFileType.CIE:
                eb1 = new Exam_Board("02");
                break;

            case TextFileType.WJEC_GCSE:
                eb1 = new Exam_Board("40");
                break;

            case TextFileType.WJEC_GCE:
                eb1 = new Exam_Board("41");
                break;

            default:
                break;
            }


            using (StringReader sr = new StringReader(s))
            {
                string firstline = sr.ReadLine();
                string line;

                while ((line = sr.ReadLine()) != null)
                {
                    fields = line.Split(ct1);
                    adno1  = 0; component_code = ""; Option_Code = ""; ScaledMark = ""; ComponentUMS = ""; ComponentStatus = "";

                    adno1 = Convert.ToInt32(fields[n_CandNo]);
                    if (Year.ToString() != fields[n_Year])
                    {
                        Label_Text.Text = "Year code mismatch in file, line" + number_entered.ToString(); return;
                    }
                    if (SeasonCode.ToString() != fields[n_Season].Substring(0, 1))
                    {
                        Label_Text.Text = "Series code mismatch in file, line" + number_entered.ToString(); return;
                    }
                    component_code  = fields[n_ComponentCode];
                    Option_Code     = fields[n_OptionCode];
                    ScaledMark      = fields[n_ScaledMark];
                    ComponentUMS    = fields[n_ComponentUMS];
                    ComponentStatus = fields[n_Status];
                    TQM_value       = fields[n_TQM];

                    ExamComponentResult r = new ExamComponentResult();

                    try
                    {
                        p1.Load_StudentIdOnly(adno1);
                        ec1.Load(component_code, SeasonCode.ToString(), YearCode.ToString());

                        exo1.Load(Option_Code, SeasonCode.ToString(), YearCode.ToString(), eb1.m_ExamBoardId);
                        r.OptionId    = exo1.m_OptionID;
                        r.ComponentId = ec1.m_ComponentID;
                        r.StudentId   = p1.m_StudentId;
                        try
                        {
                            r.ComponentScaledMark = System.Convert.ToInt32(ScaledMark);
                        }
                        catch
                        {
                            //assume it is non integer....
                            double d = Convert.ToDouble(ScaledMark);
                            r.ComponentScaledMark = Convert.ToInt32(d);
                        }
                        try { r.ComponentUMS = System.Convert.ToInt32(ComponentUMS); } catch { }
                        r.ComponentStatus = ComponentStatus;

                        switch (ecrl1.Load_OptionStudent(r.OptionId, r.StudentId, r.ComponentId))
                        {
                        case 0:
                            //so can write in
                            r.Save();
                            break;

                        case 1:
                            //so update
                            r.ComponentResultId = ecrl1.m_list[0].ComponentResultId;
                            r.Save();
                            break;

                        case 2:
                            //so problem
                            break;

                        default:
                            break;
                        }

                        //now find the result....
                        ResultsList rl1 = new ResultsList();
                        rl1.m_parameters = 0;
                        rl1.m_where      = "WHERE (dbo.tbl_Core_Students.StudentId='" + r.StudentId.ToString() + "')AND(dbo.tbl_Core_Results.ExamsOptionId='" + r.OptionId.ToString() + "') ";
                        rl1.LoadList("", "");
                        Result r1 = new Result();
                        r1      = (Result)rl1._results[0];
                        r1.Text = "TQM=" + TQM_value;
                        r1.UpdateResultTextOnly();
                        number_entered++;
                    }
                    catch (Exception ex)
                    {
                        Label_Text.Text = ex.ToString();
                    }
                }
            }
            Label_Text.Text = "Correctly processed... " + number_entered.ToString() + " entries";
        }
예제 #13
0
        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 + "&parameters=" + "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 + "&parameters=" + "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;
        }
예제 #14
0
        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...
            }
        }
예제 #15
0
        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;
            }
        }
예제 #16
0
        protected void Update(string grade)
        {
            SimplePupil p1 = new SimplePupil();

            p1.Load(TextBox2.Text);
            bool        found = false;
            string      s;
            string      s1  = "";
            ResultsList rl1 = new ResultsList();

            rl1.m_parameters = 2; rl1.m_db_field2 = "ResultType"; rl1.m_value2 = "6";
            rl1.LoadList("dbo.tbl_Core_Students.StudentId", p1.m_StudentId.ToString());
            foreach (Result r in rl1._results)
            {
                if (r.CourseID.ToString() == TextBox3.Text)
                {
                    // we have a value...
                    //updtae
                    found = true;
                    s     = "UPDATE tbl_Core_Results SET ResultValue='" + grade + "' ";
                    s    += "WHERE ResultID = '" + r.ResultID.ToString() + "'";
                    Encode en1 = new Encode();
                    en1.ExecuteSQL(s);

                    s1  = "Prediction for " + p1.m_GivenName + " " + p1.m_Surname + "(" + p1.m_adno + ")  for ";
                    s1 += r.Coursename + " changed from " + r.Value + "  to  " + grade + ".   Change made by ";
                    s1 += Context.User.Identity.Name + " on   " + DateTime.Now.ToLongDateString();
                    s1 += "   at  " + DateTime.Now.ToShortTimeString();
                }
            }
            if (!found)
            {
                s  = "INSERT INTO dbo.tbl_Core_Results (ResultType, StudentID, ResultValue, ResultDate, ResultText, ";
                s += "CourseId  )";
                s += " VALUES ( '6', '";
                s += p1.m_StudentId.ToString() + "', '";
                s += grade + "', ";
                DateTime d0 = new DateTime();
                d0 = DateTime.Now;//going to normalise to 17th september in this year....
                DateTime d1 = new DateTime(d0.Year, 9, 17);
                s += " CONVERT(DATETIME, '" + d1.ToString("yyyy-MM-dd HH:mm:ss") + "', 102), '";
                s += " ',  '";
                s += TextBox3.Text + "' )";
                Encode en1 = new Encode();
                en1.ExecuteSQL(s);
                s1  = "New Prediction for " + p1.m_GivenName + " " + p1.m_Surname + "(" + p1.m_adno + ")  for ";
                s1 += TextBox1.Text + "    Grade =  " + grade + ".   Change made by ";
                s1 += Context.User.Identity.Name + " on   " + DateTime.Now.ToLongDateString();
                s1 += "   at  " + DateTime.Now.ToShortTimeString();
            }
            MailHelper mail1 = new MailHelper();
            Utility    u     = new Utility();
            //string from_address = u.GetStaffCodefromContext(Context);
            string from_address = u.GetsStaffCodefromRequest(Request);

            from_address = u.Get_StaffEmailAddress(from_address);
            Cerval_Configuration c = new Cerval_Configuration("StaffIntranet_Predicted_Grade_Notification");

            s = c.Value;
            if (!c.valid)//try revert to config file
            {
                System.Configuration.AppSettingsReader ar = new System.Configuration.AppSettingsReader();
                s = ar.GetValue("Predicted Grade Type", typeof(string)).ToString();
            }


            if (s != "")
            {
                mail1.SendMail(from_address, s, null, s1, "*****@*****.**", "A2 Prediction changed - sent of behalf of :" + from_address);
            }
            Server.Transfer("../content/PredictedGrades.aspx?Set=" + TextBox1.Text);
        }
예제 #17
0
        private void DisplayGroupMSgG(Group gr1)
        {
            Table1.Visible = true;
            Table tb1 = (Table)form1.FindControl("table1"); tb1.Width = 400; tb1.EnableViewState = true;

            tb1.Controls.Clear();
            TableRow         r0      = new TableRow(); tb1.Controls.Add(r0);
            TableCell        c01     = new TableCell(); r0.Controls.Add(c01); SetCellStyle(c01, tb1); c01.Text = "For";
            TableCell        c02     = new TableCell(); r0.Controls.Add(c02); SetCellStyle(c02, tb1); c02.Text = "From";
            TableCell        c03     = new TableCell(); r0.Controls.Add(c03); SetCellStyle(c03, tb1); c03.Text = "Message";
            TableCell        c04     = new TableCell(); r0.Controls.Add(c04); SetCellStyle(c04, tb1); c04.Text = "Deliv'd";
            bool             display = false;
            MessageGroupList mlg1    = new MessageGroupList(); mlg1.LoadList(gr1._GroupID);

            foreach (MessageGroup m1 in mlg1.m_list)
            {
                display = true;
                if (m1._Message.ValidFrom > DateTime.Now)
                {
                    display = false;
                }
                if (m1._Message.ValidUntil < DateTime.Now)
                {
                    display = false;
                }
                //so is valid....
                if (!CheckBox1.Checked)
                {
                    display = !m1.Delivered;                    //only display old msgs if checked....
                }
                if (display)
                {
                    TableRow r1 = new TableRow();
                    AddMsgRow(tb1, r1, m1.Id.ToString(), m1._Message, gr1._GroupCode, true, !m1.Delivered, m1.DateDelivered);
                }
            }
            MessageStudentList ml1 = new MessageStudentList();

            ml1.LoadList_Group(gr1._GroupID, DateTime.Now);
            SimplePupil pupil1 = new SimplePupil();

            foreach (MessageStudent m1 in ml1.m_list)
            {
                display = true;
                if (m1._Message.ValidFrom > DateTime.Now)
                {
                    display = false;
                }
                if (m1._Message.ValidUntil < DateTime.Now)
                {
                    display = false;
                }
                if (!CheckBox1.Checked)
                {
                    display = !m1.Delivered;                    //only display old msgs if checked....
                }
                if (display)
                {
                    pupil1.Load(m1.StudentId);
                    TableRow r1 = new TableRow();
                    AddMsgRow(tb1, r1, m1.Id.ToString(), m1._Message, pupil1.m_GivenName + " " + pupil1.m_Surname, false, !m1.Delivered, m1.DateDelivered);
                }
            }
        }
예제 #18
0
        protected void  LoadData()
        {
            string   credPath = @"d:\\project-id-9301225348112901974-d05770b23edc.json";
            DateTime t1       = new DateTime(); t1 = DateTime.Now;
            string   json     = File.ReadAllText(credPath);

            Newtonsoft.Json.Linq.JObject cr = (Newtonsoft.Json.Linq.JObject)JsonConvert.DeserializeObject(json);
            string private_key = (string)cr.GetValue("private_key");
            string email       = (string)cr.GetValue("Client_email");

            ServiceAccountCredential credential = new ServiceAccountCredential(new ServiceAccountCredential.Initializer("104602038154026657417")
            {
                Scopes = new[] { SheetsService.Scope.Spreadsheets }
            }.FromPrivateKey(private_key));


            // Create the service.
            var service = new SheetsService(new BaseClientService.Initializer()
            {
                HttpClientInitializer = credential,
                ApplicationName       = "CC_Sheets_Service",
            });
            var fred = service.Spreadsheets.Get("10usxblP6yGQTB2VkYeA5xuLUMepf1TuIcyhig4H1ygk");

            fred.IncludeGridData = true;

            String spreadsheetId = "10usxblP6yGQTB2VkYeA5xuLUMepf1TuIcyhig4H1ygk";
            String range         = "Sheet1!A1:AB210";

            SpreadsheetsResource.ValuesResource.GetRequest request = service.Spreadsheets.Values.Get(spreadsheetId, range);
            ValueRange response            = request.Execute();
            IList <IList <Object> > values = response.Values;

            // now who are we??
            Guid    PersonID = new Guid();
            Utility u1       = new Utility();

            PersonID = u1.GetPersonIdfromRequest(Request);
            if (PersonID == new Guid("20744211-d0f0-4e69-af84-020c1023dfda")) //cc
            {
                PersonID = u1.GetPersonIDX(@"CHALLONERS\william.kitchener");  //development
                //PersonID = u1.GetPersonIDX(@"CHALLONERS\George.pickford");//development
            }
            int         adno   = u1.GetAdmissionNumber(PersonID);
            SimplePupil pupil1 = new SimplePupil(); pupil1.Load(adno);

            string s1 = "<p ><h3 align=\"center\">";

            s1 += "Predicted Results for ";
            s1 += pupil1.m_GivenName + " " + pupil1.m_Surname + "</h3></p>";
            s1 += "<br /><TABLE BORDER   class=\"ResultsTbl\"  align=\"center\" >";
            s1 += "<TR><TD>Course Code</TD><TD> Course Name </TD><TD> Grade </TD></TR>";

            int max_cols = values[0].Count;
            int max_rows = values.Count;

            //need to get names for course codes
            CourseList cl1 = new CourseList(5);


            for (var i = 1; i < max_rows; i++)
            {
                string s = (string)values[i][0];
                int    ad2 = System.Convert.ToInt32(s);
                string cse = ""; string cseN = "";

                if (ad2 == adno)
                {
                    max_cols = values[i].Count;
                    for (var j = 5; j < max_cols; j++)
                    {
                        s   = (string)values[i][j];
                        cse = (string)values[0][j];
                        if (s != "")
                        {
                            foreach (Course c in cl1._courses)
                            {
                                if (c.CourseCode == cse)
                                {
                                    cseN = c.CourseName; break;
                                }
                            }

                            //for 2018 only!!!
                            if (cse == "MFA")
                            {
                                cseN = "Further Maths";
                            }
                            ; if (cse == "MF")
                            {
                                cseN = "Mathematics";
                            }

                            s1 += "<TR><TD>" + cse + "</TD><TD> " + cseN + "</TD><TD> " + s + " </TD></TR>";
                        }
                        cseN = "";
                    }
                    break;
                }
            }
            s1 += "</TABLE></br>";
            TimeSpan ts1 = new TimeSpan(); ts1 = DateTime.Now - t1;

            s1 += "Time Taken :  " + ts1.TotalSeconds.ToString() + "<br/>";
            content.InnerHtml = s1;
        }
        protected string GenerateVA(string GroupID, string GroupName)
        {
            string         s = ""; string s1 = ""; List <VAresult> list1 = new List <VAresult>();
            PupilGroupList pgl = new PupilGroupList(); pgl.AddToList(new Guid(GroupID), DateTime.Now);
            //going to get the data
            double xgrade = 0;
            double x1     = 0;
            double x2     = 0;

            foreach (SimplePupil p in pgl.m_pupilllist)
            {
                StudentAccademicProfile StudentProfile = new StudentAccademicProfile(p.m_StudentId);
                int      KeyStage = 0;
                DateTime date1    = new DateTime(); date1 = DateTime.Now;
                //this is when we load tt etc... so if in summer gap... alter
                if (date1.Month == 8)
                {
                    date1 = date1.AddMonths(2);
                }
                SimplePupil p1 = new SimplePupil(); p1 = p;
                StudentProfile.Load_Profile(date1, ref p1, ref KeyStage, false);
                string Profile_approx = ""; string Target_approx = "";
                foreach (StudentSubjectProfile sp in StudentProfile.profile)
                {
                    try
                    {
                        if (sp.latestProfileGrade != null)
                        {
                            x2 = sp.Convert_to_scale(ref xgrade, ref x1, ref Target_approx, ref Profile_approx);
                            VAresult v1 = new VAresult();
                            v1.adno   = p1.m_adno.ToString();
                            v1.course = sp.course.CourseCode;
                            //v1.profile = x1.ToString();
                            v1.profile = Profile_approx;
                            //v1.predict = x2.ToString();
                            v1.predict = Target_approx;
                            v1.surname = p.m_Surname; v1.givename = p.m_GivenName;
                            v1.x1      = x1; v1.x2 = x2;
                            v1.xgrade  = xgrade;
                            list1.Add(v1);
                        }
                    }
                    catch {  }
                }
            }

            //find all the courses in the list...
            List <string> courselist = new List <string>();
            bool          found      = false;

            foreach (VAresult v in list1)
            {
                found = false;
                foreach (string s4 in courselist)
                {
                    if (s4 == v.course)
                    {
                        found = true; break;
                    }
                }
                //not found
                if (!found)
                {
                    courselist.Add(v.course);
                }
            }
            courselist.Sort();
            //find all the students
            List <string> adnolist = new List <string>();

            foreach (VAresult v in list1)
            {
                found = false;
                foreach (string s4 in adnolist)
                {
                    if (s4 == v.adno)
                    {
                        found = true; break;
                    }
                }
                //not found
                if (!found)
                {
                    adnolist.Add(v.adno);
                }
            }
            string [,] list2 = new string[adnolist.Count + 3, 2 * courselist.Count + 6];
            double [,] list3 = new double[adnolist.Count + 3, 2 * courselist.Count + 6];
            double [,] listx = new double[adnolist.Count + 3, 2 * courselist.Count + 6];
            int i = 3;

            foreach (string s5 in courselist)
            {
                list2[0, i] = s5; i++;
                list2[0, i] = s5; i++;
            }
            int j = 1;

            foreach (VAresult v in list1)
            {
                if (list2[j, 0] != v.adno)
                {
                    j++; list2[j, 0] = v.adno; list2[j, 1] = v.givename; list2[j, 2] = v.surname;
                }
                //now find the course
                i = 3;
                foreach (string s5 in courselist)
                {
                    if (s5 == v.course)
                    {
                        list2[j, i]     = v.predict;
                        list2[j, i + 1] = v.profile;
                        list3[j, i]     = v.xgrade;
                        list3[j, i + 1] = v.xgrade;
                        listx[j, i]     = v.x2;
                        listx[j, i + 1] = v.x1;
                        break;
                    }
                    i++; i++;
                }
            }
            s  = "<h2><p align=\"center\"> Latest Profile Score v Predicted Grade </p></h2>";
            s += "<div><p  align=\"center\"><table class=\"EventsTable\"> ";
            s += "<TR><TD >Cells have:   </TD><td>course</br>Profile Grade</br>Predicted Grade</td>";
            s += "<td>Predictions are from Alis (KS5) / ";
            s += " Yellis (KS4)</br>Points are UCAS at KS5 (A=120) and GCSE at KS4 (A=52 or new 1-9 scale)</td>";
            s += "</tr></table></p>";
            s += "Colour indicates how far they exceed / failed to reach target";
            s += "<table class=\"EventsTable\"> ";
            s += "<TR><TD class= \"tableHighlight1\">Exceed by 1 grade</TD>";
            s += "<TD class= \"tableHighlight2\">Exceed by 0.5 grade</TD>";
            s += "<TD class= \"tableHighlight4\">Below by 0.5 grade</TD>";
            s += "<TD class= \"tableHighlight5\">Below by 1 grade</TD>";
            s += "</tr></table></div>";
            s += "<p  align=\"center\"><table class=\"EventsTable\"> ";
            s += "<TR><td>Adno</td><TD>Given Name</TD><TD>Surname</TD>";
            s += "<TD>Subjects</TD><TD>...............</TD></TR>";

            for (int i1 = 1; i1 < adnolist.Count + 2; i1++)
            {
                s += "<tr>";
                for (int j1 = 0; j1 < 3; j1++)
                {
                    s += "<td>" + list2[i1, j1] + "</td>";
                }

                for (int j1 = 4; j1 < 2 * courselist.Count + 4; j1 = j1 + 2)
                {
                    s1 = "<td>" + list2[0, j1] + "</br>";
                    try
                    {
                        x1     = listx[i1, j1];
                        x2     = listx[i1, j1 - 1];
                        xgrade = list3[i1, j1];
                        double xd = x2 - x1;
                        if (x1 > 0)
                        {
                            if (x2 > 0)
                            {
                                if (xd > xgrade / 2)
                                {
                                    s1 = "<td class= \"tableHighlight4\" >" + list2[0, j1] + "</br>";
                                    if (xd > xgrade)
                                    {
                                        s1 = "<td class= \"tableHighlight5\" >" + list2[0, j1] + "</br>";
                                    }
                                }
                                else if (xd < -xgrade / 2)
                                {
                                    s1 = "<td class= \"tableHighlight2\" >" + list2[0, j1] + "</br>";
                                    if (xd < -xgrade)
                                    {
                                        s1 = "<td class= \"tableHighlight1\" >" + list2[0, j1] + "</br>";
                                    }
                                }
                                //s1 += x1.ToString() + "</br>";
                                //s1 += x2.ToString();
                                s1 += list2[i1, j1] + "</br>";
                                s1 += list2[i1, j1 + 1];
                            }
                            else
                            {
                                s1  = "<td>" + list2[0, j1] + "</br>";
                                s1 += x1.ToString() + "</br>";
                            }
                        }
                        else
                        {
                            s1 = "<td></br>";
                        }
                    }
                    catch { };

                    s += s1 + "</TD>";
                }
                s += "</tr>";
            }
            s += "</table></div></p>";


            //going to add to pure data table....


            s += "</br><h2><p align=\"center\"> Data as flat table for copying to sheets etc. </p></h2></br>";
            s += "</p><div><p  align=\"center\"><table class=\"EventsTable\"> ";
            s += "<TR><td>Adno</td><TD>Given Name</TD><TD>Surname</TD>";
            s += "<TD>Subjects</TD><TD>Always prediction then Profile...</TD></TR>";
            for (int i1 = 0; i1 < adnolist.Count + 2; i1++)
            {
                s += "<tr>";
                for (int j1 = 0; j1 < 2 * courselist.Count + 4; j1 = j1 + 2)
                {
                    s += "<td>" + list2[i1, j1] + "</td>";
                    s += "<td>" + list2[i1, j1 + 1] + "</td>";
                }
                s += "</tr>";
            }
            s += "</table></div></p>";
            return(s);
        }
예제 #20
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Encode en = new Encode();

            ExamsEntries_sql.SelectCommand    = CreateQueryString();
            ExamsEntries_sql.ConnectionString = en.GetCervalConnectionString();
            ExamsYears_sql.ConnectionString   = en.GetCervalConnectionString();
            GridView1.RowCommand += new GridViewCommandEventHandler(GridView1_RowCommand);
            if (!IsPostBack)
            {
                Utility u           = new Utility();
                string  exam_season = Request.QueryString["ExamSeason"];
                string  exam_year   = Request.QueryString["ExamYear"];
                string  type        = Request.QueryString["Task"];
                //string staff_code = u.GetStaffCodefromContext(Context);
                string staff_code = u.GetsStaffCodefromRequest(Request);
                string qual       = "GCSE";
                string item       = "C";
                ExamsEntries_Modules_sql.ConnectionString = en.GetCervalConnectionString();
                ExamsEntries_Modules_sql.SelectCommand    = "SELECT DISTINCT [OptionCode], [OptionTitle] FROM [qry_Cerval_Exams_Entries] WHERE (ExamYear ='" + exam_year + "') AND (ExamSeason ='" + exam_season + "' ) AND (OptionQualification = '" + qual + "' )  AND (OptionItem = '" + item + "' ) ORDER BY [OptionTitle]";
                Label_ExamYear.Text   = exam_year;
                Label_ExamSeason.Text = exam_season;
                Label_staffCode.Text  = staff_code;
                DropDownList_ExamYear.DataBind();

                //todo list in reverse
                for (int i = 0; i < DropDownList_ExamYear.Items.Count; i++)
                {
                    if (DropDownList_ExamYear.Items[i].Text == exam_year)
                    {
                        DropDownList_ExamYear.SelectedIndex = i;
                    }
                }
                for (int i = 0; i < DropDownList1.Items.Count; i++)
                {
                    if (DropDownList1.Items[i].Value.ToString() == exam_season)
                    {
                        DropDownList1.SelectedIndex = i;
                    }
                }
                Label_type.Text = type;
                if (type == "SubjectEntries")
                {
                    visibility(1);
                }
                if (type == "Student")
                {
                    visibility(2);
                    string studentID = Request.QueryString["StudentID"];
                    Label_StudentID.Text = studentID;
                    SimplePupil p1 = new SimplePupil(); p1.Load(studentID);
                    Label_name.Text  = p1.m_GivenName + "  " + p1.m_Surname + " (" + p1.m_adno.ToString() + ")";
                    Label_Title.Text = Label_name.Text;
                }
                if (type == "mylist")
                {
                    visibility(1);
                }
                ExamsEntries_sql.SelectCommand = CreateQueryString();
                GridView1.DataBind();
            }
        }
예제 #21
0
        protected void Button_Process_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;
            int             number_entered = 0;

            using (StringReader sr = new StringReader(s))
            {
                string firstline = sr.ReadLine();
                string line;
                while ((line = sr.ReadLine()) != null)
                {
                    fields = line.Split(ct1);

                    switch (ftype1)
                    {
                    case TextFileType.Unknown:
                        Label_Text.Text = "File Type not recognised";
                        break;

                    case TextFileType.Students:       //Admission Number,Surname, GivenName,Board,Syllabus,Option...";
                        try
                        {
                            Exam_Board exbde1 = Ec.GetExamBoard(fields[3]);
                            pupil1.Load_StudentIdOnly(System.Convert.ToInt32(fields[0]));    ///loads lft students aswell
                            if (!u.AddEntry(pupil1.m_StudentId, exbde1, Year, YearCode, SeasonCode, fields[5], 3, true, ref ErrorMsg, ref g1))
                            {
                                Label_Text.Text = ErrorMsg; return;
                            }
                            else
                            {
                                number_entered++;
                            }
                        }
                        catch (Exception ex)
                        {
                            Label_Text.Text = ex.ToString(); return;
                        }
                        break;

                    case TextFileType.Sets:          //Set, Board, Syllabus, Option.
                        pgl.m_pupilllist.Clear();
                        pgl.AddToList(fields[0], DateTime.Now);

                        foreach (SimplePupil p in pgl.m_pupilllist)
                        {
                            try
                            {
                                Exam_Board exbde1 = Ec.GetExamBoard(fields[1]);
                                if (!u.AddEntry(p.m_StudentId, exbde1, Year, YearCode, SeasonCode, fields[3], 3, true, ref ErrorMsg, ref g1))
                                {
                                    Label_Text.Text = ErrorMsg; return;
                                }
                                else
                                {
                                    number_entered++;
                                }
                            }
                            catch (Exception ex)
                            {
                                Label_Text.Text = ex.ToString(); return;
                            }
                        }
                        break;

                    default:
                        break;
                    }
                }
            }
            Label_Text.Text = "Correctly processed... " + number_entered.ToString() + " entries";
        }