Esempio n. 1
0
        public static void Add(ProductModel info)
        {
            string sql = @"INSERT INTO odnshop_product( 
                            productname ,
                            includepicpath ,
                            productpics,
                            iscommend,
                            productcode ,
                            description ,
                            specification ,
                            salecount ,
                            hits ,productcount,
                            price,itemprice,categoryid,createtime) VALUES (?productname,?includepicpath,?productpics,?iscommend,?productcode,?description,?specification,?salecount,?hits,?productcount,?price,?itemprice,?categoryid,?createtime)";

            MySqlParameter[] parameters =
            {
                MySqlDbHelper.MakeInParam("?productname",    MySqlDbType.VarChar,    50, info.productname),
                MySqlDbHelper.MakeInParam("?includepicpath", MySqlDbType.VarChar,    50, info.includepicpath),
                MySqlDbHelper.MakeInParam("?productpics",    MySqlDbType.MediumText,  0, info.productpics),
                MySqlDbHelper.MakeInParam("?iscommend",      MySqlDbType.Bit,         1, info.iscommend),
                MySqlDbHelper.MakeInParam("?productcode",    MySqlDbType.Int32,       4, info.productcode),
                MySqlDbHelper.MakeInParam("?description",    MySqlDbType.VarChar,     0, info.description),
                MySqlDbHelper.MakeInParam("?specification",  MySqlDbType.VarChar,     0, info.specification),
                MySqlDbHelper.MakeInParam("?salecount",      MySqlDbType.Int32,       4, info.salecount),
                MySqlDbHelper.MakeInParam("?hits",           MySqlDbType.Int32,       4, info.hits),
                MySqlDbHelper.MakeInParam("?productcount",   MySqlDbType.Int32,       4, info.productcount),
                MySqlDbHelper.MakeInParam("?price",          MySqlDbType.Decimal,     8, info.price),
                MySqlDbHelper.MakeInParam("?itemprice",      MySqlDbType.VarChar,     0, info.itemprice),
                MySqlDbHelper.MakeInParam("?categoryid",     MySqlDbType.Int32,       4, info.categoryid),
                MySqlDbHelper.MakeInParam("?createtime",     MySqlDbType.Date,        8, info.createtime)
            };

            MySqlDbHelper.Query(sql, parameters);
        }
Esempio n. 2
0
        public static void Update(UserModel info)
        {
            string sql = @"update odnshop_user set 
                            nickname = ?nickname,
                            openid = ?openid,
                            fullname = ?fullname,
                            sex = ?sex,
                            tel = ?tel,
                            address = ?address,
                            headpicurl = ?headpicurl,
                            jbnum = ?jbnum,
                            jfnum = ?jfnum,
                            createdate = ?createdate,
                            fromuid = ?fromuid,
                            usertype = ?usertype where uid = ?uid";

            MySqlParameter[] parameters =
            {
                MySqlDbHelper.MakeInParam("?nickname",   MySqlDbType.VarChar,  50, info.nickname),
                MySqlDbHelper.MakeInParam("?openid",     MySqlDbType.VarChar, 255, info.openid),
                MySqlDbHelper.MakeInParam("?fullname",   MySqlDbType.VarChar,  50, info.fullname),
                MySqlDbHelper.MakeInParam("?sex",        MySqlDbType.VarChar,  50, info.sex),
                MySqlDbHelper.MakeInParam("?tel",        MySqlDbType.VarChar,  50, info.tel),
                MySqlDbHelper.MakeInParam("?address",    MySqlDbType.VarChar,  50, info.address),
                MySqlDbHelper.MakeInParam("?headpicurl", MySqlDbType.VarChar, 255, info.headpicurl),
                MySqlDbHelper.MakeInParam("?jbnum",      MySqlDbType.Int32,     4, info.jbnum),
                MySqlDbHelper.MakeInParam("?jfnum",      MySqlDbType.Int32,     4, info.jfnum),
                MySqlDbHelper.MakeInParam("?createdate", MySqlDbType.Date,      8, info.createdate),
                MySqlDbHelper.MakeInParam("?fromuid",    MySqlDbType.Int32,     4, info.fromuid),
                MySqlDbHelper.MakeInParam("?usertype",   MySqlDbType.Int32,     4, info.usertype),
                MySqlDbHelper.MakeInParam("?uid",        MySqlDbType.Int32,     4, info.uid)
            };

            MySqlDbHelper.Query(sql, parameters);
        }
