Exemplo n.º 1
0
        private void buttonOK_Click(object sender, EventArgs e)
        {
            AddUserForm addUserForm = new AddUserForm(false);

            if (addUserForm.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            _resultUser = addUserForm.ResultUser;
            LocalTestingProvider provider     = null;
            TestHelper           selectedTest = listBox.SelectedItem as TestHelper;

            if (selectedTest.IsMasterTest)
            {
                provider = new LocalTestingProvider(DataCreator.CreateFullTestorDataSet(_testHelpers),
                                                    selectedTest);
            }
            else
            {
                provider = new LocalTestingProvider(selectedTest.TestorData,
                                                    selectedTest);
            }
            provider.SetStudentName(String.Format("{0} {1} {2}", HtmlStore.GetString(_resultUser.LastName),
                                                  HtmlStore.GetString(_resultUser.FirstName), HtmlStore.GetString(_resultUser.SecondName)));
            TestForm testForm = new TestForm(provider);

            testForm.ShowDialog();
        }
Exemplo n.º 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);
 }
Exemplo n.º 3
0
        private void buttonSelectStudent_Click(object sender, EventArgs e)
        {
            ClientSelectUserForm selectUser = new ClientSelectUserForm();

            if (selectUser.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            _resultUser             = selectUser.ResultUser;
            textBoxStudentName.Text = String.Format("{0} {1} {2}", HtmlStore.GetString(_resultUser.LastName),
                                                    HtmlStore.GetString(_resultUser.FirstName), HtmlStore.GetString(_resultUser.SecondName));
        }
Exemplo n.º 4
0
        private void linkLabelSelectStudent_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            ClientSelectUserForm selectUser = new ClientSelectUserForm();

            if (selectUser.ShowDialog() != DialogResult.OK)
            {
                _resultUser         = null;
                textBoxStudent.Text = String.Empty;
            }
            else
            {
                _resultUser         = selectUser.ResultUser;
                textBoxStudent.Text = String.Format("{0} {1} {2}", HtmlStore.GetString(_resultUser.LastName),
                                                    HtmlStore.GetString(_resultUser.FirstName), HtmlStore.GetString(_resultUser.SecondName));
            }
            GetStatistics();
        }
        public override string ProcessHtml()
        {
            StringBuilder sb = new StringBuilder();

            if (_htmlStore.IsAppeal)
            {
                bool isTrue = false;
                if (_htmlStore.SubItems.Count > 0)
                {
                    isTrue = _htmlStore.AppealIsRight;
                }

                string answer = HtmlStore.GetString(_htmlStore.Answer).Replace(";", String.Empty);

                sb.Append("  Верный ответ:  ");
                sb.Append(_htmlStore.SubItems[0].Html);

                if (isTrue)
                {
                    sb.Append("<br/><font color=\"green\">");
                }
                else if (answer.Length == 0)
                {
                    sb.Append("<br/><font color=\"blue\">");
                }
                else
                {
                    sb.Append("<br/><font color=\"red\">");
                }

                sb.Append("&nbsp;&nbsp;Данный ответ:&nbsp;&nbsp;");
                sb.Append(answer);
                sb.Append("</font>");
                sb.Append("<br/>");
            }
            else
            {
                sb.Append("<br/>&nbsp;&nbsp;Введите ответ:&nbsp;&nbsp");
                sb.Append("<input type=\"text\" name=\"tcv_testortext\" size=\"50\" maxlength=\"100\" onkeydown=\"if(window.event.keyCode==13)return false;\" autocomplete=\"off\"/><br/><br/>");
            }
            return(sb.ToString());
        }
Exemplo n.º 6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Context.User.Identity.IsAuthenticated)
            {
                Response.Redirect("~/Default.aspx");
            }
            if (!IsPostBack)
            {
                InitAppointedTests();
            }
            var    currentUser = LocalUser.SecurityProvider.CurrentUser;
            string userName    = String.Format(":: {0} {1} {2}", HtmlStore.GetString(currentUser.LastName),
                                               HtmlStore.GetString(currentUser.FirstName), HtmlStore.GetString(currentUser.SecondName));
            Label lbl = (this.Master.FindControl("userName") as Label);

            if (String.IsNullOrEmpty(userName.Trim()))
            {
                lbl.Text = currentUser.Login;
            }
            else
            {
                lbl.Text = userName;
            }
            TestorCoreUser user = LocalUser.SecurityProvider.CurrentUser;

            if (LocalUser.IsIntranet)
            {
                user.Email = "скрыт";
            }
            user.UserGroups     = LocalUser.UserManagement.GetUserGroups(user.UserId);
            userForm.DataSource = new TestorCoreUser[] { user };
            userForm.DataBind();

            List <TestSessionStatistics> statistics = new List <TestSessionStatistics>();

            statistics.AddRange(LocalUser.TestClient.GetStatistics(new DateTime(1900, 1, 1), DateTime.MaxValue,
                                                                   0, 0, LocalUser.SecurityProvider.CurrentUser.UserId));
            GridViewSessions.DataSource = statistics;
            GridViewSessions.DataBind();
        }
