Пример #1
0
 public void Init()
 {
     _user        = UserSession();
     _repository  = new UowRepository();
     _examService = new ExamService(_user, _repository);
     _sbError     = new StringBuilder("");
 }
Пример #2
0
 public ExamAdd(HttpClient client)
 {
     _client  = new HttpClient();
     _service = new ExamService(_client);
     _users   = new UserService(_client);
     _classes = new SubjectService(_client);
 }
Пример #3
0
        public ExamResult Pass(ExamService service, UserWordForLearning word, UserWordForLearning[] examList)
        {
            Console.WriteLine("=====>   " + word.EnWord + "    <=====");
            Console.WriteLine("Press any key to see the translation...");
            Console.ReadKey();

            Console.WriteLine("Translation is \r\n" + word.UserTranslations + "\r\n Did you guess?");
            Console.WriteLine("[Y]es [N]o [E]xit");
            var answer = Console.ReadKey();

            switch (answer.Key)
            {
            case ConsoleKey.Y:
                service.RegistrateSuccess(word);
                return(ExamResult.Passed);

            case ConsoleKey.N:
                service.RegistrateFailure(word);
                return(ExamResult.Failed);

            case ConsoleKey.E: return(ExamResult.Exit);

            case ConsoleKey.Escape: return(ExamResult.Exit);

            default: return(ExamResult.Retry);
            }
        }
        public void InitTest()
        {
            var unitOfWork = Mock.Of <IUnitOfWork>();

            var userRepository = new UserRepositoryTest(unitOfWork);

            _userService = new UserService(unitOfWork, userRepository);


            var subjectRepository = new SubjectRepositoryTest(unitOfWork);
            var subjectService    = new SubjectService(unitOfWork, subjectRepository);

            var exampRepository = new ExamRepositoryTest(unitOfWork);
            var examService     = new ExamService(unitOfWork, exampRepository);

            var userEvaluateRepository = new UserEvaluateRepositoryTest(unitOfWork);
            var userEvaluateService    = new UserEvaluateService(unitOfWork, userEvaluateRepository);

            var userNoteRepository = new UserNoteRepositoryTest(unitOfWork);

            _userNoteService = new UserNoteService(unitOfWork, userNoteRepository, subjectService, examService, userEvaluateService);

            var studentRepository = new StudentRepositoryTest(unitOfWork);

            _service = new StudentService(unitOfWork, studentRepository, _userService, _userNoteService);
        }
Пример #5
0
        public void SetUp()
        {
            // Create a new mock of the repository
            examRepo = new Mock <IUnitOfWork>();

            // Set up the mock for the repository
            examRepo.Setup(x => x.Exams.GetList())
            .Returns(new List <Exam>
            {
                new Exam {
                    Id = Guid.NewGuid(), Name = "math"
                },
                new Exam {
                    Id = Guid.NewGuid(), Name = "phys"
                },
                new Exam {
                    Id = Guid.NewGuid(), Name = "chorus"
                }
            });

            examRepo.Setup(x => x.Exams.GetById(id))
            .Returns(new Exam {
                Id = id, Name = "math"
            });

            examRepo.Setup(x => x.Exams.Create(It.IsAny <Exam>())).Callback(() => subjects.Add(It.IsAny <Exam>()));

            examRepo.Setup(x => x.Exams.Update(It.IsAny <Exam>())).Callback(() =>
                                                                            subjectTest.Name = "My name is test");

            examRepo.Setup(x => x.Exams.Delete(It.IsAny <Guid>())).Callback(() => boolDelete = true);

            // Create the service and inject the repository into the service
            examService = new ExamService(examRepo.Object);
        }
