/// <summary>
 /// 新增采购单信息
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public int com_HY_Procurement(HY_Model.HY_Purchaseorder model)
 {
     try
     {
         string sql = "insert into HY_ProcurementInfo(c_DID,c_CID,c_Department,c_Person,c_Name,c_NameID,c_Supplier,c_Origin,c_QDate,c_XDate,c_Specifications,c_Units,c_Amount,c_Uses,c_Notes,c_Hot) values('" + model.C_DID + "','" + model.C_CID + "','" + model.C_Department + "','" + model.C_Person + "','" + model.C_Name + "','" + model.C_NameID + "','" + model.C_Supplier + "','" + model.C_Origin + "','" + model.C_QDate + "','" + model.C_XDate + "','" + model.C_Specifications + "','" + model.C_Units + "','" + model.C_Amount + "','" + model.C_Uses + "','" + model.C_Notes + "','" + model.C_Hot + "')";
         HY_DbSqlHelp.DBsqlHelp hy_help = new DBsqlHelp();
         int res = hy_help.insertEx(sql);
         return(res);
     }
     catch (Exception EX)
     {
         throw EX;
     }
 }
        private void toolStripSave_Click(object sender, EventArgs e)
        {
            if (!valid.validateNull(this.r_Person.Text.Trim()))
            {
                MessageBoxEx.Show("请购人不能为空", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.r_Person.Focus();
                return;
            }
            if (!valid.validateNull(this.r_Name.Text.Trim()))
            {
                MessageBoxEx.Show("品名不能为空", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.r_Name.Focus();
                return;
            }
            if (!valid.validateNull(this.r_Supplier.Text))
            {
                MessageBoxEx.Show("供应商不能为空", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.r_Supplier.Focus();
                return;
            }
            if (!valid.validateNull(this.r_Origin.Text.Trim()))
            {
                MessageBoxEx.Show("产品型号不能为空", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.r_Origin.Focus();
                return;
            }
            if (!valid.validateNull(this.r_XDate.Text.Trim()))
            {
                MessageBoxEx.Show("需要日期不能为空", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.r_XDate.Focus();
                return;
            }
            if (!valid.validateNull(this.r_Specifications.Text.Trim()))
            {
                MessageBoxEx.Show("产品规格不能为空", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.r_Specifications.Focus();
                return;
            }
            if (!valid.validateNull(this.r_Units.Text))
            {
                MessageBoxEx.Show("产品单位不能为空", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.r_Units.Focus();
                return;
            }
            if (!valid.validateNull(this.r_Amount.Text.Trim()))
            {
                MessageBoxEx.Show("产品数量不能为空", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.r_Amount.Focus();
                return;
            }
            else if (!valid.validateNum(this.r_Amount.Text.Trim()))
            {
                MessageBoxEx.Show("产品数量只能输入数字类型!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.r_Amount.Focus();
                return;
            }

            HY_Model.HY_Purchaseorder hypurorde = new HY_Model.HY_Purchaseorder();
            hypurorde.C_DID            = this.r_ID.Text;
            hypurorde.C_CID            = this.r_CID.Text.Trim();
            hypurorde.C_NameID         = this.r_NameID.Text;
            hypurorde.C_Department     = this.r_Department.Text;
            hypurorde.C_Person         = this.r_Person.Text;
            hypurorde.C_Name           = this.r_Name.Text.Trim();
            hypurorde.C_Supplier       = this.r_Supplier.Text.Trim();
            hypurorde.C_Origin         = this.r_Origin.Text.Trim();
            hypurorde.C_QDate          = this.r_QDate.Value.Date;
            hypurorde.C_XDate          = this.r_XDate.Value.Date;
            hypurorde.C_Specifications = this.r_Specifications.Text.Trim();
            hypurorde.C_Units          = this.r_Units.Text.Trim();
            hypurorde.C_Amount         = int.Parse(this.r_Amount.Text);
            hypurorde.C_Uses           = this.r_Uses.Text.Trim();
            hypurorde.C_Notes          = this.r_Notes.Text.Trim();
            hypurorde.C_Hot            = this.r_Hot.Text.Trim();
            //添加动作
            if (intFalg == 1)
            {
                int res = hyprocmentbll.com_HY_Procurement(hypurorde);
                if (res > 0)
                {
                    MessageBoxEx.Show("采购信息添加成功! 确定后可继续添加", "操作提示", MessageBoxButtons.OK);
                    this.r_NameID.Text         = "";
                    this.r_Name.Text           = "";
                    this.r_Supplier.Text       = "";
                    this.r_Origin.Text         = "";
                    this.r_Specifications.Text = "";
                    this.r_Units.Text          = "";
                    this.r_Amount.Text         = "";
                    this.r_Uses.Text           = "";
                    this.r_Notes.Text          = "";
                    this.r_Hot.Text            = "";
                    q_PID();//更新品号
                    this.listView1.Items.Clear();
                    listViewDate(sql);
                }
            }

            //修改动作
            if (intFalg == 2)
            {
                string sql = "update HY_ProcurementInfo set c_DID='" + hypurorde.C_DID + "',c_Department='" + hypurorde.C_Department + "',c_Person='" + hypurorde.C_Person + "',c_Name='" + hypurorde.C_Name + "',c_Supplier='" + hypurorde.C_Supplier + "',c_Origin='" + hypurorde.C_Origin + "',c_QDate='" + hypurorde.C_QDate + "',c_XDate='" + hypurorde.C_XDate + "',c_Specifications='" + hypurorde.C_Specifications + "',c_Units='" + hypurorde.C_Units + "',c_Amount='" + hypurorde.C_Amount + "',c_Uses='" + hypurorde.C_Uses + "',c_Hot='" + hypurorde.C_Hot + "' where c_NameID='" + this.r_NameID.Text + "'";
                int    res = hyprocmentbll.com_ExecuteQuery(sql);
                if (res > 0)
                {
                    MessageBoxEx.Show("请购信息更新修改成功! 确定后可继续操作", "操作提示", MessageBoxButtons.OK);
                    this.r_ID.Text             = "";
                    this.r_NameID.Text         = "";
                    this.r_Department.Text     = "";
                    this.r_Person.Text         = "";
                    this.r_Name.Text           = "";
                    this.r_Supplier.Text       = "";
                    this.r_Origin.Text         = "";
                    this.r_Specifications.Text = "";
                    this.r_Units.Text          = "";
                    this.r_Amount.Text         = "";
                    this.r_Uses.Text           = "";
                    this.r_Notes.Text          = "";
                    this.r_Hot.Text            = "";
                    this.groupA.Enabled        = false;
                    this.groupB.Enabled        = false;
                    this.groupPaneA.Enabled    = true;
                    this.groupPaneB.Enabled    = true;
                    this.groupPaneC.Enabled    = true;
                    this.toolStripADD.Enabled  = true;
                    this.toolStripCEL.Enabled  = false;
                    this.toolStripSave.Enabled = false;
                    this.toolStripDEL.Enabled  = false;
                    this.toolStripUPD.Enabled  = false;
                    this.toolStripSave.Enabled = false;
                    this.listView1.Items.Clear();
                    string sqlupdate = "select distinct c_DID,c_State,c_CID from HY_ProcurementInfo";
                    listViewDate(sqlupdate);
                }
            }
        }
 /// <summary>
 /// 新增采购单信息
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public int com_HY_Procurement(HY_Model.HY_Purchaseorder model)
 {
     return(hypro.com_HY_Procurement(model));
 }