示例#1
0
        private void button_OK_Click(object sender, EventArgs e)
        {
            string strError = "";

            if (this.textBox_publishTime.Text == "")
            {
                strError = "尚未输入出版时间";
                goto ERROR1;
            }

            // 检查出版时间格式是否正确
            int nRet = LibraryServerUtil.CheckSinglePublishTime(this.textBox_publishTime.Text,
                                                                out strError);

            if (nRet == -1)
            {
                goto ERROR1;
            }

            if (this.textBox_issue.Text == "")
            {
                strError = "尚未输入期号";
                goto ERROR1;
            }

            // 检查期号格式是否正确
            nRet = VolumeInfo.CheckIssueNo(
                "期号",
                this.textBox_issue.Text,
                out strError);
            if (nRet == -1)
            {
                goto ERROR1;
            }

            // 检查总期号格式是否正确
            if (String.IsNullOrEmpty(this.textBox_zong.Text) == false)
            {
                nRet = VolumeInfo.CheckIssueNo(
                    "总期号",
                    this.textBox_zong.Text,
                    out strError);
                if (nRet == -1)
                {
                    goto ERROR1;
                }
            }

            // 检查卷号格式是否正确
            if (String.IsNullOrEmpty(this.textBox_volume.Text) == false)
            {
                nRet = VolumeInfo.CheckIssueNo(
                    "卷号",
                    this.textBox_volume.Text,
                    out strError);
                if (nRet == -1)
                {
                    goto ERROR1;
                }
            }

            if (this.CheckDup != null)
            {
                CheckDupEventArgs e1 = new CheckDupEventArgs();
                e1.PublishTime   = this.PublishTime;
                e1.Issue         = this.Issue;
                e1.Zong          = this.Zong;
                e1.Volume        = this.Volume;
                e1.EnsureVisible = true;
                this.CheckDup(this, e1);

                if (e1.DupIssues.Count > 0)
                {
                    // 将重复的期滚入视野

                    MessageBox.Show(this, e1.DupInfo);
                    return;
                }

                if (e1.WarningIssues.Count > 0)
                {
                    // 将警告的的期滚入视野

                    DialogResult dialog_result = MessageBox.Show(this,
                                                                 "警告: " + e1.WarningInfo + "\r\n\r\n是否继续?\r\n\r\n(OK: 不理会警告,继续进行后续操作; Cancel: 返回对话框进行修改",
                                                                 "BindingControls",
                                                                 MessageBoxButtons.OKCancel,
                                                                 MessageBoxIcon.Question,
                                                                 MessageBoxDefaultButton.Button2);
                    if (dialog_result == DialogResult.Cancel)
                    {
                        return;
                    }
                }
            }

            this.DialogResult = DialogResult.OK;
            this.Close();
            return;

ERROR1:
            MessageBox.Show(this, strError);
        }
示例#2
0
        private void button_OK_Click(object sender, EventArgs e)
        {
            string strError = "";

            if (this.textBox_publishTime.Text == "")
            {
                strError = "尚未输入出版时间";
                goto ERROR1;
            }

            // 检查出版时间格式是否正确
            int nRet = LibraryServerUtil.CheckSinglePublishTime(this.textBox_publishTime.Text,
                out strError);
            if (nRet == -1)
                goto ERROR1;

            if (this.textBox_issue.Text == "")
            {
                strError = "尚未输入期号";
                goto ERROR1;
            }

            // 检查期号格式是否正确
            nRet = VolumeInfo.CheckIssueNo(
                "期号",
                this.textBox_issue.Text,
                out strError);
            if (nRet == -1)
                goto ERROR1;

            // 检查总期号格式是否正确
            if (String.IsNullOrEmpty(this.textBox_zong.Text) == false)
            {
                nRet = VolumeInfo.CheckIssueNo(
                    "总期号",
                    this.textBox_zong.Text,
                    out strError);
                if (nRet == -1)
                    goto ERROR1;
            }

            // 检查卷号格式是否正确
            if (String.IsNullOrEmpty(this.textBox_volume.Text) == false)
            {
                nRet = VolumeInfo.CheckIssueNo(
                    "卷号",
                    this.textBox_volume.Text,
                    out strError);
                if (nRet == -1)
                    goto ERROR1;
            }

            if (this.CheckDup != null)
            {
                CheckDupEventArgs e1 = new CheckDupEventArgs();
                e1.PublishTime = this.PublishTime;
                e1.Issue = this.Issue;
                e1.Zong = this.Zong;
                e1.Volume = this.Volume;
                e1.EnsureVisible = true;
                this.CheckDup(this, e1);

                if (e1.DupIssues.Count > 0)
                {
                    // 将重复的期滚入视野

                    MessageBox.Show(this, e1.DupInfo);
                    return;
                }

                if (e1.WarningIssues.Count > 0)
                {
                    // 将警告的的期滚入视野

                    DialogResult dialog_result = MessageBox.Show(this,
            "警告: " + e1.WarningInfo + "\r\n\r\n是否继续?\r\n\r\n(OK: 不理会警告,继续进行后续操作; Cancel: 返回对话框进行修改",
            "BindingControls",
            MessageBoxButtons.OKCancel,
            MessageBoxIcon.Question,
            MessageBoxDefaultButton.Button2);
                    if (dialog_result == DialogResult.Cancel)
                        return;
                }
            }

            this.DialogResult = DialogResult.OK;
            this.Close();
            return;
        ERROR1:
            MessageBox.Show(this, strError);
            
        }