Пример #6
0
        public ActionResult LoadExamCodes(string sortOrder, string currentFilter, string ExamCode, string LevelString, string Visible, int?page)

        // public ActionResult LoadExamCodes()
        {
            var theExamCodes = from s in work.OnlineExamRepository.Get()
                               select s;

            if (!String.IsNullOrEmpty(ExamCode))
            {
                string theCode = ExamCode.ToLower();
                theExamCodes = theExamCodes.Where(s => s.ExamCode.ToLower().Contains(theCode));
            }

            if (!String.IsNullOrEmpty(LevelString))
            {
                //  string theCode = ExamCode.ToLower();
                theExamCodes = theExamCodes.Where(s => s.LevelName.Equals(LevelString));
            }

            if (!String.IsNullOrEmpty(Visible))
            {
                // bool theVal = Convert.ToBoolean(Visible);
                //  string theCode = ExamCode.ToLower();
                theExamCodes = theExamCodes.Where(s => s.Visible.Equals(Visible));
            }

            // List<Exam> theExamCodes;
            //  theExamCodes = work.ExamRepository.Get().ToList();// && a.CourseID == courseID


            //  if (examCode == "kazoo")
            // {

            //// }
            // else
            // {
            //   theExamCodes = work.ExamRepository.Get(a => a.ExamCode.Equals(examCode)).ToList();// && a.CourseID == courseID
            // }
            //    //   @Html.DropDownListFor(model => model.LevelType, new SelectList((System.Collections.IEnumerable)ViewData["Level"], "Value", "Text"))

            // List<SelectListItem> theItem = new List<SelectListItem>();

            int pageSize   = 30;
            int pageNumber = (page ?? 1);
            List <OnlineExam> theRealExamCode = new List <OnlineExam>();

            foreach (var examCodes in theExamCodes)
            {
                IList <Question> theQs = new ExamService().GetQuestions(examCodes);
                examCodes.Question = theQs;
                //  examCodes.AddQuestion(theQs);
                theRealExamCode.Add(examCodes);
                //theRealExamCode
            }
            // ViewData["examCode"] = theItem;
            //  return View("Index2", theExamCodes);
            ViewBag.Count = theExamCodes.Count();
            return(View("Index2", theRealExamCode.OrderByDescending(a => a.Date).ToPagedList(pageNumber, pageSize)));
            // return View("Index2", theExamCodes.ToPagedList(pageNumber, pageSize));
        }
Пример #7
0
        public ActionResult Schedule(int id)
        {
            List <ExamModel> lstStud    = new List <ExamModel>();
            ExamModel        objModel   = new ExamModel();
            ExamService      objService = new ExamService();

            var lstExam = Dbcontext.ExamMasters.Where(m => m.EID == id).SingleOrDefault();

            int?stdID     = lstExam.StdID;
            int?schoolID  = lstExam.SchoolID;
            int eid       = lstExam.EID;
            var lstSchool = Dbcontext.SchoolMasters.Where(m => m.SchoolID == schoolID).SingleOrDefault();
            var lstStd    = Dbcontext.StandardMasters.Where(m => m.StdID == stdID).SingleOrDefault();
            List <SubjectModel> lstSub = new List <SubjectModel>();
            var lstSchedule            = Dbcontext.ExamTrans.Where(m => m.EID == eid && m.SchoolID == schoolID && m.StdID == stdID).ToList();

            if (lstSchedule.Count > 0)
            {
                lstSub           = objService.getShedule(id, schoolID, stdID);
                objModel.ListSub = new List <SubjectModel>();
                objModel.ListSub.AddRange(lstSub);
            }
            else
            {
                lstSub           = objService.getSubByStdID(stdID);
                objModel.ListSub = new List <SubjectModel>();
                objModel.ListSub.AddRange(lstSub);
            }

            objModel.ExamDetails      = lstExam;
            objModel.StdDetail        = lstStd;
            objModel.SchoolMastDetail = lstSchool;
            return(View(objModel));
        }
Пример #8
0
        public ExamResult Pass(ExamService service, UserWordForLearning word, UserWordForLearning[] examList)
        {
            var variants = examList.Randomize().Select(e => e.EnWord).ToArray();

            Console.WriteLine("=====>   " + word.UserTranslations + "    <=====");

            for (int i = 1; i <= variants.Length; i++)
            {
                Console.WriteLine($"{i}: " + variants[i - 1]);
            }

            Console.Write("Choose the translation: ");

            var selected = Console.ReadLine();

            if (selected == null || selected.ToLower().StartsWith("e"))
            {
                return(ExamResult.Exit);
            }

            if (!int.TryParse(selected, out var selectedIndex) || selectedIndex > variants.Length ||
                selectedIndex < 1)
            {
                return(ExamResult.Retry);
            }

            if (variants[selectedIndex - 1] == word.EnWord)
            {
                service.RegistrateSuccess(word);
                return(ExamResult.Passed);
            }
            service.RegistrateFailure(word);

            return(ExamResult.Failed);
        }
