Пример #1
0
        private void sbtnOK_Click(object sender, System.EventArgs e)
        {
            if (dataGrid1.CurrentRowIndex < 0)
            {
                MessageBox.Show("没有选中要订购任务!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information);
                return;
            }

            string strBesFlag = dataGrid1[dataGrid1.CurrentRowIndex, 10].ToString();

            if (strBesFlag != "已下订")
            {
                MessageBox.Show("所选任务必须是已下订状态!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information);
                return;
            }

            string    strSerialNo = dataGrid1[dataGrid1.CurrentRowIndex, 0].ToString();
            Exception err         = null;
            string    strresult   = cs.BespeakOk(strSerialNo, out err);

            if (err != null)
            {
                MessageBox.Show("订购完成失败,请重试!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                clog.WriteLine(err + "\n" + strresult);
            }
            else
            {
                MessageBox.Show("订购完成成功!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information);
                this.DgBind();
            }
        }