Example #1
0
        private void toolSave_Click(object sender, EventArgs e)
        {
            string P_Str_condition, P_Str_cmdtxt;

            switch (G_Int_status)
            {
            case 1:
                if (this.cbxCustomerName.SelectedValue.ToString() != "")
                {
                    if (this.txtGoodsName.Text == "")
                    {
                        MessageBox.Show("图书名称不能为空!", "提示对话框", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }
                    if (this.txtNum.Text == "")
                    {
                        MessageBox.Show("图书数量不能为空!", "提示对话框", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }
                    if (this.txtReGoodsPrice.Text == "")
                    {
                        MessageBox.Show("图书进价不能为空!", "提示对话框", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }
                    if (!G_OperationForm.IsNumeric(this.txtNum.Text) && !G_OperationForm.IsNumeric(this.txtHasPay.Text) &&
                        !G_OperationForm.IsNumeric(this.txtReGoodsPrice.Text))
                    {
                        MessageBox.Show("您输入的数据格式有误!", "提示对话框", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }

                    string P_Str_Id = String.Empty;

                    //检索数据库中对应客户的ID
                    string        P_Str_cmdtxt2 = "SELECT CustomerID,Name FROM tb_Customer WHERE Name='" + this.cbxCustomerName.SelectedValue.ToString() + "'";
                    SqlDataReader P_dr          = G_SqlClass.GetReader(P_Str_cmdtxt2);
                    P_dr.Read();
                    if (P_dr.HasRows)
                    {
                        P_Str_Id = P_dr["CustomerID"].ToString();
                    }
                    P_dr.Close();
                    //下面是要执行的SQL语句
                    P_Str_cmdtxt  = "INSERT INTO tb_ReGoods(ReGoodsID,GoodsID,UserID,CustomerID,ReGoodsName,ReGoodsSpec,ReGoodsNum,ReGoodsUnit";
                    P_Str_cmdtxt += ",ReGoodsTime,ReGoodsPrice,NeedPay,HasPay,ReGoodsResult,ReGoodsSort,StockID) VALUES('" + this.labReGoodsID.Text + "'";
                    P_Str_cmdtxt += ",'" + PropertyClass.GetGoodsID + "','" + PropertyClass.SendUserIDValue + "'," + P_Str_Id + "";
                    P_Str_cmdtxt += ",'" + this.txtGoodsName.Text + "','" + this.txtSpec.Text + "','" + this.txtNum.Text + "'";
                    P_Str_cmdtxt += ",'" + this.cbxUnit.SelectedValue.ToString() + "','" + this.dtBirthday.Value.ToString("yyyy-MM-dd") + "'";
                    P_Str_cmdtxt += "," + Convert.ToDecimal(this.txtReGoodsPrice.Text) + "," + Convert.ToDecimal(this.txtNeedPay.Text) + "," + Convert.ToDecimal(this.txtHasPay.Text) + "";
                    P_Str_cmdtxt += ",'" + this.txtResult.Text + "','1','" + PropertyClass.GetStockID + "')";

                    if (this.txtGoodsName.Text == "")
                    {
                        MessageBox.Show("图书名称不能为空!", "提示对话框", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }
                    else
                    {
                        SqlDataReader P_dr2 = G_SqlClass.GetReader("select GoodsID,GoodsNum from tb_Sell where GoodsID='"
                                                                   + PropertyClass.GetGoodsID + "' and GoodsNum<'" + Convert.ToInt32(txtNum.Text.Trim()) + "'");
                        P_dr2.Read();
                        if (P_dr2.HasRows)
                        {
                            MessageBox.Show("没有销售过这么多图书,请重新填写退货数量!");
                            txtNum.Text = "";
                            txtNum.Focus();
                        }
                        else
                        {
                            //执行SQL语句并返回执行结果
                            if (G_SqlClass.GetExecute(P_Str_cmdtxt))
                            {
                                MessageBox.Show("数据添加成功!");
                                ControlStatus();
                            }
                            else
                            {
                                MessageBox.Show("数据添加失败!");
                            }
                        }
                        P_dr2.Close();
                    }
                }
                else
                {
                    MessageBox.Show("请选择客户姓名!", "提示对话框", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                break;

            case 2:
                if (this.cbxCustomerName.SelectedValue.ToString() != "")
                {
                    string P_Str_Id = String.Empty;

                    //检索数据库中对应客户的ID
                    string        P_Str_cmdtxt2 = "SELECT CustomerID,Name FROM tb_Customer WHERE Name='" + this.cbxCustomerName.SelectedValue.ToString() + "'";
                    SqlDataReader P_dr          = G_SqlClass.GetReader(P_Str_cmdtxt2);
                    P_dr.Read();
                    if (P_dr.HasRows)
                    {
                        P_Str_Id = P_dr["CustomerID"].ToString();
                    }
                    P_dr.Close();

                    P_Str_condition = this.dgvReGoodsInfo[0, this.dgvReGoodsInfo.CurrentCell.RowIndex].Value.ToString();
                    P_Str_cmdtxt    = "UPDATE tb_ReGoods SET ReGoodsName='" + this.txtGoodsName.Text + "',ReGoodsSpec='" + this.txtSpec.Text + "'";
                    P_Str_cmdtxt   += ",ReGoodsTime='" + this.dtBirthday.Value + "',CustomerID = " + P_Str_Id + ",ReGoodsNum='" + this.txtNum.Text + "'";
                    P_Str_cmdtxt   += ",ReGoodsUnit='" + this.cbxUnit.SelectedValue.ToString() + "',ReGoodsPrice=" + Convert.ToDecimal(this.txtReGoodsPrice.Text) + "";
                    P_Str_cmdtxt   += ",ReGoodsResult='" + this.txtResult.Text + "',NeedPay=" + Convert.ToDecimal(this.txtNeedPay.Text) + ",HasPay=" + Convert.ToDecimal(this.txtHasPay.Text) + "";
                    P_Str_cmdtxt   += " WHERE ReGoodsID='" + P_Str_condition + "'";

                    if (G_SqlClass.GetExecute(P_Str_cmdtxt))
                    {
                        MessageBox.Show("数据修改成功!");
                        ControlStatus();
                        PropertyClass.GetGoodsID = null;
                    }
                    else
                    {
                        MessageBox.Show("数据修改失败!");
                    }
                }
                else
                {
                    MessageBox.Show("请选择客户姓名!", "提示对话框", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                break;

            default:
                break;
            }
            //绑定数据显示控件
            string P_Str_cmdtxt1 = "SELECT ReGoodsID as 退货ID,GoodsID as 进货ID,ReGoodsName as 图书名称,Name as 顾客姓名,ReGoodsTime as 退货日期";

            P_Str_cmdtxt1 += ",ReGoodsNum as 退货数量,ReGoodsUnit as 图书单位,ReGoodsSpec as 图书规格,ReGoodsPrice as 进货价格,NeedPay as 应付金额";
            P_Str_cmdtxt1 += ",HasPay as 实付金额,ReGoodsResult as 退货原因 FROM v_ReGoods WHERE ReGoodsSort='1'";
            this.dgvReGoodsInfo.DataSource = G_SqlClass.GetDs(P_Str_cmdtxt1).Tables[0];
        }
Example #2
0
        private void toolSave_Click(object sender, EventArgs e)
        {
            string P_Str_condition, P_Str_cmdtxt;

            switch (G_Int_status)
            {
            case 1:
                if (this.cbxSellName.SelectedValue.ToString() != "")
                {
                    if (this.txtGoodsName.Text == "")
                    {
                        MessageBox.Show("图书名称不能为空!", "提示对话框", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }
                    if (this.txtNum.Text == "")
                    {
                        MessageBox.Show("图书数量不能为空!", "提示对话框", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }
                    if (this.txtGoodsInPrice.Text == "")
                    {
                        MessageBox.Show("图书进价不能为空!", "提示对话框", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }
                    if (this.txtSellPrice.Text == "")
                    {
                        MessageBox.Show("销售价格不能为空!", "提示对话框", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }
                    if (this.txtNeedPay.Text == "")
                    {
                        MessageBox.Show("应付金额不能为空!", "提示对话框", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }
                    if (!G_OperationClass.IsNumeric(this.txtNum.Text) && !G_OperationClass.IsNumeric(this.txtGoodsInPrice.Text) &&
                        !G_OperationClass.IsNumeric(this.txtHasPay.Text) && !G_OperationClass.IsNumeric(this.txtSellPrice.Text))
                    {
                        MessageBox.Show("您输入的数据格式有误!", "提示对话框", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    string P_Str_Id = String.Empty;

                    //检索数据库中对应客户的ID
                    string        P_Str_cmdtxt2 = "SELECT UserID,Name FROM tb_User WHERE Name='" + this.cbxSellName.SelectedValue.ToString() + "'";
                    SqlDataReader P_dr          = G_SqlClass.GetReader(P_Str_cmdtxt2);
                    P_dr.Read();
                    if (P_dr.HasRows)
                    {
                        P_Str_Id = P_dr["UserID"].ToString();
                    }
                    P_dr.Close();
                    //下面是要执行的SQL语句
                    P_Str_cmdtxt  = "INSERT INTO tb_Sell(SellID,GoodsID,UserID,GoodsName,GoodsNum,GoodsUnit,GoodsTime,GoodsSpec,GoodsPrice,SellPrice";
                    P_Str_cmdtxt += ",Remark,NeedPay,HasPay,StockID) VALUES('" + this.labGoodsID.Text + "','" + PropertyClass.GetGoodsID + "','" + P_Str_Id + "'";
                    P_Str_cmdtxt += ",'" + this.txtGoodsName.Text + "','" + this.txtNum.Text + "','" + this.cbxUnit.SelectedValue.ToString() + "'";
                    P_Str_cmdtxt += ",'" + this.dtBirthday.Value.ToString("yyyy-MM-dd") + "','" + this.txtSpec.Text + "'," + this.txtGoodsInPrice.Text + "";
                    P_Str_cmdtxt += "," + this.txtSellPrice.Text + ",'" + this.txtRemark.Text + "'";
                    P_Str_cmdtxt += "," + this.txtNeedPay.Text + "," + this.txtHasPay.Text + ",'" + PropertyClass.GetStockID + "')";
                    SqlDataReader P_dr2 = G_SqlClass.GetReader("select GoodsID,StockNum from tb_Stock where GoodsID='"
                                                               + PropertyClass.GetGoodsID + "' and StockNum<'" + Convert.ToInt32(txtNum.Text.Trim()) + "'");
                    P_dr2.Read();
                    if (P_dr2.HasRows)
                    {
                        MessageBox.Show("库存中没有足够数量的图书,请重新填写销售数量!");
                        txtNum.Text = "";
                        txtNum.Focus();
                    }
                    else
                    {
                        //执行SQL语句并返回执行结果
                        if (G_SqlClass.GetExecute(P_Str_cmdtxt))
                        {
                            MessageBox.Show("数据添加成功!");
                            ControlStatus();
                            PropertyClass.GetGoodsID = null;
                        }
                        else
                        {
                            MessageBox.Show("数据添加失败!");
                        }
                    }
                    P_dr2.Close();
                }
                else
                {
                    MessageBox.Show("请选择销售员姓名!", "提示对话框", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                break;

            case 2:
                if (this.cbxSellName.SelectedValue.ToString() != "")
                {
                    string P_Str_Id = String.Empty;

                    //检索数据库中对应客户的ID
                    string        P_Str_cmdtxt2 = "SELECT UserID,Name FROM tb_User WHERE Name='" + this.cbxSellName.SelectedValue.ToString() + "'";
                    SqlDataReader P_dr          = G_SqlClass.GetReader(P_Str_cmdtxt2);
                    P_dr.Read();
                    if (P_dr.HasRows)
                    {
                        P_Str_Id = P_dr["UserID"].ToString();
                    }
                    P_dr.Close();

                    P_Str_condition = this.dgvSellInfo[0, this.dgvSellInfo.CurrentCell.RowIndex].Value.ToString();
                    P_Str_cmdtxt    = "UPDATE tb_Sell SET GoodsName='" + this.txtGoodsName.Text + "',GoodsNum='" + this.txtNum.Text + "'";
                    P_Str_cmdtxt   += ",GoodsUnit='" + this.cbxUnit.SelectedValue.ToString() + "',GoodsTime='" + this.dtBirthday.Value + "'";
                    P_Str_cmdtxt   += ",GoodsSpec='" + this.txtSpec.Text + "',UserID='" + P_Str_Id + "',GoodsPrice=" + this.txtGoodsInPrice.Text + "";
                    P_Str_cmdtxt   += ",SellPrice=" + this.txtSellPrice.Text + ",Remark='" + this.txtRemark.Text + "'";
                    P_Str_cmdtxt   += ",NeedPay=" + this.txtNeedPay.Text + ",HasPay=" + this.txtHasPay.Text + " WHERE SellID='" + P_Str_condition + "'";

                    if (G_SqlClass.GetExecute(P_Str_cmdtxt))
                    {
                        MessageBox.Show("数据修改成功!");
                        ControlStatus();
                    }
                    else
                    {
                        MessageBox.Show("数据修改失败!");
                    }
                }
                else
                {
                    MessageBox.Show("请选择销售员姓名!", "提示对话框", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                break;

            default:
                break;
            }
            //绑定数据显示控件
            string P_Str_cmdtxt1 = "SELECT SellID,GoodsID as 图书ID,[Name] as 销售员姓名,GoodsName as 图书名称";

            P_Str_cmdtxt1 += ",GoodsNum as 销售数量,GoodsUnit as 图书单位,GoodsSpec as 图书规格,GoodsTime as 销售时间";
            P_Str_cmdtxt1 += ",GoodsPrice 进货价格,SellPrice as 销售价格,NeedPay as 应收金额,HasPay as 实收金额,Remark as 备注";
            P_Str_cmdtxt1 += " FROM v_UserSell";
            this.dgvSellInfo.DataSource = G_SqlClass.GetDs(P_Str_cmdtxt1).Tables[0];
        }
Example #3
0
        private void toolSave_Click(object sender, EventArgs e)
        {
            string P_Str_condition, P_Str_cmdtxt;

            switch (G_Int_status)
            {
            case 1:
                if (this.cbxCompanyName.SelectedValue.ToString() != "")
                {
                    if (this.txtGoodsName.Text == "")
                    {
                        MessageBox.Show("图书名称不能为空!", "提示对话框", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }
                    if (this.txtNum.Text == "")
                    {
                        MessageBox.Show("图书数量不能为空!", "提示对话框", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }
                    if (this.txtGoodsPrice.Text == "")
                    {
                        MessageBox.Show("图书进价不能为空!", "提示对话框", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }
                    if (this.txtHasPay.Text == "")
                    {
                        MessageBox.Show("销售价格不能为空!", "提示对话框", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }
                    if (!G_OperationForm.IsNumeric(this.txtNum.Text) && !G_OperationForm.IsNumeric(this.txtGoodsPrice.Text) &&
                        !G_OperationForm.IsNumeric(this.txtHasPay.Text))
                    {
                        MessageBox.Show("您输入的数据格式有误!", "提示对话框", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }
                    //下面是要执行的SQL语句
                    P_Str_cmdtxt  = "INSERT INTO tb_ReGoods(ReGoodsID,GoodsID,UserID,CompanyName,ReGoodsName,ReGoodsSpec,ReGoodsNum,ReGoodsUnit";
                    P_Str_cmdtxt += ",ReGoodsTime,ReGoodsPrice,NeedPay,HasPay,ReGoodsResult,ReGoodsSort,StockID) VALUES('" + this.labReGoodsID.Text + "'";
                    P_Str_cmdtxt += ",'" + PropertyClass.GetGoodsID + "','" + PropertyClass.SendUserIDValue + "','" + this.cbxCompanyName.SelectedValue.ToString() + "'";
                    P_Str_cmdtxt += ",'" + this.txtGoodsName.Text + "','" + this.txtSpec.Text + "','" + this.txtNum.Text + "'";
                    P_Str_cmdtxt += ",'" + this.cbxUnit.SelectedValue.ToString() + "','" + this.dtBirthday.Value.ToString("yyyy-MM-dd") + "'";
                    P_Str_cmdtxt += "," + this.txtGoodsPrice.Text + "," + this.txtNeedPay.Text + "," + this.txtHasPay.Text + "";
                    P_Str_cmdtxt += ",'" + this.txtResult.Text + "','0','" + PropertyClass.GetStockID + "')";

                    if (this.txtGoodsName.Text == "")
                    {
                        MessageBox.Show("图书名称不能为空!", "提示对话框", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }
                    else
                    {
                        SqlDataReader P_dr2 = G_SqlClass.GetReader("select GoodsID,StockNum from tb_Stock where GoodsID='"
                                                                   + PropertyClass.GetGoodsID + "' and StockNum<'" + Convert.ToInt32(txtNum.Text.Trim()) + "'");
                        P_dr2.Read();
                        if (P_dr2.HasRows)
                        {
                            MessageBox.Show("库存中没有如此多的图书,请重新填写退货数量!");
                            txtNum.Text = "";
                            txtNum.Focus();
                        }
                        else
                        {
                            //执行SQL语句并返回执行结果
                            if (G_SqlClass.GetExecute(P_Str_cmdtxt))
                            {
                                MessageBox.Show("数据添加成功!");
                                ControlStatus();
                                PropertyClass.GetDgvData = null;
                            }
                            else
                            {
                                MessageBox.Show("数据添加失败!");
                            }
                        }
                        P_dr2.Close();
                    }
                }
                else
                {
                    MessageBox.Show("请选择供应商名称!", "提示对话框", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                break;

            case 2:
                if (this.cbxCompanyName.SelectedValue.ToString() != "")
                {
                    P_Str_condition = this.dgvReGoodsInfo[0, this.dgvReGoodsInfo.CurrentCell.RowIndex].Value.ToString();
                    P_Str_cmdtxt    = "UPDATE tb_ReGoods SET ReGoodsName='" + this.txtGoodsName.Text + "',ReGoodsSpec='" + this.txtSpec.Text + "'";
                    P_Str_cmdtxt   += ",ReGoodsTime='" + this.dtBirthday.Value + "',ReGoodsNum='" + this.txtNum.Text + "'";
                    P_Str_cmdtxt   += ",ReGoodsUnit='" + this.cbxUnit.SelectedValue.ToString() + "',ReGoodsPrice=" + Convert.ToDecimal(this.txtGoodsPrice.Text) + "";
                    P_Str_cmdtxt   += ",ReGoodsResult='" + this.txtResult.Text + "',NeedPay=" + Convert.ToDecimal(this.txtNeedPay.Text) + ",HasPay=" + Convert.ToDecimal(this.txtHasPay.Text) + "";
                    P_Str_cmdtxt   += " WHERE ReGoodsID='" + P_Str_condition + "'";
                    try
                    {
                        if (G_SqlClass.GetExecute(P_Str_cmdtxt))
                        {
                            MessageBox.Show("数据修改成功!");
                            ControlStatus();
                        }
                    }
                    catch
                    {
                        MessageBox.Show("数据修改失败!");
                    }
                }
                else
                {
                    MessageBox.Show("请选择供应商名称!", "提示对话框", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                break;

            default:
                break;
            }
            ReGoods_Load(sender, e);
        }
Example #4
0
        private void toolSave_Click(object sender, EventArgs e)
        {
            string P_Str_condition, P_Str_cmdtxt;

            switch (G_Int_status)
            {
            case 1:
                if (this.cbxEmployeeName.SelectedValue.ToString() != "")
                {
                    string P_Str_Id = String.Empty;

                    //检索数据库中对应客户的ID
                    string        P_Str_cmdtxt2 = "SELECT UserID,Name FROM tb_User WHERE Name='" + this.cbxEmployeeName.SelectedValue.ToString() + "'";
                    SqlDataReader P_dr          = G_SqlClass.GetReader(P_Str_cmdtxt2);
                    P_dr.Read();
                    if (P_dr.HasRows)
                    {
                        P_Str_Id = P_dr["UserID"].ToString();
                    }
                    P_dr.Close();
                    //下面是要执行的SQL语句
                    P_Str_cmdtxt  = "INSERT INTO tb_Goods(GoodsID,UserID,CompanyName,DepotName,GoodsName,GoodsNum,GoodsUnit,GoodsTime,GoodsSpec,GoodsPrice,SellPrice";
                    P_Str_cmdtxt += ",Remark,NeedPay,HasPay) VALUES('" + this.labGoodsID.Text + "','" + P_Str_Id + "'";
                    P_Str_cmdtxt += ",'" + this.cbxCompanyName.SelectedValue.ToString() + "','" + this.cbxDepot.SelectedValue.ToString() + "'";
                    P_Str_cmdtxt += ",'" + this.txtGoodsName.Text + "','" + this.txtNum.Text + "','" + this.cbxUnit.SelectedValue.ToString() + "'";
                    P_Str_cmdtxt += ",'" + this.dtBirthday.Value.ToString("yyyy-MM-dd") + "','" + this.txtSpec.Text + "'," + this.txtGoodsInPrice.Text + "";
                    P_Str_cmdtxt += "," + this.txtSellPrice.Text + ",'" + this.txtRemark.Text + "'";
                    P_Str_cmdtxt += "," + this.txtNeedPay.Text + "," + this.txtHasPay.Text + ")";

                    if (this.txtGoodsName.Text == "")
                    {
                        MessageBox.Show("图书名称不能为空!", "提示对话框", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }
                    if (this.txtNum.Text == "")
                    {
                        MessageBox.Show("图书数量不能为空!", "提示对话框", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }
                    if (this.txtGoodsInPrice.Text == "")
                    {
                        MessageBox.Show("图书进价不能为空!", "提示对话框", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }
                    if (this.txtSellPrice.Text == "")
                    {
                        MessageBox.Show("销售价格不能为空!", "提示对话框", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }
                    if (!G_OperationForm.IsNumeric(this.txtNum.Text) && !G_OperationForm.IsNumeric(this.txtGoodsInPrice.Text) &&
                        !G_OperationForm.IsNumeric(this.txtHasPay.Text) && !G_OperationForm.IsNumeric(this.txtSellPrice.Text))
                    {
                        MessageBox.Show("您输入的数据格式有误!", "提示对话框", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        //执行SQL语句并返回执行结果
                        if (G_SqlClass.GetExecute(P_Str_cmdtxt))
                        {
                            MessageBox.Show("数据添加成功!");
                            ControlStatus();
                        }
                        else
                        {
                            MessageBox.Show("数据添加失败!");
                        }
                    }
                }
                else
                {
                    MessageBox.Show("请选择销售员姓名!", "提示对话框", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                break;

            case 2:
                if (this.cbxEmployeeName.SelectedValue.ToString() != "")
                {
                    string P_Str_Id = String.Empty;

                    //检索数据库中对应客户的ID
                    string        P_Str_cmdtxt2 = "SELECT UserID,Name FROM tb_User WHERE Name='" + this.cbxEmployeeName.SelectedValue.ToString() + "'";
                    SqlDataReader P_dr          = G_SqlClass.GetReader(P_Str_cmdtxt2);
                    P_dr.Read();
                    if (P_dr.HasRows)
                    {
                        P_Str_Id = P_dr["UserID"].ToString();
                    }
                    P_dr.Close();

                    P_Str_condition = this.dgvGoodsInfo[0, this.dgvGoodsInfo.CurrentCell.RowIndex].Value.ToString();
                    P_Str_cmdtxt    = "UPDATE tb_Goods SET GoodsName='" + this.txtGoodsName.Text + "',CompanyName='" + this.cbxCompanyName.SelectedValue.ToString() + "'";
                    P_Str_cmdtxt   += ",DepotName='" + this.cbxDepot.SelectedValue.ToString() + "',GoodsNum='" + this.txtNum.Text + "'";
                    P_Str_cmdtxt   += ",GoodsUnit='" + this.cbxUnit.SelectedValue.ToString() + "',GoodsTime='" + this.dtBirthday.Value + "'";
                    P_Str_cmdtxt   += ",GoodsSpec='" + this.txtSpec.Text + "',UserID='" + P_Str_Id + "',GoodsPrice=" + this.txtGoodsInPrice.Text + "";
                    P_Str_cmdtxt   += ",SellPrice=" + this.txtSellPrice.Text + ",Remark='" + this.txtRemark.Text + "'";
                    P_Str_cmdtxt   += ",NeedPay=" + this.txtNeedPay.Text + ",HasPay=" + this.txtHasPay.Text + " WHERE GoodsID='" + P_Str_condition + "'";

                    if (G_SqlClass.GetExecute(P_Str_cmdtxt))
                    {
                        MessageBox.Show("数据修改成功!");
                        ControlStatus();
                    }
                    else
                    {
                        MessageBox.Show("数据修改失败!");
                    }
                }
                else
                {
                    MessageBox.Show("请选择销售员姓名!", "提示对话框", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                break;

            default:
                break;
            }
            //绑定数据显示控件
            string cmdtxt = "SELECT GoodsID as 图书ID,GoodsName as 图书名称,GoodsTime as 进货日期,CompanyName as 供应商名称";

            cmdtxt += ",GoodsNum as 进货数量,GoodsUnit as 图书单位,GoodsPrice as 图书进价,DepotName as 所属仓库,GoodsSpec as 图书规格";
            cmdtxt += ",SellPrice as 销售价格,NeedPay as 应付金额,HasPay as 实付金额,Remark as 备注 FROM tb_Goods";
            this.dgvGoodsInfo.DataSource = G_SqlClass.GetDs(cmdtxt).Tables[0];
        }