Beispiel #1
0
        private void sbtnBes_Click(object sender, System.EventArgs e)
        {
            Hashtable htPara    = new Hashtable();
            string    strCardID = txtCardID.Text.Trim();

            if (strCardID == "")
            {
                MessageBox.Show("卡号不能为空!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                return;
            }
            else if (strCardID == "0")
            {
                strCardID = "V9999";
            }
            htPara.Add("strCardID", strCardID);

            string strName = txtName.Text.Trim();

            if (strName == "")
            {
                MessageBox.Show("订购人姓名不能为空!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                return;
            }
            htPara.Add("strName", strName);

            string strPhone = txtphone.Text.Trim();

            if (strPhone == "")
            {
                MessageBox.Show("联系电话不能为空!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                return;
            }
            htPara.Add("strPhone", strPhone);

            string strComments = txtBesCom.Text.Trim();

            if (strComments == "")
            {
                MessageBox.Show("订购内容不能为空!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                return;
            }
            htPara.Add("strComments", strComments);

            string strCount = txtCount.Text.Trim();

            if (strCount == "")
            {
                MessageBox.Show("订购数量不能为空!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                return;
            }
            htPara.Add("strCount", strCount);

            string strFinal = dtpBes.Value.ToShortDateString();

            htPara.Add("strFinal", strFinal);

            Exception err       = null;
            string    strresult = cs.BespeakInsert(htPara, 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();
            }
        }