Exemplo n.º 7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (LocalUser.IsIntranet && !Context.User.Identity.IsAuthenticated)
            {
                Response.Redirect("~/Login.aspx");
            }
            StartTestParams ncs = LocalUser.TestClient.GetNotCommitedSessions(0, false);

            if (ncs != null)
            {
                Server.Transfer("~/Testing.aspx");
            }
            MultiViewMain.ActiveViewIndex = 0;
            LabelTestname.Visible         = false;
            requirementsPanel.Visible     = false;
            if (Context.User.Identity.IsAuthenticated)
            {
                var currentUser = LocalUser.SecurityProvider.CurrentUser;
                if (currentUser == null)
                {
                    FormsAuthentication.SignOut();
                    Response.Redirect("~/Login.aspx");
                }
                string userName = String.Format(":: {0} {1} {2}", HtmlStore.GetString(currentUser.LastName),
                                                HtmlStore.GetString(currentUser.FirstName), HtmlStore.GetString(currentUser.SecondName));
                Label lbl = (this.Master.FindControl("userName") as Label);
                if (String.IsNullOrEmpty(userName.Trim()))
                {
                    lbl.Text = currentUser.Login;
                }
                else
                {
                    lbl.Text = userName;
                }
            }
            if (InitPageMode())
            {
                InitTree();
            }
            else
            {
                InitTestList();
                InitNavigator();
                if (_currentItem.ItemType == TestorItemType.Test ||
                    _currentItem.ItemType == TestorItemType.MasterTest)
                {
                    MultiViewMain.ActiveViewIndex = 2;
                    postButton.Text = "Приступить к тестированию";
                    _currentTest    = DataCompressor.DecompressData <TestorData>(
                        LocalUser.TestEdit.GetTestSettings(_currentItem.TestId.Value));
                    testDetails.Text = HttpHandler.GetPreTestingHtml(_currentTest.CoreTests[0]);
                    TestorData.CoreTestsRow test = _currentTest.CoreTests[0];
                    LabelTestname.Visible = true;
                    RemoteTestingProvider _provider = new RemoteTestingProvider(LocalUser.WebServerProvider, _currentItem,
                                                                                _currentTest, null, false);
                    if (!_provider.IsTestActive)
                    {
                        postButton.Enabled      = false;
                        LabelTestname.ForeColor = Color.Red;
                        LabelTestname.Text      = _provider.NotActiveMessage;
                        if (_provider.RequirementsTests != null)
                        {
                            postButton.Enabled              = false;
                            LabelTestname.Text              = "Перед прохлждением данного теста необходимо пройти предыдущие тесты";
                            LabelTestname.ForeColor         = Color.Red;
                            requirementsPanel.Visible       = true;
                            requirementsRepeater.DataSource = _provider.RequirementsTests;
                            requirementsRepeater.DataBind();
                        }
                        return;
                    }
                    if (LocalUser.SecurityProvider.CurrentUser.UserRole == TestorUserRole.Administrator ||
                        LocalUser.SecurityProvider.CurrentUser.UserRole == TestorUserRole.Teacher ||
                        LocalUser.SecurityProvider.CurrentUser.UserRole == TestorUserRole.Laboratorian)
                    {
                        LabelTestname.Text = String.Format("Тест: <a href=\"/Manage/Statistics.aspx?testId={0}\">{1}</a>", _currentItem.TestId, _currentItem.ItemName.Trim());
                    }
                    else
                    {
                        LabelTestname.Text = String.Format("Тест: \"{0}\"", _currentItem.ItemName.Trim());
                    }
                    if (postButton.Attributes[BUTTON_MODE] == NULL_VALUE)
                    {
                        postButton.Attributes[BUTTON_MODE] = NTMODE_VALUE;
                    }
                    else
                    {
                        postButton.Attributes[BUTTON_MODE] = TESTING_VALUE;
                    }
                    postButton.Attributes[BUTTON_VALUE] = _currentItem.ItemId.ToString();
                }
            }
        }