Beispiel #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (this.txtGrade.Text == "" || this.txtD.Text == "")
            {
                MessageBox.Show("数据部能为空");
            }
            else
            {
                int a = Convert.ToInt32(this.txtid.Text);

                string b = this.txtGrade.Text;

                double c = Convert.ToDouble(this.txtD.Text);

                VipGrade v = new VipGrade();
                v.VGID       = a;
                v.VGName     = b;
                v.VGDiscount = c;

                bool bb = VipsBLL.update(v);
                if (bb == true)
                {
                    this.Close();

                    // MessageBox.Show("成功");
                }

                else
                {
                    MessageBox.Show("失败");
                }
            }
        }
Beispiel #2
0
        public static bool update(VipGrade list)
        {
            int count = VipsDAL.update(list);

            if (count >= 1)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #3
0
        public static int update(VipGrade list)
        {
            string sql = "update VIPGrade set VGName=@hui ,VGDiscount=@zhe where VGID=@id";

            SqlParameter[] sps = new SqlParameter[]
            {
                new SqlParameter("@hui", list.VGName),
                new SqlParameter("@zhe", list.VGDiscount),
                new SqlParameter("@id", list.VGID)
            };

            int count = DBHelper.ExecuteNonQuery(sql, sps);

            return(count);
        }
Beispiel #4
0
        public static List <VipGrade> selectvip()
        {
            List <VipGrade> vip = new List <VipGrade>();
            string          sql = "select * from VIPGrade";
            SqlDataReader   sdr = DBHelper.ExecuteReader(sql, null);

            while (sdr.Read())
            {
                VipGrade v = new VipGrade();
                v.VGID       = Convert.ToInt32(sdr["VGID"].ToString());
                v.VGName     = sdr["VGName"].ToString();
                v.VGDiscount = Convert.ToDouble(sdr["VGDiscount"].ToString());

                vip.Add(v);
            }
            sdr.Close();
            return(vip);
        }