Example #1
0
        public void Amend()     //修改商品信息
        {
            int yy = 0;

            if (Judge())
            {
                yy = 1;
            }
            else
            {
                yy = 0;
            }
            if (!Judge())
            {
                nuMoney.Value = nuPrice.Value;
            }
            string sql = string.Format("UPDATE Commodity SET CommodityName='{0}',SortID={1},CommodityPrice={2},IsDiscount={3},ReducedPrice={4} WHERE CommodityID = {5} ", txtName.Text.Trim(), cboType.SelectedValue, Convert.ToDouble(nuPrice.Value), yy, Convert.ToDouble(nuMoney.Value), id);

            try
            {
                SqlCommand comm = new SqlCommand(sql, db.Connection);
                db.OpenConnection();
                int i = comm.ExecuteNonQuery();
                if (i > 0)
                {
                    MessageBox.Show("更新成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    frmList list = new frmList();
                    list.ds = new DataSet();
                    list.dgvShow.DataSource = list.ds.Tables["Commodity"];
                }
                else
                {
                    MessageBox.Show("更新失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                db.CloseConnection();
            }
        }
Example #2
0
        private void pbBeijing_Click(object sender, EventArgs e)        //京东狗单击事件
        {
            frmList list = new frmList();

            list.Show();
        }