Пример #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 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);
        }
        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 />";
            }
        }
Пример #6
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);
        }
Пример #7
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();
        }
Пример #8
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;
        }
Пример #9
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...
            }
        }
Пример #10
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();
            }
        }
Пример #11
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);
                }
            }
        }
Пример #12
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;
        }