Esempio n. 3
0
        public static void UpdateUsertype(int uid, int usertype)
        {
            string sql = @"update odnshop_user set usertype=?usertype where uid = ?uid";

            MySqlParameter[] parameters =
            {
                MySqlDbHelper.MakeInParam("?usertype", MySqlDbType.Int32, 4, usertype),
                MySqlDbHelper.MakeInParam("?uid",      MySqlDbType.Int32, 4, uid)
            };

            MySqlDbHelper.Query(sql, parameters);
        }
Esempio n. 4
0
        public static void UpdateOrderStatus(string orderno, int orderstatus)
        {
            string sql = "UPDATE odnshop_order set orderstatus=?orderstatus where orderno=?orderno";

            MySqlParameter[] parameters =
            {
                MySqlDbHelper.MakeInParam("?orderstatus", MySqlDbType.Int32,    4, orderstatus),
                MySqlDbHelper.MakeInParam("?orderno",     MySqlDbType.VarChar, 32, orderno)
            };

            MySqlDbHelper.Query(sql, parameters);
        }
Esempio n. 5
0
        public static void UpdateStatus(int orderstatus, int orderid)
        {
            string sql = "UPDATE odnshop_order set orderstatus=?orderstatus where orderid=?orderid";

            MySqlParameter[] parameters =
            {
                MySqlDbHelper.MakeInParam("?orderstatus", MySqlDbType.Int32, 4, orderstatus),
                MySqlDbHelper.MakeInParam("?orderid",     MySqlDbType.Int32, 4, orderid)
            };

            MySqlDbHelper.Query(sql, parameters);
        }
Esempio n. 6
0
        public static void Update(ProductCategoryModel info)
        {
            string sql = @"update odnshop_productcategory set categoryname = ?categoryname,orderid = ?orderid,parentid = ?parentid where categoryid = ?categoryid";

            MySqlParameter[] parameters =
            {
                MySqlDbHelper.MakeInParam("?categoryname", MySqlDbType.VarChar, 50, info.categoryname),
                MySqlDbHelper.MakeInParam("?orderid",      MySqlDbType.Int32,    4, info.orderid),
                MySqlDbHelper.MakeInParam("?parentid",     MySqlDbType.Int32,    4, info.parentid),
                MySqlDbHelper.MakeInParam("?categoryid",   MySqlDbType.Int32,    4, info.categoryid)
            };

            MySqlDbHelper.Query(sql, parameters);
        }
Esempio n. 7
0
        public static void Add(FavoriteModel info)
        {
            string sql = @"INSERT INTO odnshop_favorite (uid,productid,createtime,productxml) VALUES (?uid,?productid,?createtime,?productxml)";

            MySqlParameter[] parameters =
            {
                MySqlDbHelper.MakeInParam("?uid",        MySqlDbType.Int32,    4, info.uid),
                MySqlDbHelper.MakeInParam("?productid",  MySqlDbType.Int32,    4, info.productid),
                MySqlDbHelper.MakeInParam("?createtime", MySqlDbType.Datetime, 8, info.createtime),
                MySqlDbHelper.MakeInParam("?productxml", MySqlDbType.VarChar,  0, SerializeHelper.SaveToString(info.product))
            };

            MySqlDbHelper.Query(sql, parameters);
        }
Esempio n. 8
0
        //salecount,增加的销量=减少的库存量
        public static void UpdateSalecount(int productid, int salecount)
        {
            string sql = @"UPDATE odnshop_product set 
                            salecount=salecount+?salecount ,
                            productcount=productcount-?salecount WHERE productid = ?productid";

            MySqlParameter[] parameters =
            {
                MySqlDbHelper.MakeInParam("?salecount",    MySqlDbType.Int32, 4, salecount),
                MySqlDbHelper.MakeInParam("?productcount", MySqlDbType.Int32, 4, salecount),
                MySqlDbHelper.MakeInParam("?productid",    MySqlDbType.Int32, 4, productid)
            };

            MySqlDbHelper.Query(sql, parameters);
        }
Esempio n. 9
0
        public static void Add(ProductCategoryModel info)
        {
            string sql = @"INSERT INTO odnshop_productcategory ( 
                            categoryname ,
                            orderid ,
                            parentid) VALUES (?categoryname,?orderid,?parentid)";


            MySqlParameter[] parameters =
            {
                MySqlDbHelper.MakeInParam("?categoryname", MySqlDbType.VarChar, 50, info.categoryname),
                MySqlDbHelper.MakeInParam("?orderid",      MySqlDbType.Int32,    4, info.orderid),
                MySqlDbHelper.MakeInParam("?parentid",     MySqlDbType.Int32,    4, info.parentid)
            };

            MySqlDbHelper.Query(sql, parameters);
        }