Пример #9
0
        public ActionResult _ajax_SetCurrentModuleId(int courseID, int moduleID)
        {
            var user = SessionManager.inst.User();

            CourseService.SetModuleSeen(user.Id, courseID, moduleID);
            return(Json(ExamService.CheckIsCourseFinish(courseID, user.Id), JsonRequestBehavior.AllowGet));
        }
Пример #10
0
        public bool AddExam(decimal examID)
        {
            var order = OrderService.GetOrCreateCurrentOrder();

            if (order.HasCourses)
            {
                return(false);
            }
            if (order.OrderExams.Any(oe => oe.Exam_ID == examID))
            {
                return(true);
            }

            var exam = ExamService.GetByPK(examID);

            if (!exam.ExamPrice.HasValue)
            {
                return(true);
            }

            var orderExam = new OrderExam
            {
                Exam_ID = examID,
                Price   = exam.ExamPrice.GetValueOrDefault()
            };

            order.OrderExams.Add(orderExam);
            OrderService.SubmitChanges();
            return(true);
        }
Пример #11
0
        public void GetExamFromAPI()
        {
            var examService      = new ExamService();
            var candidateService = new CandidateService();

            var exam = examService.GetLatestOpenExamWithQuestionOptions(candidateService.GetCandidate("*****@*****.**").Id);

            exam.Questions.ToList().ForEach(x => x.Options.ToList().ForEach(y =>
            {
                var relatedQuestions = examService.GetRelatedQuestions(y.Id);

                var answer = new Answer
                {
                    AnswerText = string.Empty,
                    Level      = x.Level,
                    ScorePoint = x.ScorePoint,
                    Id         = Guid.NewGuid(),

                    //need to use DbContext.QuestionsOption.Attach() if you want to use this
                    Option = new Option {
                        Id = y.Id, IsSelected = y.IsSelected
                    },
                    Exam = new Exam {
                        Id = exam.Id, Text = exam.Text
                    }
                };

                var answerReturned = examService.AddAnswer(answer);

                Debug.WriteLine(relatedQuestions.Count);
            }));

            Assert.IsNotNull(exam);
        }
Пример #12
0
 private void UpdatePrices(Order order)
 {
     foreach (var detail in order.GetCourseOrderDetails())
     {
         var price = PriceService.GetAllPricesForCourse(detail.Course_TC, detail.Track_TC)
                     .FirstOrDefault(x => x.PriceType_TC == detail.PriceType_TC);
         if (price != null)
         {
             detail.Price = price.Price;
         }
         else
         {
             order.OrderDetails.Remove(detail);
         }
     }
     foreach (var orderExam in order.OrderExams.ToList())
     {
         var price = ExamService.GetValues(orderExam.Exam_ID, x => x.ExamPrice);
         if (price.GetValueOrDefault() > 0)
         {
             orderExam.Price = price.Value;
         }
         else
         {
             order.OrderExams.Remove(orderExam);
         }
     }
 }
Пример #13
0
        public ActionResult Edit(int id)
        {
            OnlineExam        theExam     = work.OnlineExamRepository.GetByID(id);
            IList <Question>  theQs       = new ExamService().GetQuestions(theExam);
            QuestionViewModel theListofQs = new QuestionViewModel();

            foreach (var q in theQs)
            {
                theListofQs.TheQuestions.Add(q);
            }

            ViewBag.ExamCode   = theExam.ExamCode;
            ViewBag.ExamCourse = theExam.Course;

            if (theExam.Term == "1")
            {
                ViewBag.ExamTerm = "First";
            }

            if (theExam.Term == "2")
            {
                ViewBag.ExamTerm = "Second";
            }
            if (theExam.Term == "3")
            {
                ViewBag.ExamTerm = "Third";
            }


            return(View(theListofQs));
        }
