Exemplo n.º 1
0
        /// <summary>
        /// 创建考场;
        /// </summary>
        /// <returns>考场</returns>
        public IExaminationRoom CreateExaminationRoom()
        {
            IExaminationRoom classroom = null;

            Write("请输入笔试人数:");
            var examineeCount       = int.Parse(ReadLine());
            var availableClassrooms = from c in ClassRoomRepository.GetAll()
                                      where c.SeatAmount > examineeCount * 2 + 10
                                      orderby c.SeatAmount, c.Number
            select c;

            Write("符合人数要求的教室有:");
            foreach (var availableClassroom in availableClassrooms)
            {
                Write($"{availableClassroom.Number}(被占用星期:{availableClassroom.OccupiedWeekDay}) ");
            }
            Write($"{Environment.NewLine}请选择教室并输入门牌号:");
            var classroomNumber = ReadLine();

            if (classroomNumber == "")
            {
                return(null);
            }
            classroom = (from r in availableClassrooms
                         where r.Number == classroomNumber
                         select r)
                        .FirstOrDefault();
            return(classroom);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 指定考场;
        /// </summary>
        protected override void AssignExaminationRoom()
        {
            IExaminationRoom laboratory = null;

            Write("\n请输入上机考试人数:");
            var examineeCount        = int.Parse(ReadLine());
            var availableLaboratorys = from l in LaboratoryRepository.GetAll()
                                       where (l.HasClapboard && l.SeatAmount > examineeCount + 5) ||
                                       (!l.HasClapboard && l.SeatAmount > examineeCount * 2 + 10)
                                       orderby l.SeatAmount, l.Number
            select l;

            Write("上机考试可用机房有:");
            foreach (var availableLaboratory in availableLaboratorys)
            {
                Write($"{availableLaboratory.Number} ");
            }
            Write("\n请选择机房并输入门牌号:");
            var laboratoryNumber = ReadLine();

            laboratory = (from r in availableLaboratorys
                          where r.Number == laboratoryNumber
                          select r).FirstOrDefault();
            this._Examination.Room = laboratory;
        }
        /// <summary>
        /// 创建考场;
        /// </summary>
        /// <returns>考场</returns>
        public IExaminationRoom CreateExaminationRoom()
        {
            IExaminationRoom laboratory = null;

            Write("请输入上机考试人数:");
            var examineeCount        = int.Parse(ReadLine());
            var availableLaboratorys = from l in LaboratoryRepository.GetAll()
                                       where
                                       (l.HasClapboard && l.SeatAmount > examineeCount + 5) ||
                                       (!l.HasClapboard && l.SeatAmount > examineeCount * 2 + 10)
                                       orderby l.SeatAmount, l.Number
            select l;

            Write("上机考试可用机房有:");
            foreach (var availableLaboratory in availableLaboratorys)
            {
                Write($"{availableLaboratory.Number} ");
            }
            Write($"{Environment.NewLine}请选择机房并输入门牌号:");
            var laboratoryNumber = ReadLine();

            laboratory = (from l in availableLaboratorys
                          where l.Number == laboratoryNumber
                          select l)
                         .FirstOrDefault();
            return(laboratory);
        }
Exemplo n.º 4
0
        static void Main()
        {
            WriteLine("《面向对象程序设计》上机考试安排:");
            ComputerExaminationAbstractFactory oopExamFactory = new ComputerExaminationAbstractFactory();       //根据需要定义抽象工厂;
            IExaminationRoom oopExamRoom    = oopExamFactory.CreateExaminationRoom();                           //抽象工厂创建产品族中的某产品;
            IInvigilator     oopInvigilator = oopExamFactory.CreateInvigilator();                               //抽象工厂创建产品族中的某产品;

            oopExamRoom.ShowResult();
            oopInvigilator.ShowResult();

            WriteLine("《英语》笔试安排:");
            WrittenExaminationAbstractFactory englishExamFactory = new WrittenExaminationAbstractFactory();
            IExaminationRoom englishExamRoom    = englishExamFactory.CreateExaminationRoom();
            IInvigilator     englishInvigilator = englishExamFactory.CreateInvigilator();

            englishExamRoom.ShowResult();
            englishInvigilator.ShowResult();
            Console.ReadLine();
        }