Esempio n. 10
0
        public static void Update(UserGroupModel info)
        {
            string sql = "UPDATE odnshop_usergroup set groupname=?groupname,picurl=?picurl,grouplevel=?grouplevel,isdefalut=?isdefalut,upgradejf=?upgradejf,discount=?discount where groupid=?groupid";

            MySqlParameter[] parameters =
            {
                MySqlDbHelper.MakeInParam("?groupname",  MySqlDbType.VarChar,  50, info.groupname),
                MySqlDbHelper.MakeInParam("?picurl",     MySqlDbType.VarChar,  50, info.picurl),
                MySqlDbHelper.MakeInParam("?grouplevel", MySqlDbType.VarChar, 100, info.grouplevel),
                MySqlDbHelper.MakeInParam("?isdefalut",  MySqlDbType.Int32,     4, info.isdefalut?1:0),
                MySqlDbHelper.MakeInParam("?upgradejf",  MySqlDbType.Int32,     4, info.upgradejf),
                MySqlDbHelper.MakeInParam("?discount",   MySqlDbType.Date,      8, info.discount),
                MySqlDbHelper.MakeInParam("?groupid",    MySqlDbType.Int32,     4, info.groupid)
            };

            MySqlDbHelper.Query(sql, parameters);
        }
Esempio n. 11
0
        public static void Update(OrderModel info)
        {
            string sql = "UPDATE odnshop_order set customername=?customername,tel=?tel,address=?address,orderstatus=?orderstatus,deliverstatus=?deliverstatus,createtime=?createtime,orderxml=?orderxml where orderid=?orderid";

            MySqlParameter[] parameters =
            {
                MySqlDbHelper.MakeInParam("?customername",  MySqlDbType.VarChar,  50, info.customername),
                MySqlDbHelper.MakeInParam("?tel",           MySqlDbType.VarChar,  50, info.tel),
                MySqlDbHelper.MakeInParam("?address",       MySqlDbType.VarChar, 100, info.address),
                MySqlDbHelper.MakeInParam("?orderstatus",   MySqlDbType.Int32,     4, info.orderstatus),
                MySqlDbHelper.MakeInParam("?deliverstatus", MySqlDbType.Int32,     4, info.deliverstatus),
                MySqlDbHelper.MakeInParam("?createtime",    MySqlDbType.Date,      8, info.createtime),
                MySqlDbHelper.MakeInParam("?orderxml",      MySqlDbType.VarChar,   0, SerializeHelper.SaveToString(info)),
                MySqlDbHelper.MakeInParam("?orderid",       MySqlDbType.Int32,     4, info.orderid)
            };

            MySqlDbHelper.Query(sql, parameters);
        }
Esempio n. 12
0
        public static void Add(OrderModel info)
        {
            string sql = @"INSERT INTO odnshop_order (orderno,uid,customername,tel,address,orderstatus,deliverstatus,createtime,orderxml) VALUES (?orderno,?uid,?customername,?tel,?address,?orderstatus,?deliverstatus,?createtime,?orderxml)";

            MySqlParameter[] parameters =
            {
                MySqlDbHelper.MakeInParam("?orderno",       MySqlDbType.VarChar,   32, info.orderno),
                MySqlDbHelper.MakeInParam("?uid",           MySqlDbType.Int32,      4, info.uid),
                MySqlDbHelper.MakeInParam("?customername",  MySqlDbType.VarChar,   50, info.customername),
                MySqlDbHelper.MakeInParam("?tel",           MySqlDbType.VarChar,   50, info.tel),
                MySqlDbHelper.MakeInParam("?address",       MySqlDbType.VarChar,  100, info.address),
                MySqlDbHelper.MakeInParam("?orderstatus",   MySqlDbType.Int32,      4, info.orderstatus),
                MySqlDbHelper.MakeInParam("?deliverstatus", MySqlDbType.Int32,      4, info.deliverstatus),
                MySqlDbHelper.MakeInParam("?createtime",    MySqlDbType.Datetime,   8, info.createtime),
                MySqlDbHelper.MakeInParam("?orderxml",      MySqlDbType.VarChar,    0, SerializeHelper.SaveToString(info))
            };

            MySqlDbHelper.Query(sql, parameters);
        }