Пример #14
0
        static void Main(string[] args)
        {
            IAppErrors     errors  = new AppErrors();
            IExamService   service = new ExamService(errors, new ExamRepository());
            ExaminationDTO ex      = new ExaminationDTO();

            ex.Description = "Data By EF";
            ex.CutOffMark  = 24;
            ex.CourseID    = 1;
            service.AddNewExam(ex);

            if (errors.IsValid)
            {
                Console.WriteLine("Success");
            }
            else
            {
                foreach (Error er in errors.GetErrors())
                {
                    Console.WriteLine(er.Value);
                }
            }

            IEnumerable <ExaminationDTO> exams = service.GetExams();

            foreach (var x in exams)
            {
                Console.WriteLine(x.CourseID + "|" + x.Description + "|" + x.CutOffMark);
            }
            Console.ReadLine();
        }
Пример #15
0
        public ActionResult AtteSheet(int id)
        {
            ExamService  objService = new ExamService();
            StudentModel objModel   = new StudentModel();

            int did  = 0;
            int acid = 0;

            if (Session["DID"] != null)
            {
                did  = Convert.ToInt32(Session["DID"].ToString());
                acid = Convert.ToInt32(Session["ACID"].ToString());
            }

            var lstExam = Dbcontext.ExamMasters.Where(m => m.EID == id).SingleOrDefault();

            int std    = Convert.ToInt32(lstExam.StdID);
            int school = Convert.ToInt32(lstExam.SchoolID);

            objModel.ExamDetail   = lstExam;
            objModel.SchoolDetail = Dbcontext.SchoolMasters.Where(m => m.SchoolID == school).SingleOrDefault();
            objModel.AcYearDetail = Dbcontext.AccountingYears.Where(m => m.AYID == acid).SingleOrDefault();
            List <StudentModel> lstStud = new List <StudentModel>();

            lstStud           = objService.getStud(did, acid, std, school);
            objModel.ListStud = new List <StudentModel>();
            objModel.ListStud.AddRange(lstStud);

            return(View("PrintAtteSheet", objModel));
        }
Пример #16
0
        public ActionResult Result(ExamModel model)
        {
            ExamService objService = new ExamService();
            int         uid        = 0;

            if (Session["UID"] != null)
            {
                uid = Convert.ToInt32(Session["UID"].ToString());
            }
            var lstResult = Dbcontext.ResultMasters.Where(m => m.EID == model.EID && m.StudID == model.StudID && m.SubID == model.SubID).SingleOrDefault();

            if (lstResult != null)
            {
                ResultMaster res = Dbcontext.ResultMasters.Where(r => r.EID == model.EID && r.StudID == model.StudID && r.SubID == model.SubID).SingleOrDefault();
                res.Marks       = model.Marks;
                res.UpdatedBy   = uid;
                res.UpdatedDate = System.DateTime.Now;
                Dbcontext.SaveChanges();
            }
            else
            {
                model.CreatedBy   = uid;
                model.CreatedDate = System.DateTime.Now;
                objService.InsertResult(model);
            }
            return(RedirectToAction("Result"));
        }
Пример #17
0
        internal virtual IExamService CreateIExamService()
        {
            // TODO: Instantiate an appropriate concrete class.
            ctx = new IAS.DataServices.Test.Mocking.MockIASPersonEntities();
            IExamService target = new ExamService(ctx);

            return(target);
        }
Пример #18
0
 public CreateExamViewModel()
 {
     examService     = new ExamService();
     classService    = new ClassService();
     questionService = new QuestionService();
     courseService   = new CourseService();
     exam            = new Exam();
 }
        public ActionResult QuestionPaper(string subject, int difficulty)
        {
            ViewBag.Exam           = subject;
            TempData["Difficulty"] = difficulty;
            List <ExamQuestion> questions =
                new ExamService().GetQuestionsBySubjectWithDifficulty(subject, difficulty);

            return(View(questions));
        }
