コード例 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //going to try to get from iSAMS data
                iSAMSLoad(); return;

                Utility  u1 = new Utility();
                DateTime t1 = new DateTime();
                DateTime t0 = new DateTime();
                t0 = DateTime.Now;
                t1 = t0.AddMonths(6);
                t0 = t0.AddMonths(-1);
                //SO   in future and up to 1 month in the past
                //string season = u1.ThisSeason(t0);

                //season = "3";

                ArrayList m_list   = new ArrayList();
                Guid      PersonID = new Guid();
                PersonID = u1.GetPersonIdfromRequest(Request);


#if DEBUG
                PersonID = u1.GetPersonIDX(@"CHALLONERS\charles.manning");//development
#endif

                //check they have read the exams notice...

                //string y = t0.Year.ToString();
                //bool v = false;
                //WarningNoticeRead w = new WarningNoticeRead(u1.GetStudentId(PersonID), u1.ThisSeason(t0), y, ref v);
                //if (!v)
                //{
                //Server.Transfer("ExamWarnings.aspx");//go and make them read the notice...
                //}

                PupilDetails p1 = new PupilDetails(u1.GetStudentId(PersonID).ToString());
                {
                    string s0 = "";
                    string s  = "PersonImagePage.aspx?id=" + p1.m_PersonId.ToString();
                    s  = "\"" + s;
                    s += "\" width = \"110\" height=\"140\"";
                    s  = "<FONT FACE = \"Arial\"><p align=\"center\"> <img src=" + s + "></p>";
                    s += "<p align=\"center\">This page should be printed and brought to all exams</p>";
                    {
                        s += "<center><h2>Exam Timetable for " + p1.m_GivenName + "  " + p1.m_Surname + "</h2></center>";
                        StudentSENList sen1 = new StudentSENList(p1.m_StudentId.ToString()); s0 = "";
                        foreach (StudentSEN s1 in sen1.m_List)
                        {
                            if (s1.m_ExamsExtraTime > 0)
                            {
                                s0 += "Extra Time (" + s1.m_ExamsExtraTime.ToString() + "%)  ";
                            }
                            if (s1.m_ExamsCanType)
                            {
                                s0 += " Can Type(Please report to IT4 for any exam where you wish to type)";
                            }
                        }
                        if (s0 != "")
                        {
                            s += "<center><h3>" + s0 + "</h3></center>";
                        }
                        ScheduledComponentList scl1 = new ScheduledComponentList();
                        t0 = t0.AddMonths(-3);
                        scl1.LoadList_Student(t0, t1, p1.m_StudentId.ToString());
                        SimpleRoom room1 = new SimpleRoom();
                        s += "<BR><center><TABLE BORDER><TR>";
                        s += "<Th>Date</Th>";
                        s += "<Th>Day</Th>";
                        s += "<Th>Start Time</Th>";
                        s += "<Th>End Time</Th>";
                        s += "<Th>Paper Code</Th>";
                        s += "<Th>Paper Name</Th>";
                        s += "<Th>Room</Th>";
                        s += "<Th>Desk</Th></TR>";
                        foreach (ScheduledComponent sc in scl1.m_List)
                        {
                            s += "<TR><TD>" + sc.m_Date.ToShortDateString() + "</TD>";
                            s += "<TD>" + sc.m_Date.DayOfWeek.ToString() + "</TD>";
                            t1 = sc.m_Date;
                            s += "<TD>" + sc.m_Date.ToShortTimeString() + "</TD>";
                            t1 = t1.AddMinutes(sc.m_TimeAllowed);
                            s += "<TD>" + t1.ToShortTimeString() + "</TD>";
                            s += "<TD>" + sc.m_ComponentCode + "</TD>";
                            s += "<TD>" + sc.m_ComponentTitle.ToLower() + "</TD>";
                            if (sc.m_RoomId != Guid.Empty)
                            {
                                room1.Load(sc.m_RoomId.ToString());
                                s += "<TD>" + room1.m_roomcode + "</TD>";
                            }
                            else
                            {
                                s += "<TD>not yet assigned</TD>";
                            }

                            s += "<TD>" + sc.m_Desk + "</TD></TR>";
                        }
                        s += "</TABLE></center>";
                    }
                    s += "<br><center><h3>Candidate Number = " + p1.m_examNo.ToString() + " , UCI=" + p1.m_UCI + "</h3></center></Font>";
                    servercontent.InnerHtml = s;
                }
            }
        }