Esempio n. 13
0
        public static void Add(UserModel info)
        {
            string sql = @"INSERT INTO odnshop_user(nickname,openid,fullname,sex,tel,address,headpicurl,jbnum,jfnum,createdate,fromuid,usertype) VALUES(?nickname,?openid,?fullname,?sex,?tel,?address,?headpicurl,?jbnum,?jfnum,?createdate,?fromuid,?usertype)";

            MySqlParameter[] parameters =
            {
                MySqlDbHelper.MakeInParam("?nickname",   MySqlDbType.VarChar,   50, info.nickname),
                MySqlDbHelper.MakeInParam("?openid",     MySqlDbType.VarChar,  255, info.openid),
                MySqlDbHelper.MakeInParam("?fullname",   MySqlDbType.VarChar,   50, info.fullname),
                MySqlDbHelper.MakeInParam("?sex",        MySqlDbType.VarChar,   50, info.sex),
                MySqlDbHelper.MakeInParam("?tel",        MySqlDbType.VarChar,   50, info.tel),
                MySqlDbHelper.MakeInParam("?address",    MySqlDbType.VarChar,   50, info.address),
                MySqlDbHelper.MakeInParam("?headpicurl", MySqlDbType.VarChar,  255, info.headpicurl),
                MySqlDbHelper.MakeInParam("?jbnum",      MySqlDbType.Int32,      4, info.jbnum),
                MySqlDbHelper.MakeInParam("?jfnum",      MySqlDbType.Int32,      4, info.jfnum),
                MySqlDbHelper.MakeInParam("?createdate", MySqlDbType.Datetime,   8, info.createdate),
                MySqlDbHelper.MakeInParam("?fromuid",    MySqlDbType.Int32,      4, info.fromuid),
                MySqlDbHelper.MakeInParam("?usertype",   MySqlDbType.Int32,      4, info.usertype)
            };

            MySqlDbHelper.Query(sql, parameters);
        }
Esempio n. 14
0
        public static void UpdateJb(int uid, int jb)
        {
            int    jbnum = 0;
            string sql   = string.Empty;

            if (jb >= 0)
            {
                jbnum = jb;
                sql   = @"update odnshop_user set jbnum=jbnum+?jbnum where uid = ?uid";
            }
            else
            {
                jbnum = -jb;
                sql   = @"update odnshop_user set jbnum=jbnum-?jbnum where uid = ?uid";
            }

            MySqlParameter[] parameters =
            {
                MySqlDbHelper.MakeInParam("?jbnum", MySqlDbType.Int32, 4, jbnum),
                MySqlDbHelper.MakeInParam("?uid",   MySqlDbType.Int32, 4, uid)
            };

            MySqlDbHelper.Query(sql, parameters);
        }
Esempio n. 15
0
        public static void Update(ProductModel info)
        {
            string sql = @"UPDATE odnshop_product set 
                            productname=?productname ,
                            includepicpath=?includepicpath ,
                            productpics=?productpics,
                            iscommend = ?iscommend ,
                            productcode=?productcode ,
                            description=?description ,
                            specification=?specification ,
                            salecount=?salecount ,
                            hits=?hits ,
                            productcount=?productcount,
                            price=?price,itemprice=?itemprice,categoryid=?categoryid,createtime=?createtime WHERE productid = ?productid";

            MySqlParameter[] parameters =
            {
                MySqlDbHelper.MakeInParam("?productname",    MySqlDbType.VarChar,    50, info.productname),
                MySqlDbHelper.MakeInParam("?includepicpath", MySqlDbType.VarChar,    50, info.includepicpath),
                MySqlDbHelper.MakeInParam("?productpics",    MySqlDbType.MediumText,  0, info.productpics),
                MySqlDbHelper.MakeInParam("?iscommend",      MySqlDbType.Int16,       1, info.iscommend),
                MySqlDbHelper.MakeInParam("?productcode",    MySqlDbType.Int32,       4, info.productcode),
                MySqlDbHelper.MakeInParam("?description",    MySqlDbType.VarChar,     0, info.description),
                MySqlDbHelper.MakeInParam("?specification",  MySqlDbType.VarChar,     0, info.specification),
                MySqlDbHelper.MakeInParam("?salecount",      MySqlDbType.Int32,       4, info.salecount),
                MySqlDbHelper.MakeInParam("?hits",           MySqlDbType.Int32,       4, info.hits),
                MySqlDbHelper.MakeInParam("?productcount",   MySqlDbType.Int32,       4, info.productcount),
                MySqlDbHelper.MakeInParam("?price",          MySqlDbType.Decimal,     8, info.price),
                MySqlDbHelper.MakeInParam("?itemprice",      MySqlDbType.VarChar,     0, info.itemprice),
                MySqlDbHelper.MakeInParam("?categoryid",     MySqlDbType.Int32,       4, info.categoryid),
                MySqlDbHelper.MakeInParam("?createtime",     MySqlDbType.Datetime,    8, info.createtime),
                MySqlDbHelper.MakeInParam("?productid",      MySqlDbType.Int32,       4, info.productid)
            };

            MySqlDbHelper.Query(sql, parameters);
        }