예제 #1
0
        private void button_OK_Click(object sender, EventArgs e)
        {
            this.button_OK.Enabled = false;

            try
            {
                // 警告尚未输入条码的行
                int nBlankCount = 0;
                for (int i = 0; i < this.listView_barcodes.Items.Count; i++)
                {
                    string strBarcode = this.listView_barcodes.Items[i].Text;
                    if (String.IsNullOrEmpty(strBarcode) == true)
                        nBlankCount++;
                }

                if (nBlankCount > 0)
                {
                    DialogResult result = MessageBox.Show(this,
                        "当前有 "+nBlankCount.ToString()+" 个册尚未输入条码。\r\n\r\n确实要结束条码输入? ",
                        "InputItemBarcodeDialog",
                        MessageBoxButtons.YesNo,
                        MessageBoxIcon.Question,
                        MessageBoxDefaultButton.Button2);
                    if (result == DialogResult.No)
                        return;

                    // 否则继续
                }

                // 条码查重?
                string strError = "";
                int nRet = this.UpdateData(out strError);
                if (nRet == -1)
                {
                    MessageBox.Show(this, strError);
                    return;
                }

                if (this.DetectBarcodeDup != null)
                {
                    DetectBarcodeDupEventArgs e1 = new DetectBarcodeDupEventArgs();
                    e1.EntityControl = this.EntityControl;
                    e1.BookItems = GetBookItemList(this.BookItems);
                    this.DetectBarcodeDup(this, e1);

                    if (e1.Result == -1 || e1.Result == 1)
                    {
                        // TODO: 可否包含MessageBox标题?
                        MessageBox.Show(this, e1.ErrorInfo.Replace("; ", "\r\n"));
                        return;
                    }
                }

                UpdateBookItemsPrice();
            }
            finally
            {
                this.button_OK.Enabled = true;
            }

            this.DialogResult = DialogResult.OK;
            this.Close();
        }
예제 #2
0
파일: EntityForm.cs 프로젝트: renyh1013/dp2
        void item_barcode_dlg_DetectBarcodeDup(object sender, DetectBarcodeDupEventArgs e)
        {
            int nRet = 0;
            string strError = "";

            // 对一批事项的条码查重
            // return:
            //      -1  出错
            //      0   不重复
            //      1   重复
            nRet = e.EntityControl.CheckBarcodeDup(
                e.BookItems,
                out strError);
            e.Result = nRet;
            e.ErrorInfo = strError;
        }
예제 #3
0
        private void button_OK_Click(object sender, EventArgs e)
        {
            this.button_OK.Enabled = false;

            try
            {
                // 警告尚未输入条码的行
                int nBlankCount = 0;
                for (int i = 0; i < this.listView_barcodes.Items.Count; i++)
                {
                    string strBarcode = this.listView_barcodes.Items[i].Text;
                    if (String.IsNullOrEmpty(strBarcode) == true)
                    {
                        nBlankCount++;
                    }
                }

                if (nBlankCount > 0)
                {
                    DialogResult result = MessageBox.Show(this,
                                                          "当前有 " + nBlankCount.ToString() + " 个册尚未输入条码。\r\n\r\n确实要结束条码输入? ",
                                                          "InputItemBarcodeDialog",
                                                          MessageBoxButtons.YesNo,
                                                          MessageBoxIcon.Question,
                                                          MessageBoxDefaultButton.Button2);
                    if (result == DialogResult.No)
                    {
                        return;
                    }

                    // 否则继续
                }

                // 条码查重?
                string strError = "";
                int    nRet     = this.UpdateData(out strError);
                if (nRet == -1)
                {
                    MessageBox.Show(this, strError);
                    return;
                }

                if (this.DetectBarcodeDup != null)
                {
                    DetectBarcodeDupEventArgs e1 = new DetectBarcodeDupEventArgs();
                    e1.EntityControl = this.EntityControl;
                    e1.BookItems     = GetBookItemList(this.BookItems);
                    this.DetectBarcodeDup(this, e1);

                    if (e1.Result == -1 || e1.Result == 1)
                    {
                        // TODO: 可否包含MessageBox标题?
                        MessageBox.Show(this, e1.ErrorInfo.Replace("; ", "\r\n"));
                        return;
                    }
                }

                UpdateBookItemsPrice();
            }
            finally
            {
                this.button_OK.Enabled = true;
            }

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