Ejemplo n.º 1
0
        public static int AddNewVip(VipInfo vip, string CardNum)
        {
            string sql = string.Format("insert into VipInfo (VipName,VipPhone,VipBirth,VipLevel,Sex,CardNumber) values('{0}','{1}','{2}','{3}','{4}',{5})", vip.Name, vip.Phone, vip.Birthday, "5", vip.Sex, CardNum);
            int    val = Dbhelper.ExecuteNonQuery(sql);

            sql = string.Format("update SentCardInfo set ConnectVipId='{0}' where CardNumber='{1}' ", GetVipIdFromVipInfo(CardNum), CardNum);
            val = val + Dbhelper.ExecuteNonQuery(sql);
            return(val);
        }
Ejemplo n.º 2
0
        public static int ChangeVipConnCard(string CardNum, VipInfo vip)
        {
            string OldBalance = GetCardBalance(vip.ConnectCarNum);//转移余额
            string sql        = string.Format("update SentCardInfo set Balance='{0}' where CardNumber= '{1}' ", 0, vip.ConnectCarNum);
            int    val        = Dbhelper.ExecuteNonQuery(sql);

            sql = string.Format("update SentCardInfo set Balance='{0}' where CardNumber='{1}' ", uint.Parse(OldBalance), CardNum);
            val = Dbhelper.ExecuteNonQuery(sql);
            sql = string.Format("update VipInfo set CardNumber='{0}' where VipId= {1} ", CardNum, vip.VipId);
            //标准表达式中数据类型不匹配
            val = Dbhelper.ExecuteNonQuery(sql);
            sql = string.Format("update SentCardInfo set ConnectVipId='{0}' and Balance='{1}' where CardNumber='{2}' ", vip.VipId, uint.Parse(OldBalance), CardNum);
            val = val + Dbhelper.ExecuteNonQuery(sql);
            return(val);
        }
Ejemplo n.º 3
0
        public static VipInfo GetVipInfo(uint VipId, VipInfo vip)
        {
            string          sql = string.Format("select * from VipInfo where VipId = {0}", VipId.ToString());//标准表达式中数据类型不匹配。不能使用上面一样的单引号
            OleDbDataReader dr  = Dbhelper.ExecuteReader(sql);

            if (dr.Read())
            {
                vip.VipId         = dr[0].ToString();
                vip.Name          = dr[1].ToString();
                vip.Phone         = dr[2].ToString();
                vip.Birthday      = dr[3].ToString();
                vip.Level         = uint.Parse(dr[4].ToString());
                vip.Sex           = dr[5].ToString();
                vip.ConnectCarNum = dr[6].ToString();
            }
            return(vip);
        }
Ejemplo n.º 4
0
        public static List <VipInfo> SearchAllVipInfo()
        {
            string          sql  = string.Format("select * from VipInfo");
            OleDbDataReader dr   = Dbhelper.ExecuteReader(sql);
            List <VipInfo>  list = new List <VipInfo>();

            while (dr.Read())
            {
                VipInfo vip = new VipInfo();
                vip.VipId         = dr[0].ToString();
                vip.Name          = dr[1].ToString();
                vip.Phone         = dr[2].ToString();
                vip.Birthday      = dr[3].ToString();
                vip.Level         = uint.Parse(dr[4].ToString());
                vip.Sex           = dr[5].ToString();
                vip.ConnectCarNum = dr[6].ToString();
                list.Add(vip);
            }
            dr.Close();
            return(list);
        }
Ejemplo n.º 5
0
        public static List <VipInfo> SearchVipInfo(string name, string phone, string CardNum)
        {
            string          sql  = string.Format("select * from VipInfo where VipName='{0}' and VipPhone='{1}' and CardNumber='{2}'", name, phone, CardNum);
            OleDbDataReader dr   = Dbhelper.ExecuteReader(sql);
            List <VipInfo>  list = new List <VipInfo>();

            while (dr.Read())
            {
                VipInfo vip = new VipInfo();
                vip.VipId         = dr[0].ToString();
                vip.Name          = dr[1].ToString();
                vip.Phone         = dr[2].ToString();
                vip.Birthday      = dr[3].ToString();
                vip.Level         = uint.Parse(dr[4].ToString());
                vip.Sex           = dr[5].ToString();
                vip.ConnectCarNum = dr[6].ToString();
                list.Add(vip);
            }
            dr.Close();
            return(list);
        }