Пример #1
0
 public AppealProvider(TestSessionStatistics statistics, int[] questIds, IServerProvider webServerProvider)
 {
     _webServerProvider = webServerProvider;
     _questIds.AddRange(questIds);
     _statistics = statistics;
     State       = ProviderState.Testing;
 }
Пример #2
0
 public AppealForm(TestSessionStatistics currentSession)
 {
     InitializeComponent();
     _currentSession = currentSession;
     this.Text      += String.Format(" - {0} {1} {2}", HtmlStore.GetString(_currentSession.LastName),
                                     HtmlStore.GetString(_currentSession.FirstName), HtmlStore.GetString(_currentSession.SecondName));
     _questions = StaticServerProvider.TestClient.GetSessionQuestions(_currentSession.TestSessionId);
     _provider  = new AppealProvider(_currentSession, _questions, null);
     TestingHttpServer.StartServer(_provider);
     TestingHttpServer.ServerNotStarted.WaitOne();
     webBrowser.Navigate(TestingHttpServer.BaseUrl);
 }
Пример #3
0
        public string GetAppealHtml(int sessionId)
        {
            StringBuilder retValue = new StringBuilder();

            int[] questIds;
            questIds = GetSessionQuestions(sessionId);
            TestSessionStatistics statistics     = GetSessionStatistics(sessionId);
            SystemServerProvider  systemProvider = new SystemServerProvider();
            AppealProvider        provider       = new AppealProvider(statistics, questIds, systemProvider);

            provider.ProviderMode = ProviderMode.WebMode;
            for (int i = 0; i < provider.QuestCount; i++)
            {
                var response = provider.ProcessReuqest(new string[] { }, new Dictionary <string, List <string> >());


                retValue.Append(String.Format("<b>Вопрос №{0} ({1})</b>", i + 1, !String.IsNullOrEmpty(provider.CurrentQuestion.Answer) ? (provider.CurrentQuestion.AppealIsRight ? "+" : "&ndash;") : "?"));
                retValue.Append("<table style=\"font-family:verdana,arial,sans-serif;border-right: #7177bb 1px solid; border-top: #7177bb 1px solid; border-left: #7177bb 1px solid;border-bottom: #7177bb 1px solid;\" width=\"100%\"><tr><td>"
                                + Encoding.UTF8.GetString(response.ResponseArr)
                                + "</td></tr></table><br/>");
            }
            return(retValue.ToString());
        }
Пример #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Context.User.Identity.IsAuthenticated)
            {
                Response.Redirect("~/Default.aspx");
            }
            if (LocalUser.SecurityProvider.CurrentUser.UserRole != TestorUserRole.Teacher &&
                LocalUser.SecurityProvider.CurrentUser.UserRole != TestorUserRole.Laboratorian &&
                LocalUser.SecurityProvider.CurrentUser.UserRole != TestorUserRole.Administrator)
            {
                Response.Redirect("~/Default.aspx");
            }
            if (!int.TryParse(Request["sessionId"], out _sessioId))
            {
                Response.Redirect("~/Default.aspx");
            }

            _statistics = LocalUser.TestClient.GetSessionStatistics(_sessioId);
            if (_statistics == null)
            {
                Response.Redirect("~/Default.aspx");
            }

            if (!IsPostBack)
            {
                lblAppeal.Text = LocalUser.TestClient.GetAppealHtml(_sessioId);

                lblTest.Text      = _statistics.TestName;
                lblUser.Text      = String.Format("{0} {1} {2}", _statistics.LastName, _statistics.FirstName, _statistics.SecondName);
                lblLogin.Text     = _statistics.Login;
                lblScore.Text     = _statistics.Score.HasValue ? _statistics.Score.Value.ToString() : String.Empty;
                lblIPAddress.Text = _statistics.IPAddress;
            }

            scoreError.Visible   = false;
            mvDelSession.Visible = LocalUser.SecurityProvider.CurrentUser.UserRole == TestorUserRole.Administrator;
        }