コード例 #2
0
        private void SetupDeskGrid(DateTime t1, DateTime t2)
        {
            System.Drawing.Color[] cell_colours = GetColors();

            Label_DeskDate.Text = t1.ToLongDateString();
            //setup dropdown list of rooms...
            List <Guid> Rooms = new List <Guid>();


            //need to load all rooms used...


            string s = "SELECT DISTINCT RoomId FROM  dbo.tbl_Exams_ScheduledComponents ";

            s += " WHERE (DateTime > CONVERT(DATETIME,'" + t1.ToString("yyyy-MM-dd HH:mm:ss") + "',102) ) ";
            s += " AND (DateTime < CONVERT(DATETIME,'" + t2.ToString("yyyy-MM-dd HH:mm:ss") + "',102) ) ";
            Encode en = new Encode();

            using (SqlConnection cn = new SqlConnection(en.GetDbConnection()))
            {
                cn.Open();
                using (SqlCommand cm = new SqlCommand(s, cn))
                {
                    using (SqlDataReader dr = cm.ExecuteReader())
                    {
                        while (dr.Read())
                        {
                            if (dr.IsDBNull(0))
                            {
                                Rooms.Add(Guid.Empty);
                            }
                            else
                            {
                                Rooms.Add(dr.GetGuid(0));
                            }
                        }
                        dr.Close();
                    }
                }
                cn.Close();
            }

            if ((Rooms.Count == 1) && (Rooms[0] == Guid.Empty))
            {
                Label_message.Text    = " No Rooms Allocated...";
                Label_message.Visible = true;
            }

            DropDownListDeskRooms.Items.Clear();
            SimpleRoom r1 = new SimpleRoom();

            foreach (Guid d in Rooms)
            {
                r1.Load(d.ToString());
                ListItem l = new ListItem(r1.m_roomcode, d.ToString());
                DropDownListDeskRooms.Items.Add(l);
            }


            //need to find all the changes...
            DateTime t0 = new DateTime(); t0 = t1;
            ScheduledComponentList scl1 = new ScheduledComponentList(); scl1.LoadList_Date(t1, t2);

            while (GoToNextChange(ref t0, scl1, Rooms[0]))
            {
                ListItem l = new ListItem(t0.AddMinutes(-1).ToShortTimeString(), t0.ToString());
                DropDownListDeskTimes.Items.Add(l);
            }

            UpdateDeskGrid();
        }
