Ejemplo n.º 1
0
        private void toolStripSave_Click(object sender, EventArgs e)
        {
            string sid = this.dataGridViewDD[0, this.dataGridViewDD.CurrentCell.RowIndex].Value.ToString();

            HY_Model.HY_CustomerInfo hycusmodel = new HY_Model.HY_CustomerInfo();
            hycusmodel.O_Name   = this.o_Name.Text;
            hycusmodel.C_FID    = this.o_FID.Text;
            hycusmodel.O_CPName = this.o_CPName.Text.Trim();
            hycusmodel.O_Person = this.o_Person.Text.Trim();
            hycusmodel.O_Notes  = this.o_Notes.Text.Trim();
            hycusmodel.O_RDate  = System.DateTime.Now.Date;
            hycusmodel.O_XDate  = this.o_XDate.Value.Date;
            hycusmodel.O_JDate  = this.o_JDate.Value.Date;
            hycusmodel.O_DID    = this.label6.Text;
            hycusmodel.O_Amount = this.o_Amount.Text.Trim();
            hycusmodel.O_Class  = this.o_Class.Text.Trim();

            if (!valid.validateNull(hycusmodel.O_Name))
            {
                MessageBoxEx.Show("提示:客户名称不能为空", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (!valid.validateNull(hycusmodel.O_CPName))
            {
                MessageBoxEx.Show("提示:厂内编号不能为空", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.o_CPName.Focus();
                return;
            }
            if (!valid.validateNull(hycusmodel.O_Person))
            {
                MessageBoxEx.Show("提示:录单人不能为空!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.o_Person.Focus();
                return;
            }
            if (!valid.validateNull(hycusmodel.O_Amount))
            {
                MessageBoxEx.Show("提示:数量不能为空!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.o_Amount.Focus();
                return;
            }
            if (!valid.validateNull(hycusmodel.O_Class))
            {
                MessageBoxEx.Show("提示:模具类型名称不能为空!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.o_Class.Focus();
                return;
            }


            //添加动作
            if (intFalg == 1)
            {
                string sql = "insert into HY_CustomerOrder(o_DID,o_Name,o_FID,o_CPName,o_Person,o_RDate,o_Notes,o_XDate,o_JDate,o_Amount,o_Class) values('" + hycusmodel.O_DID + "','" + hycusmodel.O_Name + "','" + hycusmodel.C_FID + "','" + hycusmodel.O_CPName + "','" + hycusmodel.O_Person + "','" + hycusmodel.O_RDate + "','" + hycusmodel.O_Notes + "','" + hycusmodel.O_XDate + "','" + hycusmodel.O_JDate + "','" + hycusmodel.O_Amount + "','" + hycusmodel.O_Class + "')";
                int    res = hycustobll.com_HY_CustomerInfo(sql);
                if (res > 0)
                {
                    MessageBoxEx.Show("客户订单添加成功");
                    f_CustomerInfo();
                    this.o_Name.Text       = "";
                    this.o_FID.Text        = "";
                    this.o_Person.Text     = "";
                    this.o_CPName.Text     = "";
                    this.o_Amount.Text     = "";
                    this.o_Class.Text      = "";
                    this.o_XDate.Text      = "";
                    this.o_JDate.Text      = "";
                    this.o_Notes.Text      = "";
                    this.groupBox1.Enabled = false;
                    this.groupBox2.Enabled = true;
                }
            }
            //修改动作
            if (intFalg == 2)
            {
                string sql = "update HY_CustomerOrder set o_Name='" + hycusmodel.O_Name + "',o_FID='" + hycusmodel.C_FID + "',o_CPName='" + hycusmodel.O_CPName + "',o_Person='" + hycusmodel.O_Person + "',o_RDate='" + hycusmodel.O_RDate + "',o_Notes='" + hycusmodel.O_Notes + "',o_Amount='" + hycusmodel.O_Amount + "',o_Class='" + hycusmodel.O_Class + "',o_XDate='" + hycusmodel.O_XDate + "',o_JDate='" + hycusmodel.O_JDate + "' where o_DID='" + sid + "'";
                int    res = hycustobll.com_HY_CustomerInfo(sql);
                if (res > 0)
                {
                    MessageBoxEx.Show("客户订单修改成功");
                    f_CustomerInfo();
                    this.o_Name.Text       = "";
                    this.o_FID.Text        = "";
                    this.o_Person.Text     = "";
                    this.o_CPName.Text     = "";
                    this.o_Amount.Text     = "";
                    this.o_Class.Text      = "";
                    this.o_XDate.Text      = "";
                    this.o_JDate.Text      = "";
                    this.o_Notes.Text      = "";
                    this.groupBox1.Enabled = false;
                    this.groupBox2.Enabled = true;
                }
            }
        }
Ejemplo n.º 2
0
        private void toolStripSave_Click(object sender, EventArgs e)
        {
            string sid = this.dataGridViewDD[0, this.dataGridViewDD.CurrentCell.RowIndex].Value.ToString();
            HY_Model.HY_CustomerInfo hycusmodel = new HY_Model.HY_CustomerInfo();
            hycusmodel.O_Name = this.o_Name.Text;
            hycusmodel.C_FID = this.o_FID.Text;
            hycusmodel.O_CPName = this.o_CPName.Text.Trim();
            hycusmodel.O_Person = this.o_Person.Text.Trim();
            hycusmodel.O_Notes = this.o_Notes.Text.Trim();
            hycusmodel.O_RDate = System.DateTime.Now.Date;
            hycusmodel.O_XDate = this.o_XDate.Value.Date;
            hycusmodel.O_JDate = this.o_JDate.Value.Date;
            hycusmodel.O_DID = this.label6.Text;
            hycusmodel.O_Amount = this.o_Amount.Text.Trim();
            hycusmodel.O_Class = this.o_Class.Text.Trim();

            if (!valid.validateNull(hycusmodel.O_Name))
            {
                MessageBoxEx.Show("提示:客户名称不能为空", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (!valid.validateNull(hycusmodel.O_CPName))
            {
                MessageBoxEx.Show("提示:厂内编号不能为空", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.o_CPName.Focus();
                return;
            }
            if (!valid.validateNull(hycusmodel.O_Person))
            {
                MessageBoxEx.Show("提示:录单人不能为空!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.o_Person.Focus();
                return;
            }
            if (!valid.validateNull(hycusmodel.O_Amount))
            {
                MessageBoxEx.Show("提示:数量不能为空!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.o_Amount.Focus();
                return;
            }
            if (!valid.validateNull(hycusmodel.O_Class))
            {
                MessageBoxEx.Show("提示:模具类型名称不能为空!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.o_Class.Focus();
                return;
            }

            //添加动作
            if (intFalg==1)
            {
                string sql = "insert into HY_CustomerOrder(o_DID,o_Name,o_FID,o_CPName,o_Person,o_RDate,o_Notes,o_XDate,o_JDate,o_Amount,o_Class) values('" + hycusmodel.O_DID + "','" + hycusmodel.O_Name + "','" + hycusmodel.C_FID + "','" + hycusmodel.O_CPName + "','" + hycusmodel.O_Person + "','" + hycusmodel.O_RDate + "','" + hycusmodel.O_Notes + "','" + hycusmodel.O_XDate + "','" + hycusmodel.O_JDate + "','" + hycusmodel.O_Amount + "','" + hycusmodel.O_Class + "')";
                int res = hycustobll.com_HY_CustomerInfo(sql);
                if (res > 0)
                {
                    MessageBoxEx.Show("客户订单添加成功");
                    f_CustomerInfo();
                    this.o_Name.Text = "";
                    this.o_FID.Text = "";
                    this.o_Person.Text = "";
                    this.o_CPName.Text = "";
                    this.o_Amount.Text = "";
                    this.o_Class.Text = "";
                    this.o_XDate.Text = "";
                    this.o_JDate.Text = "";
                    this.o_Notes.Text = "";
                    this.groupBox1.Enabled = false;
                    this.groupBox2.Enabled = true;
                }
            }
            //修改动作
            if (intFalg == 2)
            {
                string sql = "update HY_CustomerOrder set o_Name='" + hycusmodel.O_Name + "',o_FID='" + hycusmodel.C_FID + "',o_CPName='" + hycusmodel.O_CPName + "',o_Person='" + hycusmodel.O_Person + "',o_RDate='" + hycusmodel.O_RDate + "',o_Notes='" + hycusmodel.O_Notes + "',o_Amount='" + hycusmodel.O_Amount + "',o_Class='" + hycusmodel.O_Class + "',o_XDate='" + hycusmodel.O_XDate + "',o_JDate='" + hycusmodel.O_JDate + "' where o_DID='" + sid + "'";
                int res = hycustobll.com_HY_CustomerInfo(sql);
                if (res > 0)
                {
                    MessageBoxEx.Show("客户订单修改成功");
                    f_CustomerInfo();
                    this.o_Name.Text = "";
                    this.o_FID.Text = "";
                    this.o_Person.Text = "";
                    this.o_CPName.Text = "";
                    this.o_Amount.Text = "";
                    this.o_Class.Text = "";
                    this.o_XDate.Text = "";
                    this.o_JDate.Text = "";
                    this.o_Notes.Text = "";
                    this.groupBox1.Enabled = false;
                    this.groupBox2.Enabled = true;
                }
            }
        }