Пример #20
0
        public void LoadData(Student student)
        {
            Student = student;
            var examService = new ExamService();

            ExamsToBeTaken = examService.GetStudentExams(Student.UserId, ExamStatus.Template);
            CorrectedExams = examService.GetStudentExams(Student.UserId, ExamStatus.Corrected);
            //TakenExams = examService.GetStudentExams(Student.UserId, ExamStatus.Taken);
        }
Пример #21
0
        public async void GetExams()
        {
            var exams = await ExamService.GetExamAsync();

            foreach (var item in exams)
            {
                ListOfExams.Add(item);
            }
        }
Пример #22
0
        public IHttpActionResult DeleteItemArchieve([FromBody] Remove remove)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest("Invalid Model"));
            }
            var result = new ExamService().DeleteItemArchieve(remove.Id);

            return(Ok(result));
        }
Пример #23
0
        public ExamResult Pass(ExamService service, UserWordForLearning word, UserWordForLearning[] examList)
        {
            if (!word.Phrases.Any())
            {
                return(ExamResult.Impossible);
            }

            var targetPhrase = word.Phrases.GetRandomItem();

            var other = examList.SelectMany(e => e.Phrases)
                        .Where(p => !string.IsNullOrWhiteSpace(p?.EnPhrase) && p != targetPhrase)
                        .Take(8);

            if (!other.Any())
            {
                return(ExamResult.Impossible);
            }

            var variants = other
                           .Append(targetPhrase)
                           .Randomize()
                           .Select(e => e.EnPhrase)
                           .ToArray();

            Console.WriteLine("=====>   " + targetPhrase.PhraseRuTranslate + "    <=====");

            for (int i = 1; i <= variants.Length; i++)
            {
                Console.WriteLine($"{i}: " + variants[i - 1]);
            }

            Console.Write("Choose the translation: ");

            var selected = Console.ReadLine();

            if (selected.ToLower().StartsWith("e"))
            {
                return(ExamResult.Exit);
            }

            if (!int.TryParse(selected, out var selectedIndex) || selectedIndex > variants.Length ||
                selectedIndex < 1)
            {
                return(ExamResult.Retry);
            }

            if (variants[selectedIndex - 1] == targetPhrase.EnPhrase)
            {
                service.RegistrateSuccess(word);
                return(ExamResult.Passed);
            }
            service.RegistrateFailure(word);
            return(ExamResult.Failed);
        }
Пример #24
0
        public ActionResult PrintQRCode(int SchoolID, int StdID)
        {
            ExamService    objService = new ExamService();
            List <QRModel> lstQR      = new List <QRModel>();
            QRModel        objModel   = new QRModel();

            lstQR           = objService.getQRBySChoolNStd(SchoolID, StdID);
            objModel.ListQR = new List <QRModel>();
            objModel.ListQR.AddRange(lstQR);
            return(View(objModel));
        }
Пример #25
0
 /// <summary>
 /// 创建考试信息
 /// 需要班级时间科目
 /// </summary>
 /// <returns></returns>
 public static async Task CreateExam(Guid clsId, Guid subjectId, DateTime examTime)
 {
     using (var examSvc = new ExamService())
     {
         await examSvc.CreateAsync(new Exam()
         {
             ClassId   = clsId,
             SubjectId = subjectId,
             ExamTime  = examTime
         });
     }
 }
