コード例 #1
0
        public ViewRequestModel getRequestData(string RequestID)
        {
            int reqid = Convert.ToInt32(RequestID);
            Request viewRequest = new Request();
            viewRequest = db.Requests.Find(reqid);
            List<Room> prefRoom = (from f in db.PreferenceRooms
                                              join r in db.Rooms on f.RoomID equals r.RoomID
                                              where f.RequestID == reqid
                                              select r).ToList();

            List<Facility> prefFac = (from f in db.RequiredFacilities
                                      join fa in db.Facilities on f.FacilityID equals fa.FacilityID
                                      where f.FacilityID == reqid
                                      select fa).ToList();

            ViewRequestModel model = new ViewRequestModel();

            foreach (var item in prefRoom) {

                model.prefRooms += item.Name + ", ";

            }

            foreach (var item in prefFac)
            {

                model.prefFacs = item.Name + ", ";

            }

            model.specialRequirements = viewRequest.SpecialRequirements;
            model.priority = viewRequest.Priority;
            model.period = (viewRequest.Period).ToString();
            model.length = (viewRequest.Length).ToString();
            model.status = viewRequest.Status;

            return model;
        }
コード例 #2
0
        //
        // GET: /ViewRequest/
        public ViewRequestModel getRequests(Request request)
        {
            string department = User.Identity.Name;

            ViewRequestModel model = new ViewRequestModel();

            model.moduleCode = request.ModuleCode;

            model.numberOfRooms = request.NoOfRooms;
            model.priority = request.Priority;
            model.requestID = request.RequestID;

            model.moduleTitle = db.Modules.Where(m => m.ModuleCode == request.ModuleCode).First().Title;

            string requestStatus = request.Status;
            string status = "";

            switch(requestStatus){
                case "P":
                    status = "Pending";
                    break;
                case "A":
                    status = "Approved";
                    break;
                case "R":
                    status = "Pending";
                    break;
                default:
                    status = "";
                    break;

            }
            model.status = status;
            model.statusCode = requestStatus;

            string weekDay = "";
            int days = int.Parse(request.Day.ToString());
            switch (days)
            {
                case 1:
                    weekDay = "Mon";
                    break;
                case 2:
                    weekDay = "Tues";
                    break;
                case 3:
                    weekDay = "Wed";
                    break;
                case 4:
                    weekDay = "Thur";
                    break;
                case 5:
                    weekDay = "Fri";
                    break;
                case 6:
                    weekDay = "Sat";
                    break;
                case 7:
                    weekDay = "Sun";
                    break;
                default:
                    weekDay = "Unknown";
                    break;
            }

            model.days = weekDay;
            model.daysint = days;

            string startTime = "";
            int startint = int.Parse(request.Period.ToString());
            switch (startint)
            {
                case 1:
                    startTime = "9:00";
                    break;
                case 2:
                    startTime = "10:00";
                    break;
                case 3:
                    startTime = "11:00";
                    break;
                case 4:
                    startTime = "12:00";
                    break;
                case 5:
                    startTime = "13:00";
                    break;
                case 6:
                    startTime = "14:00";
                    break;
                case 7:
                    startTime = "15:00";
                    break;
                case 8:
                    startTime = "16:00";
                    break;
                case 9:
                    startTime = "17:00";
                    break;
                default:
                    startTime = "Unknown";
                    break;
            }
            model.startTime = startTime;
            model.startint = startint;

            string endTime = "";
            int time = Convert.ToInt32(request.Period);
            int length = Convert.ToInt32(request.Length);
            int timelength = time + length;

            switch (timelength)
            {
                case 2:
                    endTime = "9:50";
                    break;
                case 3:
                    endTime = "10:50";
                    break;
                case 4:
                    endTime = "11:50";
                    break;
                case 5:
                    endTime = "12:50";
                    break;
                case 6:
                    endTime = "13:50";
                    break;
                case 7:
                    endTime = "14:50";
                    break;
                case 8:
                    endTime = "15:50";
                    break;
                case 9:
                    endTime = "16:50";
                    break;
                case 10:
                    endTime = "17:50";
                    break;
                default:
                    endTime = "Unknown";
                    break;
            }

            model.endTime = endTime;
            model.endint = timelength;

            string weeks = "";
            List<RequestWeek> reqweeks = new List<RequestWeek>();

            reqweeks = (from w in db.RequestWeeks where w.RequestID == request.RequestID select w).ToList();

            foreach (RequestWeek r in reqweeks) {

                weeks += r.Week.ToString() + ", ";

            }

            model.weeks = weeks;

            return model;
        }
コード例 #3
0
        public ViewRequestModel getRequestData()
        {
            ViewRequestModel model = new ViewRequestModel();

            return model;
        }