Example #1
0
        private void BtnOk_Click(object sender, RoutedEventArgs e)
        {
            S3603App.GTestInformation = null;
            TestInfoParam testInformation = new TestInfoParam();

            try
            {
                if (TxtExplain.Text.Length > 1000)
                {
                    ShowException(CurrentApp.GetLanguageInfo("3603T00097", "Exam content that cannot exceed 1000 characters."));
                    return;
                }

                testInformation.StrPaperName = _mPaperInfoParam.PaperParam.StrName;
                testInformation.LongPaperNum = _mPaperInfoParam.PaperParam.LongNum;
                testInformation.StrExplain   = TxtExplain.Text;
                testInformation.StrTestTime  = DttbTestTime.ToString();
                testInformation.LongEditorId = CurrentApp.Session.UserInfo.UserID;
                testInformation.StrEditor    = CurrentApp.Session.UserInfo.UserName;
                testInformation.StrDateTime  = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");

                var parent = Parent as PopupPanel;
                if (parent != null)
                {
                    switch (_mPaperInfoParam.OptType)
                    {
                    case S3603Codes.OptAddInfo:
                        long longTestNum = CreateTestNum();
                        testInformation.LongTestNum = longTestNum;
                        if (longTestNum == 0)
                        {
                            ShowException("Get paper number error");
                            return;
                        }
                        if (!WriteTestInfo(testInformation))
                        {
                            return;
                        }
                        S3603App.GTestInformation = testInformation;
                        ParentPage.UpdateTestInfoTable();
                        break;

                    case S3603Codes.OptChangeInfo:

                        break;

                    case S3603Codes.OptDeleteInfo:

                        break;
                    }
                    parent.IsOpen = false;
                }
            }
            catch (Exception ex)
            {
                ShowException(ex.Message);
            }
        }
Example #2
0
        private void BtnOk_Click(object sender, RoutedEventArgs e)
        {
            var parent = Parent as PopupPanel;

            if (parent != null)
            {
                if (!CheckText())
                {
                    return;
                }

                try
                {
                    TestInfoParamEx testInfoParamEx = new TestInfoParamEx();
                    if (ChkTestNum.IsChecked == true)
                    {
                        testInfoParamEx.LongTestNum = !string.IsNullOrEmpty(TxtTestNum.Text) ? Convert.ToInt64(TxtTestNum.Text) : 0;
                    }

                    if (ChkPaperNum.IsChecked == true)
                    {
                        testInfoParamEx.LongPaperNum = !string.IsNullOrEmpty(TxtPaperNum.Text) ? Convert.ToInt64(TxtPaperNum.Text) : 0;
                    }

                    if (ChkPaperName.IsChecked == true)
                    {
                        testInfoParamEx.StrPaperName = !string.IsNullOrEmpty(TxtPaperName.Text) ? TxtPaperName.Text : null;
                    }

                    if (ChkEditorNum.IsChecked == true)
                    {
                        testInfoParamEx.LongEditorId = !string.IsNullOrEmpty(TxtEditorNum.Text) ? Convert.ToInt64(TxtEditorNum.Text) : 0;
                    }

                    if (ChkEditorName.IsChecked == true)
                    {
                        testInfoParamEx.StrEditor = !string.IsNullOrEmpty(TxtEditorName.Text)
                            ? TxtEditorName.Text
                            : null;
                    }

                    if (ChkTestState.IsChecked == true)
                    {
                        switch (ComBoxUsedNum.SelectedIndex)
                        {
                        case 1:
                            testInfoParamEx.StrTestStatue = "Y";
                            break;

                        case 2:
                            testInfoParamEx.StrTestStatue = "N";
                            break;

                        default:
                            testInfoParamEx.StrTestStatue = null;
                            break;
                        }
                    }

                    if (ChkTestTime.IsChecked == true)
                    {
                        testInfoParamEx.StrTestTime = DttbTestTime.ToString();
                    }

                    if (ChkTestNum.IsChecked == false)
                    {
                        testInfoParamEx.StrStartTime = DtStartTime.Value.ToString();
                        testInfoParamEx.StrEndTime   = DtEndTime.Value.ToString();
                    }

                    ParentPage.SearchTestInfo(testInfoParamEx);
                    parent.IsOpen = false;
                }
                catch (Exception ex)
                {
                    ShowException(ex.Message);
                }
            }
        }