コード例 #3
0
        protected void Button_ShowTimetable_Click(object sender, EventArgs e)
        {
            GridView1.Visible = false;
            visibility(3);
            string       studentID = Label_StudentID.Text;
            PupilDetails p1        = new PupilDetails(studentID);
            {
                Utility  u1 = new Utility();
                DateTime t1 = new DateTime();
                DateTime t0 = new DateTime();
                t0 = DateTime.Now;
                t1 = t0.AddMonths(6);
                t0 = t0.AddMonths(-2);
                //string season = u1.ThisSeason(t0);
                ArrayList m_list = new ArrayList();

                string s = "PersonImagePage.aspx?id=" + p1.m_PersonId.ToString();
                s  = "\"" + s;
                s += "\" width = \"110\" height=\"140\"";
                Response.Write("<FONT FACE = \"Arial\"><p align=\"center\"> <img src=" + s + "></p>");
                {
                    Response.Write("<br><center><h2>Exam Timetable for " + p1.m_GivenName + "  " + p1.m_Surname + "</h2></center>");
                    StudentSENList sen1 = new StudentSENList(p1.m_StudentId.ToString()); s = "";
                    foreach (StudentSEN s1 in sen1.m_List)
                    {
                        if (s1.m_ExamsExtraTime > 0)
                        {
                            s += "Extra Time (" + s1.m_ExamsExtraTime.ToString() + "%)  ";
                        }
                        if (s1.m_ExamsCanType)
                        {
                            s += "  Can Type ";
                        }
                    }
                    if (s != "")
                    {
                        s = "<center><h3>" + s + "</h3></center>";
                        Response.Write(s);
                    }
                    ScheduledComponentList scl1 = new ScheduledComponentList();
                    scl1.LoadList_Student(t0, t1, studentID);
                    SimpleRoom room1 = new SimpleRoom();
                    Response.Write("<BR><p  align=\"center\" ><TABLE BORDER><TR>");
                    s = "Date"; Response.Write("<TD>" + s + "</TD>");
                    s = "Day"; Response.Write("<TD>" + s + "</TD>");
                    s = "Start Time"; Response.Write("<TD>" + s + "</TD>");
                    s = "End Time"; Response.Write("<TD>" + s + "</TD>");
                    s = "Paper Code"; Response.Write("<TD>" + s + "</TD>");
                    s = "Paper Name"; Response.Write("<TD>" + s + "</TD>");
                    s = "Room"; Response.Write("<TD>" + s + "</TD>");
                    s = "Desk"; Response.Write("<TD>" + s + "</TD>");
                    Response.Write("</TR>");
                    foreach (ScheduledComponent sc in scl1.m_List)
                    {
                        Response.Write("<TR>");
                        s  = sc.m_Date.ToShortDateString(); Response.Write("<TD>" + s + "</TD>");
                        s  = sc.m_Date.DayOfWeek.ToString(); Response.Write("<TD>" + s + "</TD>");
                        t1 = sc.m_Date;
                        s  = sc.m_Date.ToShortTimeString(); Response.Write("<TD>" + s + "</TD>");
                        t1 = t1.AddMinutes(sc.m_TimeAllowed);
                        s  = t1.ToShortTimeString(); Response.Write("<TD>" + s + "</TD>");
                        s  = sc.m_ComponentCode; Response.Write("<TD>" + s + "</TD>");
                        s  = sc.m_ComponentTitle.ToLower(); Response.Write("<TD>" + s + "</TD>");
                        if (sc.m_RoomId != Guid.Empty)
                        {
                            room1.Load(sc.m_RoomId.ToString());
                            s = room1.m_roomcode; Response.Write("<TD>" + s + "</TD>");
                        }
                        else
                        {
                            Response.Write("<TD>not yet assigned</TD>");
                        }

                        s = sc.m_Desk; Response.Write("<TD>" + s + "</TD>");
                        Response.Write("</TR>");
                    }
                    Response.Write("</TABLE>");
                }
                Response.Write("<br><center><h3>Candidate Number = " + p1.m_examNo.ToString() + " , UCI=" + p1.m_UCI + "</h3></center></Font>");
            }
        }
