示例#1
0
        public static List <ScoInfo1> GetAllSco()
        {
            string          sql  = "select * form card_sco";
            OleDbDataReader dr   = Dbhelper.ExecuteReader(sql);
            List <ScoInfo1> list = new List <ScoInfo1>();

            while (dr.Read())
            {
                ScoInfo1 sco = new ScoInfo1();
                sco.Id     = int.Parse(dr[0].ToString());
                sco.User   = dr[1].ToString();
                sco.Sco    = dr[2].ToString();
                sco.ScoHis = dr[3].ToString();
                list.Add(sco);
            }
            return(list);
        }
示例#2
0
        private void button2_Click(object sender, EventArgs e)
        {
            ScoInfo1 sco = new ScoInfo1();

            sco.User   = this.tex_Card.Text;
            sco.ScoHis = int.Parse(this.tex_His.Text.ToString()) + int.Parse(this.tex_input.Text) + "";
            sco.Sco    = int.Parse(this.tex_input.Text) + int.Parse(this.tex_Sco.Text) + "";

            if (float.Parse(this.tex_input.Text) > float.Parse(this.tex_scort.Text))
            {
                MessageBox.Show("没有积分可以兑换!!");
            }
            else
            {
                ScoServices.UpdataSco(sco); MessageBox.Show("积分转换成功!!!");
            }
        }
示例#3
0
        private void textBox1_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyValue == 13)
            {
                ScoInfo1 sco = ScoServices.GetScorByUser(this.tex_Card.Text);

                float f = BuyBkServices.GetAllBuyBkByUser(this.tex_Card.Text);
                if (f <= 0)
                {
                    MessageBox.Show("此会员没有消费过!!");
                }
                else
                {
                    this.tex_His.Text = sco.ScoHis;
                    this.tex_Sco.Text = sco.Sco;
                    f = f / 100 * 3;
                    f = f - float.Parse(this.tex_His.Text);
                    this.tex_scort.Text = f.ToString();
                }
            }
        }
示例#4
0
        public static ScoInfo1 GetScorByUser(string username)
        {
            string          sql = string.Format("select * from card_sco where sco_user = '******'", username);
            OleDbDataReader dr  = Dbhelper.ExecuteReader(sql);

            if (dr.Read())
            {
                ScoInfo1 sco = new ScoInfo1();
                sco.Id     = int.Parse(dr[0].ToString());
                sco.User   = dr[1].ToString();
                sco.ScoHis = dr[3].ToString();
                sco.Sco    = dr[2].ToString();
                return(sco);
            }
            ScoInfo1 sco1 = new ScoInfo1();

            sco1.User   = username;
            sco1.ScoHis = "0";
            sco1.Sco    = "0";
            AddScor(sco1);
            return(sco1);
        }
示例#5
0
        public static int DelSco(ScoInfo1 sco)
        {
            string sql = string.Format("DELETE sci where sco_id = {0}", sco.Id);

            return(Dbhelper.ExecuteNonQuery(sql));
        }
示例#6
0
        public static int UpdataSco(ScoInfo1 sco)
        {
            string sql = string.Format("update card_sco set sco_sco='{0}', sco_his='{1}' where sco_user='******'", sco.Sco, sco.ScoHis, sco.User);

            return(Dbhelper.ExecuteNonQuery(sql));
        }
示例#7
0
        public static int AddScor(ScoInfo1 sco)
        {
            string sql = string.Format("insert into card_sco (sco_user,sco_sco,sco_his) values('{0}','{1}','{2}')", sco.User, sco.Sco, sco.ScoHis);

            return(Dbhelper.ExecuteNonQuery(sql));
        }