Пример #26
0
        public ActionResult GenerateResult()
        {
            ExamModel        objModel   = new ExamModel();
            List <ExamModel> lstExam    = new List <ExamModel>();
            ExamService      objService = new ExamService();


            int did  = 0;
            int acid = 0;

            if (Session["DID"] != null)
            {
                did  = Convert.ToInt32(Session["DID"].ToString());
                acid = Convert.ToInt32(Session["ACID"].ToString());
            }

            lstExam           = objService.getExam(did, acid);
            objModel.ListExam = new List <ExamModel>();
            objModel.ListExam.AddRange(lstExam);

            CommonService    objCService = new CommonService();
            List <CityModel> lstCity     = new List <CityModel>();

            lstCity           = objCService.getActiveCity(did);
            objModel.ListCity = new List <CityModel>();
            objModel.ListCity.AddRange(lstCity);

            List <SchoolModel> lstSchool = new List <SchoolModel>();

            lstSchool           = objCService.getActiveSchool(did);
            objModel.ListSchool = new List <SchoolModel>();
            objModel.ListSchool.AddRange(lstSchool);

            List <StandardModel> lstStd = new List <StandardModel>();

            lstStd           = objCService.getActiveStd();
            objModel.ListStd = new List <StandardModel>();
            objModel.ListStd.AddRange(lstStd);

            List <ZoneModel> lstZone = new List <ZoneModel>();

            lstZone           = objCService.getActiveZone(did);
            objModel.ListZone = new List <ZoneModel>();
            objModel.ListZone.AddRange(lstZone);

            StudentService      objStudSer = new StudentService();
            List <StudentModel> lstStud    = new List <StudentModel>();

            lstStud           = objStudSer.getStud(did, acid);
            objModel.ListStud = new List <StudentModel>();
            objModel.ListStud.AddRange(lstStud);
            return(View(objModel));
        }
Пример #27
0
        public ActionResult Index(ExamModel model, string cmd)
        {
            ExamService objService = new ExamService();

            int uid  = 0;
            int acid = 0;
            int did  = 0;

            if (Session["UID"] != null)
            {
                uid  = Convert.ToInt32(Session["UID"].ToString());
                acid = Convert.ToInt32(Session["ACID"].ToString());
                did  = Convert.ToInt32(Session["DID"].ToString());
            }

            if (model.CenterID == null)
            {
                model.CenterID = model.SchoolID;
            }
            if (cmd == "Save")
            {
                try
                {
                    model.Status      = true;
                    model.CreatedBy   = uid;
                    model.ACID        = acid;
                    model.CreatedDate = System.DateTime.Now;
                    int sid = objService.Insert(model);
                    TempData["AMsg"] = "Saved Successfully!";
                }
                catch (Exception ex)
                {
                    TempData["AMsg"] = "Error Occured, " + ex;
                }
            }
            else
            {
                try
                {
                    model.UpdatedBy   = uid;
                    model.UpdatedDate = System.DateTime.Now;
                    objService.Update(model);
                    TempData["AMsg"] = "Updated Successfully!";
                }
                catch (Exception ex)
                {
                    TempData["AMsg"] = "Error Occured," + ex;
                }
            }
            return(RedirectToAction("Index"));
        }
Пример #28
0
        public ActionResult Provider(int providerID)
        {
            var provider = ProviderService.GetByPK(providerID);

            if (provider == null)
            {
                return(null);
            }
            return(View(new ProviderVM {
                Provider = provider,
                Vendors = ExamService.GetAll(x => x.Available && x.ExamProviders.Any(e => e.Provider_ID == providerID))
                          .Select(e => e.Vendor).IsActive().Distinct().ToList()
            }));
        }
