예제 #1
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtFileName.Text.Trim()))
            {
                MessageBox.Show("File name is required.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else if (!CaculatorHelper.CheckFileNameValid(txtFileName.Text))
            {
                MessageBox.Show("File name is invalid.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else if (CheckNameExist(txtFileName.Text))
            {
                MessageBox.Show("File name already existed in the system.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                var fileName = txtFileName.Text;
                this.Close();
                var id = _assessmentService.NewRecord(fileName);
                _frmMain.RefreshDataForGridFromAnotherForm();

                var frmPcst = new FrmPcstForm(id, _frmMain);
                frmPcst.ShowDialog();
            }
        }