/// <summary> /// 新增物料价格信息 /// </summary> /// <param name="model">物料信息实体层</param> /// <returns></returns> public int com_SupplierPrice(HY_Model.HY_SupplierPrice model) { try { string sql = "insert into HY_SupplierPrice(p_DID,p_PID,p_gyName,p_Date,p_PName,p_Price,p_Weight,p_Vray,p_SM,p_rPerson) values('" + model.P_DID + "','" + model.P_PID + "','" + model.P_gyName + "','" + model.P_Date + "','" + model.P_PName + "','" + model.P_Price + "','" + model.P_Weight + "','" + model.P_Vray + "','" + model.P_SM + "','" + model.P_rPerson + "')"; 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.p_PID.Text.Trim())) { MessageBoxEx.Show("模号不能为空", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Error); this.p_PID.Focus(); return; } if (!valid.validateNull(this.p_PName.Text.Trim())) { MessageBoxEx.Show("品名不能为空", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Error); this.p_PName.Focus(); return; } if (!valid.validateNull(this.p_Price.Text.Trim())) { MessageBoxEx.Show("单价不能为空", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Error); this.p_Price.Focus(); return; } if (!valid.validateNull(this.p_Weight.Text.Trim())) { MessageBoxEx.Show("重量不能为空", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Error); this.p_Weight.Focus(); return; } //添加动作 if (intFalg == 1) { HY_Model.HY_SupplierPrice sup = new HY_Model.HY_SupplierPrice(); sup.P_DID = this.p_ID.Text.Trim(); sup.P_PID = this.p_PID.Text.Trim(); sup.P_PName = this.p_PName.Text.Trim(); sup.P_gyName = this.p_gyName.Text; sup.P_Date = (DateTime)(this.p_Date.Value.Date); sup.P_Price = int.Parse(this.p_Price.Text.Trim()); sup.P_Weight = this.p_Weight.Text.Trim(); sup.P_Vray = this.p_Vray.Text.Trim(); sup.P_SM = this.p_SM.Text.Trim(); sup.P_rPerson = this.p_rPerson.Text; int res = supbll.com_SupplierPrice(sup); if (res > 0) { MessageBoxEx.Show("提示信息:物料信息添加成功,您可以继续添加物料信息!", "操作提示信息"); this.p_PID.Text = ""; this.p_Weight.Text = ""; this.p_Vray.Text = ""; this.p_PName.Text = ""; this.p_Price.Text = ""; this.p_SM.Text = ""; string d = "DH"; this.p_ID.Text = hyNO.JhGoodsID(d); gyInfo(); } } //修改动作 if (intFalg == 2) { string id = this.dataGridViewSupplierPrice[0, this.dataGridViewSupplierPrice.CurrentCell.RowIndex].Value.ToString(); string sql = "update HY_SupplierPrice set p_DID='" + this.p_ID.Text.Trim() + "',p_PID='" + this.p_PID.Text.Trim() + "',p_gyName='" + this.p_gyName.Text + "',p_Date='" + this.p_Date.Value.Date + "',p_PName='" + this.p_PName.Text.Trim() + "',p_Price='" + this.p_Price.Text.Trim() + "',p_Weight='" + this.p_Weight.Text.Trim() + "',p_Vray='" + this.p_Vray.Text.Trim() + "',p_SM='" + this.p_SM.Text.Trim() + "',p_rPerson='" + this.p_rPerson.Text + "' where p_DID='" + id + "'"; int res = supbll.f_SupplierPrice(sql); if (res > 0) { MessageBoxEx.Show("请购信息更新修改成功!", "操作提示", MessageBoxButtons.OK); gyInfo();//绑定数据显示 } } }
/// <summary> /// 新增物料价格信息 /// </summary> /// <param name="model">物料信息实体层</param> /// <returns></returns> public int com_SupplierPrice(HY_Model.HY_SupplierPrice model) { return(hysup.com_SupplierPrice(model)); }