Пример #29
0
        public ActionResult Edit(int id)
        {
            ExamModel   objModel   = new ExamModel();
            ExamService objService = new ExamService();

            objModel = objService.getByID(id);
            int did  = 0;
            int acid = 0;

            if (Session["DID"] != null)
            {
                did  = Convert.ToInt32(Session["DID"].ToString());
                acid = Convert.ToInt32(Session["ACID"].ToString());
            }
            List <ExamModel> lstExam = new List <ExamModel>();

            lstExam           = objService.getExam(did, acid);
            objModel.ListExam = new List <ExamModel>();
            objModel.ListExam.AddRange(lstExam);

            CommonService    objCService = new CommonService();
            List <CityModel> lstCity     = new List <CityModel>();

            lstCity           = objCService.getActiveCity(did);
            objModel.ListCity = new List <CityModel>();
            objModel.ListCity.AddRange(lstCity);

            List <SchoolModel> lstSchool = new List <SchoolModel>();

            lstSchool           = objCService.getActiveSchool(did);
            objModel.ListSchool = new List <SchoolModel>();
            objModel.ListSchool.AddRange(lstSchool);

            List <StandardModel> lstStd = new List <StandardModel>();

            lstStd           = objCService.getActiveStd();
            objModel.ListStd = new List <StandardModel>();
            objModel.ListStd.AddRange(lstStd);

            List <ZoneModel> lstZone = new List <ZoneModel>();

            lstZone           = objCService.getActiveZone(did);
            objModel.ListZone = new List <ZoneModel>();
            objModel.ListZone.AddRange(lstZone);

            ViewBag.Action = "Edit";

            return(View("Index", objModel));
        }
        public ExamResult Pass(ExamService service, UserWordForLearning word, UserWordForLearning[] examList)
        {
            if (!word.Phrases.Any())
            {
                return(ExamResult.Impossible);
            }

            var targetPhrase = word.Phrases.GetRandomItem();

            string shuffled;

            while (true)
            {
                var split =
                    targetPhrase.EnPhrase.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
                if (split.Length < 2)
                {
                    return(ExamResult.Impossible);
                }

                shuffled = string.Join(" ", split.Randomize());
                if (shuffled != targetPhrase.EnPhrase)
                {
                    break;
                }
            }

            Console.WriteLine("Words in phrase are shuffled. Write them in correct order:\r\n'" + shuffled + "'");
            string entry = null;

            while (string.IsNullOrWhiteSpace(entry))
            {
                Console.WriteLine(":");
                entry = Console.ReadLine().Trim();
            }

            if (string.CompareOrdinal(targetPhrase.EnPhrase, entry) == 0)
            {
                service.RegistrateSuccess(word);
                return(ExamResult.Passed);
            }

            Console.ForegroundColor = ConsoleColor.Red;
            Console.WriteLine($"Original phrase was: '{targetPhrase.EnPhrase}'");
            Console.ResetColor();
            service.RegistrateFailure(word);
            return(ExamResult.Failed);
        }
Пример #31
0
        public void ProcessRequest(HttpContext context)
        {
            string str7;
            ExamService service = new ExamService();
            string str = context.Request.Params["meth"];
            str = str ?? "1";
            string str2 = context.Request.Params["classid"];
            str2 = str2 ?? "1";
            string s = context.Request.Params["start"];
            string businesInfoID = context.Request.Params["newsid"];
            businesInfoID = businesInfoID ?? "1";
            s = s ?? "0";
            string str5 = context.Request.Params["limit"];
            str5 = str5 ?? "10";
            string eBusinesInfo = "";
            if (!(str2 == "1"))
            {
                if (str2 == "2")
                {
                    str7 = str;
                    if (str7 != null)
                    {
                        if (!(str7 == "1"))
                        {
                            if (str7 == "2")
                            {
                                eBusinesInfo = service.GetEBusinesInfo(businesInfoID);
                            }
                        }
                        else
                        {
                            List<TurnE_Notice> list2 = service.GetEBusinesInfoList2(int.Parse(s) + 1, int.Parse(str5));
                            eBusinesInfo = jsonHelper.Serialize(new { count = list2.Count, isend = (list2.Count < int.Parse(str5)) ? 1 : 0, data = list2 });
                        }
                    }
                }
            }
            else
            {
                str7 = str;
                if (str7 != null)
                {
                    if (!(str7 == "1"))
                    {
                        if (str7 == "2")
                        {
                            eBusinesInfo = service.GetENotice(businesInfoID);
                        }
                        else if (str7 == "3")
                        {
                            eBusinesInfo = service.GetENoticeFile(businesInfoID);
                        }
                    }
                    else
                    {
                        List<TurnE_BusinesInfo> list = service.GetENoticeList2(int.Parse(s) + 1, int.Parse(str5));
                        eBusinesInfo = jsonHelper.Serialize(new { count = list.Count, isend = (list.Count < int.Parse(str5)) ? 1 : 0, data = list });
                    }
                }
            }
            context.Response.ContentType = "application/json;charset=utf-8";
            context.Response.Write(eBusinesInfo);
            context.Response.End();

        }