예제 #1
0
        public ActionResult ViewEquipment()
        {
            CheckOutEquipmentModel vm     = new CheckOutEquipmentModel();
            BuildingViewer         viewer = new BuildingViewer();

            vm.Building = viewer.GetAllBuildingname();
            return(View(vm));
        }
예제 #2
0
        public ActionResult LogPackage()
        {
            LogPackageModel vm     = new LogPackageModel();
            BuildingViewer  viewer = new BuildingViewer();

            vm.Building = viewer.GetAllBuildingname();
            return(View(vm));
        }
예제 #3
0
        public ActionResult NewStudent()
        {
            CreateStudentModel vm     = new CreateStudentModel();
            BuildingViewer     viewer = new BuildingViewer();

            vm.Building = viewer.GetAllBuildingname();
            return(View(vm));
        }
예제 #4
0
        //create student

        private static void CreateStudent()
        {
            int    room_number;
            long   student_id;
            string first_name, last_name, building_name;

            if (_buildingViewer == null)
            {
                _buildingViewer = new BuildingViewer();
            }
            if (_roomViewer == null)
            {
                _roomViewer = new RoomViewer();
            }

            UWHousing.Entities.ViewModels.IList <BuildingViewModel> building = _buildingViewer.GetAllBuildingname();
            UWHousing.Entities.ViewModels.IList <RoomViewModel>     rooms;
            UWHousing.Entities.ViewModels.IList <StudentViewModel>  students;
            //TODO ILists

            WriteHeader();
            WriteCreateStudentHeader();

            //get student ID
            Console.WriteLine("Enter Student ID: ");
            string str_student_id = (Console.ReadLine());

            //validate student ID
            if (!Int64.TryParse(str_student_id, out student_id) || student_id > 9079999999 || student_id < 9070000000)
            {
                Console.WriteLine("Invalid student ID.  Press any key...");
                Console.ReadKey();
                return;
            }

            //TODO check if student id is already in use
            students = _studentViewer.GetStudent(student_id);
            if (students != null)
            {
                Console.WriteLine("Student ID already exists.Press any key...");
                Console.ReadKey();
                return;
            }

            //input first and last name
            Console.WriteLine("Enter student first name: ");
            first_name = Console.ReadLine();
            Console.WriteLine("Enter student last name: ");
            last_name = Console.ReadLine();

            //write building names on screen
            for (var i = 0; i < building.Count; i++)
            {
                Console.WriteLine("{0}. {1} {2}", building[i]);
            }
            CommandPrompt("Type building name: ");
            building_name = Console.ReadLine();

            //validate building name
            if (!building.Contains(building_name))
            {
                Console.WriteLine("Invalid building entry.  Press any key...");
                Console.ReadKey();
                return;
            }

            //building is valid - grab open rooms
            rooms = _roomViewer.GetOpenRoomsByBuilding(building_name);

            //TODO room
            for (var i = 0; i < rooms.Count; i++)
            {
                Console.WriteLine("Open rooms in " + building_name);
                Console.WriteLine("{0}. {1} {2}", rooms[i]);
            }
            CommandPrompt("Select open room: ");
            string str_room_number = Console.ReadLine();

            //validate room
            if (!Int32.TryParse(str_room_number, out room_number) || !rooms.Contains(room_number))
            {
                Console.WriteLine("Invalid room number.  Press any key...");
                Console.ReadKey();
                return;
            }

            //TODO summary screen
            WriteHeader();
            WriteCreateStudentHeader();
            Console.WriteLine("Student Details:");
            Console.WriteLine("Student Id: " + student_id);
            Console.WriteLine("Name: " + first_name + " " + last_name);
            Console.WriteLine("Building: " + building_name);
            Console.WriteLine("Room number: " + room_number);
            //TODO meal plan
            CommandPrompt("Is this correct? (Y/N)");
            string str_response = Console.ReadLine();

            //pass to DTO
            if (str_response.ToLower() == "y")
            {
                NewStudentDTO newStudent = new NewStudentDTO()
                {
                    first_name    = first_name,
                    last_name     = last_name,
                    building_name = building_name,
                    room_number   = room_number
                                    //TODO meal_plan = meal_plan
                };
                Console.WriteLine("Student created successfully.");
                Console.WriteLine("Press any key...");
                return;
            }
        }
예제 #5
0
        //create student

        private static void CreateStudent()
        {
            int    room_number;
            long   student_id;
            string first_name, last_name, building_name;

            if (_buildingViewer == null)
            {
                _buildingViewer = new BuildingViewer();
            }
            if (_roomViewer == null)
            {
                _roomViewer = new RoomViewer();
            }

            IList <BuildingViewModel> building = _buildingViewer.GetAllBuildingname();
            IList <RoomViewModel>     rooms;
            IList <StudentViewModel>  students;

            //TODO ILists

            WriteHeader();
            WriteCreateStudentHeader();

            //get student ID
            Console.WriteLine("Enter Student ID: ");
            string str_student_id = (Console.ReadLine());

            //validate student ID
            if (!Int64.TryParse(str_student_id, out student_id) || student_id > 9079999999 || student_id < 9070000000)
            {
                Console.WriteLine("Invalid student ID.  Press any key...");
                Console.ReadKey();
                return;
            }

            //input first and last name
            Console.WriteLine("Enter student first name: ");
            first_name = Console.ReadLine();
            Console.WriteLine("Enter student last name: ");
            last_name = Console.ReadLine();

            //write building names on screen
            for (var i = 0; i < building.Count; i++)
            {
                Console.WriteLine("{0}. {1}", i + 1, building[i].Buildingname);
            }
            //CommandPrompt("Type building name: ");
            Console.WriteLine("Type building name: ");
            building_name = Console.ReadLine();


            //validate building name
            if ((building.Where(dorms => dorms.Buildingname.Trim() == building_name).ToList().Count) == 0) //TODO
            {
                Console.WriteLine("Invalid building entry.  Press any key...");
                Console.ReadKey();
                return;
            }

            //building is valid - grab open rooms
            rooms = _roomViewer.GetOpenRoomsByBuilding(building_name);

            //room
            for (var i = 0; i < rooms.Count; i++)
            {
                Console.WriteLine("Open rooms in " + building_name);
                Console.WriteLine("{0}. {1} {2}", rooms[i]);
            }
            //CommandPrompt("Select open room: ");
            Console.WriteLine("Select open room: ");
            string str_room_number = Console.ReadLine();



            room_number = Convert.ToInt32(str_room_number);

            //summary screen
            WriteHeader();
            WriteCreateStudentHeader();
            Console.WriteLine("Student Details:");
            Console.WriteLine("Student Id: " + student_id);
            Console.WriteLine("Name: " + first_name + " " + last_name);
            Console.WriteLine("Building: " + building_name);
            Console.WriteLine("Room number: " + room_number);
            //TODO meal plan
            CommandPrompt("Is this correct? (Y/N)");
            string str_response = Console.ReadLine();


            //pass to DTO
            if (str_response.ToLower() == "y")
            {
                NewStudentDTO newStudent = new NewStudentDTO()
                {
                    StudentID    = student_id,
                    Firstname    = first_name,
                    Lastname     = last_name,
                    Buildingname = building_name,
                    Roomnumber   = room_number
                                   //TODO meal_plan = meal_plan
                };

                var _creator = new NewStudentCreator();

                _creator.CreateStudent(newStudent);


                Console.WriteLine("Student created successfully.");
                Console.WriteLine("Press any key...");
                Console.ReadKey();
                return;
            }
        }