コード例 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                PhysicsBooking pb1 = new PhysicsBooking();
                string         s   = Request.UrlReferrer.OriginalString;
                ViewState.Add("booking", pb1);
                ViewState.Add("ref", s);
                pb1.Load(Request.Params.Get("Id"));
                SimpleStaff staff1 = new SimpleStaff(pb1.StaffId);
                SimpleRoom  room1  = new SimpleRoom(pb1.RoomId);
                Period      p1     = new Period(pb1.PeriodId);
                s  = "<h3>Booking for " + pb1.Date.ToShortDateString() + "   " + p1.m_periodname;
                s += "<br/>Staff:  " + staff1.m_StaffCode + "       Room: " + room1.m_roomcode + "</br>";
                s += "<p  align=\"center\"><TABLE BORDER  class= \"ResultsTbl\" ><TR><TD>Item</TD><TD>Location</TD></tr> ";
                PhysicsEquipmentItemList list1 = new PhysicsEquipmentItemList(); list1.LoadList(pb1);
                foreach (PhysicsEquipmentItem i in list1.m_list)
                {
                    s += "<tr><td>" + i.EquipmentItemCode + "</td><td>" + i.EquipmentItemLocation + "</td></tr>";
                }
                s += "</table>";

                servercontent.InnerHtml = s + "<br/>Notes:<br/>" + pb1.Notes + "<br/>";
            }
        }
コード例 #2
0
        public IActionResult Index(SimpleRoom model)
        {
            model.FloorArea   = model.Width * model.Length;
            model.Volume      = model.Width * model.Length * model.Height;
            model.WallArea    = (2 * (model.Width * model.Height)) + (2 * (model.Length * model.Height));
            model.PaintLitres = (model.WallArea / model.PaintCoverage) * model.PaintCoats;

            return(View(model));
        }
コード例 #3
0
        public void InitHandlers()
        {
            CoOrdinate currentRoom = new CoOrdinate(3, 3);

            RobotHardware.IHardwareRobot cleaningRobot     = new RobotHardware.Hardware(currentRoom.X, currentRoom.Y);
            IRobotVisitMonitor           robotVisitMonitor = RobotVisitMonitorFactory.CreateRobotVisitMonitor(
                RobotVisitMonitorType.RobotVisitMonitorWithConsoleOutput, cleaningRobot);
            Room room = new SimpleRoom();

            _algorithmEssentials = new AlgorithmEssentials(room, cleaningRobot, robotVisitMonitor);

            _firstObstacleHandler           = new ObstacleHandler(_algorithmEssentials);
            _obstacleHandlerWithCellRevisit = new ObstacleHandler(_algorithmEssentials, true);
        }
コード例 #4
0
    void Start()
    {
        GameManager    = GameObject.Find("GameManager").GetComponent <GameManager>();
        simpR          = transform.parent.GetComponent <SimpleRoom>();
        doorController = transform.parent.Find("DoorController").GetComponent <DoorController>();

        if (GameManager.currentGameLevel == 1)
        {
            enemies.Add(Resources.Load("Worm") as GameObject);
            enemies.Add(Resources.Load("Ghost") as GameObject);
        }

        var spawnPoints = GetValidSpawns();

        for (int i = 0; i <= simpR.EnemyCount; i++)
        {
            var        posA = spawnPoints[Random.Range(0, (spawnPoints.Count - 1))];
            GameObject mob  = Instantiate(enemies[Random.Range(0, (enemies.Count - 1))], posA, Quaternion.identity);
            mob.transform.parent        = transform.parent.Find("Tiles").transform;
            mob.transform.localPosition = posA;
        }
    }
コード例 #5
0
        private void UpdateDisplay()
        {
            string[, ,] grid = new string[6, 30, 2];  int j1;
            for (int i = 0; i < 6; i++)
            {
                for (int j = 0; j < 30; j++)
                {
                    grid[i, j, 0] = "";
                }
            }
            //setup for 5 P labs....
            grid[0, 0, 0] = "P1"; grid[0, 1, 0] = "P2"; grid[0, 2, 0] = "P3"; grid[0, 3, 0] = "P4"; grid[0, 4, 0] = "P5";
            int    n_rows = 5;
            string s      = "";

            s  = "<div><h3>Bookings for " + Calendar1.SelectedDate.ToShortDateString() + "</h3></div>";
            s += "<p  align=\"center\"><TABLE BORDER  class= \"ResultsTbl\" ><TR><TD>Room</TD> ";
            s += "<TD>Period 1</TD><TD>Period 2</TD><TD>Period 3</TD><TD>Period 4</TD><TD>Period 5</TD></tr>";
            PhysicsBookingList pblist1 = new PhysicsBookingList();

            pblist1.LoadList_Date(Calendar1.SelectedDate);
            if (pblist1.m_list.Count > 0)
            {
                foreach (PhysicsBooking p in pblist1.m_list)
                {
                    SimpleRoom  room1 = new SimpleRoom(p.RoomId);
                    Period      p1    = new Period(p.PeriodId);
                    int         p2    = System.Convert.ToInt32(p1.m_periodcode);
                    SimpleStaff s1    = new SimpleStaff(p.StaffId);
                    j1 = -1;
                    for (int j = 0; j < n_rows; j++)
                    {
                        if (grid[0, j, 0] == room1.m_roomcode.Trim())
                        {
                            j1 = j; break;
                        }
                    }
                    if (j1 == -1)
                    {
                        grid[0, n_rows, 0] = room1.m_roomcode.Trim(); j1 = n_rows; n_rows++;
                    }
                    grid[p2, j1, 0] = s1.m_StaffCode + ":<br/>";
                    grid[p2, j1, 1] = p.BookingId.ToString();
                    PhysicsEquipmentItemList ff = new PhysicsEquipmentItemList();
                    ff.LoadList(p);
                    foreach (PhysicsEquipmentItem i in ff.m_list)
                    {
                        grid[p2, j1, 0] += i.EquipmentItemCode + ",  ";
                    }
                }
                for (int j = 0; j < n_rows; j++)
                {
                    s += "<tr>";
                    for (int i = 0; i < 6; i++)
                    {
                        s += "<td>";
                        if (grid[i, j, 0] == "")
                        {
                        }
                        else
                        {
                            if (i != 0)
                            {
                                s += "<A HREF=\"DisplayBooking.aspx?Id=" + grid[i, j, 1] + " \">Booking</A>";
                                s += "<br/>staff: ";
                            }
                            s += grid[i, j, 0] + "<br/>";
                        }
                        s += "</td>";
                    }
                    s += "</tr>";
                }
                s += "</table><br/>";
            }
            else
            {
                s += "</table><br/>No Bookings on this date<br/>";
            }
            s += "</table>";
            servercontent.InnerHtml = s;
        }
コード例 #6
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;
                }
            }
        }
コード例 #7
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>");
            }
        }
コード例 #8
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();
        }
コード例 #9
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);
        }
コード例 #10
0
 public SimpleBuilder()
 {
     _simpleRoom = new SimpleRoom();
 }