コード例 #4
0
        protected bool AllocateDesksRoom(Guid roomid, DateTime t1, DateTime t2, ref string ErrorS)
        {
            ScheduledComponentList scl2 = new ScheduledComponentList();

            scl2.LoadList_Room(t1, t2, roomid, " ORDER BY DateTime ASC, TimeAllowed DESC, ComponentId DESC, StudentExamNumber ASC");
            if (scl2.m_List.Count == 0)
            {
                return(true);
            }
            ExamRoom               exr1 = new ExamRoom(); exr1.Load(roomid);
            SimpleRoom             room1 = new SimpleRoom(); room1.Load(roomid.ToString());
            ScheduledComponentList scl3 = new ScheduledComponentList();//used to check room empty below
            string             s = ""; bool found = false;
            int                column = 1; int desk = 1; int desk_inc = 1;
            DateTime           time_last     = new DateTime(2000, 1, 1);
            DateTime           time_first    = new DateTime(2000, 1, 1);
            bool               room_full     = false;
            int                no_components = 1;
            ScheduledComponent scX           = new ScheduledComponent();

            scX = (ScheduledComponent)scl2.m_List[0];
            foreach (ScheduledComponent sc in scl2.m_List)
            {
                if (scX.m_ComponentId != sc.m_ComponentId)
                {
                    scX = sc; no_components++;
                }
            }

            int Free_space_min = (exr1.m_capacity - scl2.m_List.Count) / no_components;

            //when we enter no deska allocated to this room so exr1.m_capacity is capacity
            //if we have n students and m components and (capacity -n)> m then we can try to insert gaps...
            // n< scl2.count ( might have later components...


            scX = (ScheduledComponent)scl2.m_List[0];
            foreach (ScheduledComponent sc in scl2.m_List)
            {
                if (scX.m_ComponentId != sc.m_ComponentId)
                {
                    //new component...
                    scX = sc;
                    //if space insert blamk row
                    if ((exr1.columns[column].count < Free_space_min) && (CheckBox1.Checked))
                    {
                        desk = 1; column++; column++;
                    }
                }
                if ((sc.m_Date > time_last) && ((column != 1) || (desk != 1)))
                {
                    scl3.LoadList_Room(sc.m_Date.AddMinutes(-10), sc.m_Date, roomid, "");
                    if (scl3.m_List.Count == 0)
                    {
                        //DialogResult d = MessageBox.Show("It looks as if we can reset the desk alocations at " + sc.m_Date.ToShortTimeString() + ". Are you sure you wna to do this... ie do we have two separate internal exmas in the same session?", "Warning while rooming " + room1.m_roomcode, MessageBoxButtons.YesNo);
                        //if (d == DialogResult.Yes)
                        {
                            column     = 1; desk = 1; desk_inc = 1;
                            time_last  = sc.m_Date.AddMinutes(sc.m_TimeAllowed);
                            time_first = sc.m_Date.AddMinutes(-1);
                        }
                    }
                }

                if (sc.m_Date.AddMinutes(sc.m_TimeAllowed) > time_last)
                {
                    time_last = sc.m_Date.AddMinutes(sc.m_TimeAllowed);
                }

                //assign the lad a desk.....
                //unless he already has one!!!!

                found = false;
                s     = exr1.columns[column].name + desk.ToString();
                foreach (ScheduledComponent sc1 in scl2.m_List)
                {
                    if ((sc1.m_StudentId == sc.m_StudentId) && (sc1.m_Date > time_first))
                    {
                        if (sc1.m_Desk != "")
                        {
                            s = sc1.m_Desk; found = true; break;//he already had  one
                        }
                    }
                }

                sc.m_Desk = s;
                if (!found)
                {//we have added one....
                    if (room_full)
                    {
                        ErrorS = "Room capacity exceeded....." + sc.m_ExamNumber.ToString() + ":" + sc.m_Surname + " " + sc.m_Givenname + "..." + sc.m_ComponentTitle;
                        return(false);
                    }
                    desk = desk + desk_inc;
                    if (desk > exr1.columns[column].count)
                    {
                        column++;
                        desk     = exr1.columns[column].count;
                        desk_inc = desk_inc * (-1);
                    }
                    if (desk < 1)
                    {
                        desk_inc = desk_inc * (-1);
                        desk     = 1;
                        column++;
                    }
                }
                sc.Save();
                //check if we have exceeded capacity!
                if (column > exr1.no_columns + 1)
                {
                    room_full = true;
                }
            }
            return(true);
        }