/// <summary>
        /// 修改送货信息
        /// </summary>
        /// <param name="model">model</param>
        /// <returns></returns>
        public bool ChangSndGoodsUserInfor(MsendGoodsUser model)
        {
            //// sql语句
            string sql = "update sendGoodsUser set userName = ?userName,phone=?phone,sex=?sex where id = ?id";

            List <MySqlParameter> parameterList = new List <MySqlParameter>();
            MySqlParameter        parameter     = new MySqlParameter("?userName", MySqlDbType.VarChar, 500);

            parameter.Value = Base64.EncodeBase64(model.userName);
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?phone", MySqlDbType.VarChar, 50);
            parameter.Value = model.phone;
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?sex", MySqlDbType.Int16, 1);
            parameter.Value = model.sex;
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?id", MySqlDbType.VarChar, 25);
            parameter.Value = model.id;
            parameterList.Add(parameter);

            //// 执行操作
            return(PKMySqlHelper.ExecuteNonQuery(sql, parameterList.ToArray()) > 0);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 根据商品的上下架状态
        /// </summary>
        /// <param name="productid"></param>
        /// <param name="shelfstate"></param>
        /// <returns></returns>
        public bool UpdateProductShelfstate(string productid, int shelfstate)
        {
            string sql = string.Empty;

            if (shelfstate == 9999)
            {
                sql = "update  product set shelfstate=-shelfstate where productid=?productid;";
            }
            else
            {
                sql = "update  product set shelfstate=?shelfstate where productid=?productid;";
            }

            List <MySqlParameter> parameterList = new List <MySqlParameter>();
            MySqlParameter        parameter     = new MySqlParameter("?shelfstate", MySqlDbType.Int32);

            parameter.Value = shelfstate;
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?productid", MySqlDbType.VarChar, 25);
            parameter.Value = productid;
            parameterList.Add(parameter);

            //// 执行操作
            return(PKMySqlHelper.ExecuteNonQuery(sql, parameterList.ToArray()) > 0);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 新增
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool Add(Mcoupon model)
        {
            //// sql语句
            string sql = "INSERT INTO coupon (id,name,price,consumAmount,effectiveStart,effectiveEnd,creatCount,useCount,isDelete,isEffective,great_time,modify_time) " +
                         "VALUES (?id,?name,?price,?consumAmount,?effectiveStart,?effectiveEnd,?creatCount,?useCount,?isDelete,?isEffective,?great_time,?modify_time)";

            List <MySqlParameter> parameterList = GetMySqlParameterListByModel(model);

            //// 执行操作
            return(PKMySqlHelper.ExecuteNonQuery(sql, parameterList.ToArray()) > 0);
        }
        /// <summary>
        /// 新增微信菜单
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool AddWxmenu(Mwxmenu model)
        {
            //// sql语句
            string sql = "INSERT INTO wxmenu(id,superId,menuName,type,url,sortNum,isDelete,isEffective,great_time,modify_time) " +
                         "VALUES (?id,?superId,?menuName,?type,?url,?sortNum,?isDelete,?isEffective,?great_time,?modify_time)";

            List <MySqlParameter> parameterList = GetMySqlParameterListByModel(model);

            //// 执行操作
            return(PKMySqlHelper.ExecuteNonQuery(sql, parameterList.ToArray()) > 0);
        }
Exemplo n.º 5
0
        /// <summary>
        /// 新增
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool AddNews(Mnews model)
        {
            //// sql语句
            string sql = "INSERT INTO news (id,type,title,`value`,isDelete,isEffective,great_time,modify_time,img,url,sortNum) " +
                         "VALUES (?id,?type,?title,?value,?isDelete,?isEffective,?great_time,?modify_time,?img,?url,?sortNum)";

            List<MySqlParameter> parameterList = GetMySqlParameterListByModel(model);

            //// 执行操作
            return PKMySqlHelper.ExecuteNonQuery(sql, parameterList.ToArray()) > 0;
        }
        /// <summary>
        /// 新增微信用户
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool AddWXuser(MWXUserInfo model)
        {
            //// sql语句
            string sql = "INSERT INTO wxuser(wxuserid,subscribe,openid,nickname,sex,sexdes,city,country,province,language,headimgurl,subscribe_time,remark,tagid_list,subscribe_scene,subscribe_scene_des,isDelete,isEffective,great_time,modify_time) " +
                         "VALUES (?wxuserid,?subscribe,?openid,?nickname,?sex,?sexdes,?city,?country,?province,?language,?headimgurl,?subscribe_time,?remark,?tagid_list,?subscribe_scene,?subscribe_scene_des,?isDelete,?isEffective,?great_time,?modify_time)";

            List <MySqlParameter> parameterList = GetMySqlParameterListByModel(model);

            //// 执行操作
            return(PKMySqlHelper.ExecuteNonQuery(sql, parameterList.ToArray()) > 0);
        }
Exemplo n.º 7
0
        /// <summary>
        /// 根据ID删除微信才菜单
        /// </summary>
        /// <param name="productid"></param>
        /// <returns></returns>
        public bool DeleteNews(string id)
        {
            string sql = "delete from news where id=?id;";

            List<MySqlParameter> parameterList = new List<MySqlParameter>();
            MySqlParameter parameter = new MySqlParameter("?id", MySqlDbType.VarChar, 25);
            parameter.Value = id;
            parameterList.Add(parameter);

            //// 执行操作
            return PKMySqlHelper.ExecuteNonQuery(sql, parameterList.ToArray()) > 0;
        }
Exemplo n.º 8
0
        /// <summary>
        /// 根据ID删除
        /// </summary>
        /// <param name="productid"></param>
        /// <returns></returns>
        public bool Delete(string id)
        {
            string sql = "update coupon set isDelete=1 where id=?id;";

            List <MySqlParameter> parameterList = new List <MySqlParameter>();
            MySqlParameter        parameter     = new MySqlParameter("?id", MySqlDbType.VarChar, 25);

            parameter.Value = id;
            parameterList.Add(parameter);

            //// 执行操作
            return(PKMySqlHelper.ExecuteNonQuery(sql, parameterList.ToArray()) > 0);
        }
Exemplo n.º 9
0
        /// <summary>
        /// 根据ID删除一个产品信息
        /// </summary>
        /// <param name="productid"></param>
        /// <returns></returns>
        public bool DeleteProduct(string productid)
        {
            string sql = "update  product set isDelete=1 where productid=?productid;delete from shoppingCart where productId=?productid";

            List <MySqlParameter> parameterList = new List <MySqlParameter>();
            MySqlParameter        parameter     = new MySqlParameter("?productid", MySqlDbType.VarChar, 25);

            parameter.Value = productid;
            parameterList.Add(parameter);

            //// 执行操作
            return(PKMySqlHelper.ExecuteNonQuery(sql, parameterList.ToArray()) > 0);
        }
Exemplo n.º 10
0
        /// <summary>
        /// 删除用户信息
        /// </summary>
        /// <param name="adminuserid"></param>
        /// <returns></returns>
        public bool DeleteAdminUser(string adminuserid)
        {
            //// sql语句
            string sql = "delete from adminuser where adminuserid=?adminuserid";

            List <MySqlParameter> parameterList = new List <MySqlParameter>();
            MySqlParameter        parameter     = new MySqlParameter("?adminuserid", MySqlDbType.VarChar, 25);

            parameter.Value = adminuserid;
            parameterList.Add(parameter);

            //// 执行操作
            return(PKMySqlHelper.ExecuteNonQuery(sql, parameterList.ToArray()) > 0);
        }
Exemplo n.º 11
0
        /// <summary>
        /// 新增管理员
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool AddAdminUser(Madminuser model)
        {
            //// sql语句
            string sql = "INSERT INTO adminuser (adminuserid,account,name,password,sex,isDelete,isEffective,great_time,modify_time) " +
                         "VALUES(?adminuserid, ?account, ?name, ?password, ?sex, ?isDelete, ?isEffective, ?great_time, ?modify_time)";

            List <MySqlParameter> parameterList = new List <MySqlParameter>();
            MySqlParameter        parameter     = new MySqlParameter("?adminuserid", MySqlDbType.VarChar, 25);

            parameter.Value = model.adminuserid;
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?account", MySqlDbType.VarChar, 50);
            parameter.Value = model.account;
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?name", MySqlDbType.VarChar, 50);
            parameter.Value = model.name;
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?password", MySqlDbType.VarChar, 50);
            parameter.Value = model.password;
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?sex", MySqlDbType.Int16, 1);
            parameter.Value = model.sex;
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?isDelete", MySqlDbType.Int16, 1);
            parameter.Value = model.isDelete;
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?isEffective", MySqlDbType.Int16, 1);
            parameter.Value = model.isEffective;
            parameterList.Add(parameter);

            DateTime dateTime = System.DateTime.Now;

            parameter       = new MySqlParameter("?great_time", MySqlDbType.DateTime);
            parameter.Value = dateTime;
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?modify_time", MySqlDbType.DateTime);
            parameter.Value = dateTime;
            parameterList.Add(parameter);

            //// 执行操作
            return(PKMySqlHelper.ExecuteNonQuery(sql, parameterList.ToArray()) > 0);
        }
Exemplo n.º 12
0
        /// <summary>
        /// 根据id删除购物车信息
        /// </summary>
        /// <param name="shoppingCartId"></param>
        /// <returns></returns>
        public bool DeleteShoppingCartById(string[] shoppingCartId, string userId)
        {
            string sql = "delete from shoppingCart where shoppingCartId in ?shoppingCartId and userId=?userId;";
            List <MySqlParameter> parameterList = new List <MySqlParameter>();
            MySqlParameter        parameter     = new MySqlParameter("?shoppingCartId", MySqlDbType.VarChar, 25);

            parameter.Value = "'" + string.Join("','", shoppingCartId) + "'";
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?userId", MySqlDbType.VarChar, 25);
            parameter.Value = userId;
            parameterList.Add(parameter);

            //// 执行操作
            return(PKMySqlHelper.ExecuteNonQuery(sql, parameterList.ToArray()) > 0);
        }
Exemplo n.º 13
0
        /// <summary>
        /// 更新商品的是否推荐
        /// </summary>
        /// <param name="productid"></param>
        /// <param name="recommend"></param>
        /// <returns></returns>
        public bool UpdateProductRecommend(string productid, int recommend)
        {
            string sql = "update  product set recommend=?recommend where productid=?productid;";
            List <MySqlParameter> parameterList = new List <MySqlParameter>();
            MySqlParameter        parameter     = new MySqlParameter("?recommend", MySqlDbType.Int32);

            parameter.Value = recommend;
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?productid", MySqlDbType.VarChar, 25);
            parameter.Value = productid;
            parameterList.Add(parameter);

            //// 执行操作
            return(PKMySqlHelper.ExecuteNonQuery(sql, parameterList.ToArray()) > 0);
        }
        /// <summary>
        /// 删除邮寄地址
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="addressId"></param>
        /// <returns></returns>
        public bool DeleteMailAddress(string userId, string addressId)
        {
            string sql = "delete mailAddress set where userId=?userId and addressId=?addressId; ";

            List <MySqlParameter> parameterList = new List <MySqlParameter>();
            MySqlParameter        parameter     = new MySqlParameter("?userId", MySqlDbType.VarChar, 25);

            parameter.Value = userId;
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?addressId", MySqlDbType.VarChar, 25);
            parameter.Value = addressId;
            parameterList.Add(parameter);

            //// 执行操作
            return(PKMySqlHelper.ExecuteNonQuery(sql, parameterList.ToArray()) > 0);
        }
Exemplo n.º 15
0
        /// <summary>
        /// 删除商品分类
        /// </summary>
        /// <param name="classid"></param>
        /// <returns></returns>
        public bool DeleteProductclass(int classid, int supclassid)
        {
            ///// 实现步骤
            //// 1、首先根据classid到产品表中查询是否有数据
            //// 2、如果查询到数据,那么不允许删除
            //// 3、如果没查询到数据,那么直接删除其第一的类以及其子类

            //// 说明删除主分类
            int hasThisClassProductNum = 0;

            if (supclassid == 0)
            {
                hasThisClassProductNum = new ProductDal().CetProductBySupClassid(supclassid);
            }
            else
            {
                hasThisClassProductNum = new ProductDal().CetProductByClassid(classid);
            }

            if (hasThisClassProductNum > 0)
            {
                return(false);
            }

            //// sql语句
            string sql = string.Empty;

            if (supclassid == 0)
            {
                //// sql语句 删除其本身子分类
                sql = "delete from productclass where supclassid=?classid or classid=?classid";
            }
            else
            {
                //// 删除自己
                sql = "delete from productclass where classid=?classid";
            }

            MySqlParameter[] parameterList = new MySqlParameter[1];
            parameterList[0]       = new MySqlParameter("?classid", MySqlDbType.Int32);
            parameterList[0].Value = classid;

            //// 执行操作
            return(PKMySqlHelper.ExecuteNonQuery(sql, parameterList) > 0);
        }
Exemplo n.º 16
0
        /// <summary>
        /// 新增产品类别
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool AddProductclass(Mproductclass model)
        {
            //// sql语句
            string sql = "INSERT INTO productclass(supclassid,classname,priority,isDelete,isEffective,great_time,modify_time,imgpath) " +
                         "VALUES (?supclassid,?classname,?priority,?isDelete,?isEffective,?great_time,?modify_time,?imgpath)";

            List <MySqlParameter> parameterList = new List <MySqlParameter>();
            MySqlParameter        parameter     = new MySqlParameter("?supclassid", MySqlDbType.Int32);

            parameter.Value = model.supclassid;
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?classname", MySqlDbType.VarChar, 50);
            parameter.Value = model.classname;
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?priority", MySqlDbType.Int32);
            parameter.Value = model.priority;
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?isDelete", MySqlDbType.Int16, 1);
            parameter.Value = model.isDelete;
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?isEffective", MySqlDbType.Int16, 1);
            parameter.Value = model.isEffective;
            parameterList.Add(parameter);

            DateTime dateTime = System.DateTime.Now;

            parameter       = new MySqlParameter("?great_time", MySqlDbType.DateTime);
            parameter.Value = dateTime;
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?modify_time", MySqlDbType.DateTime);
            parameter.Value = dateTime;
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?imgpath", MySqlDbType.VarChar, 255);
            parameter.Value = model.imgpath;
            parameterList.Add(parameter);

            //// 执行操作
            return(PKMySqlHelper.ExecuteNonQuery(sql, parameterList.ToArray()) > 0);
        }
        /// <summary>
        /// 新增管理员
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool AddSndGoodsUser(MsendGoodsUser model)
        {
            //// sql语句
            string sql = "INSERT INTO sendGoodsUser (id,userName,sex,phone,isDelete,isEffective,great_time,modify_time) " +
                         "VALUES(?id, ?userName,?sex, ?phone,  ?isDelete, ?isEffective, ?great_time, ?modify_time)";

            List <MySqlParameter> parameterList = new List <MySqlParameter>();
            MySqlParameter        parameter     = new MySqlParameter("?id", MySqlDbType.VarChar, 25);

            parameter.Value = model.id;
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?userName", MySqlDbType.VarChar, 500);
            parameter.Value = Base64.EncodeBase64(model.userName);
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?phone", MySqlDbType.VarChar, 50);
            parameter.Value = model.phone;
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?sex", MySqlDbType.Int16, 1);
            parameter.Value = model.sex;
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?isDelete", MySqlDbType.Int16, 1);
            parameter.Value = model.isDelete;
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?isEffective", MySqlDbType.Int16, 1);
            parameter.Value = model.isEffective;
            parameterList.Add(parameter);

            DateTime dateTime = System.DateTime.Now;

            parameter       = new MySqlParameter("?great_time", MySqlDbType.DateTime);
            parameter.Value = dateTime;
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?modify_time", MySqlDbType.DateTime);
            parameter.Value = dateTime;
            parameterList.Add(parameter);

            //// 执行操作
            return(PKMySqlHelper.ExecuteNonQuery(sql, parameterList.ToArray()) > 0);
        }
Exemplo n.º 18
0
        /// <summary>
        /// 修改密码
        /// </summary>
        /// <param name="adminuserid"></param>
        /// <param name="newPass"></param>
        /// <returns></returns>
        public bool ChangAdminUserPass(string adminuserid, string newPass)
        {
            //// sql语句
            string sql = "update adminuser  set password = ?password where adminuserid = ?adminuserid";

            List <MySqlParameter> parameterList = new List <MySqlParameter>();
            MySqlParameter        parameter     = new MySqlParameter("?password", MySqlDbType.VarChar, 50);

            parameter.Value = newPass;
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?adminuserid", MySqlDbType.VarChar, 25);
            parameter.Value = adminuserid;
            parameterList.Add(parameter);

            //// 执行操作
            return(PKMySqlHelper.ExecuteNonQuery(sql, parameterList.ToArray()) > 0);
        }
        /// <summary>
        /// 根据id获取openId更新用户信息
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool UpdateWXUserInfo(MWXUserInfo model)
        {
            string sql = "update wxuser set subscribe=?subscribe,nickname=?nickname,sex=?sex,sexdes=?sexdes,city=?city,country=?country,province=?province,language=?language,headimgurl=?headimgurl,tagid_list=?tagid_list,subscribe_scene=?subscribe_scene,subscribe_scene_des=?subscribe_scene_des,qr_scene_str=?qr_scene_str,qr_scene=?qr_scene where 1=1 ";

            if (!string.IsNullOrEmpty(model.wxuserid))
            {
                sql = sql + " and wxuserid=?wxuserid";
            }

            if (!string.IsNullOrEmpty(model.openid))
            {
                sql = sql + " and openid=?openid";
            }

            List <MySqlParameter> parameterList = GetMySqlParameterListByModel(model);

            return(PKMySqlHelper.ExecuteNonQuery(sql, parameterList.ToArray()) > 0);
        }
        /// <summary>
        /// 更新用户的默认地址
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="addressId"></param>
        /// <returns></returns>
        public bool UpdateMailAddressDefault(string userId, string addressId)
        {
            //// 首先清空默认地址,然后在将需要设置的默认地址数据设置为默认地址

            string sql = "update mailAddress set isDefault=0 where userId=?userId;update mailAddress set isDefault=1 where userId=?userId and addressId=?addressId; ";

            List <MySqlParameter> parameterList = new List <MySqlParameter>();
            MySqlParameter        parameter     = new MySqlParameter("?userId", MySqlDbType.VarChar, 25);

            parameter.Value = userId;
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?addressId", MySqlDbType.VarChar, 25);
            parameter.Value = addressId;
            parameterList.Add(parameter);

            //// 执行操作
            return(PKMySqlHelper.ExecuteNonQuery(sql, parameterList.ToArray()) > 0);
        }
Exemplo n.º 21
0
        /// <summary>
        /// 根据id更新新闻信息
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool UpdateNews(Mnews model)
        {
            string sql = "update news set title=?title,value=?value where id=?id ";

            List<MySqlParameter> parameterList = new List<MySqlParameter>();
            MySqlParameter parameter = new MySqlParameter("?id", MySqlDbType.VarChar, 25);
            parameter.Value = model.id;
            parameterList.Add(parameter);

            parameter = new MySqlParameter("?title", MySqlDbType.VarChar, 100);
            parameter.Value = model.title;
            parameterList.Add(parameter);

            parameter = new MySqlParameter("?value", MySqlDbType.Text);
            parameter.Value = model.value;
            parameterList.Add(parameter);

            return PKMySqlHelper.ExecuteNonQuery(sql, parameterList.ToArray()) > 0;
        }
Exemplo n.º 22
0
        /// <summary>
        /// 编辑产品类别
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool EditProductclass(Mproductclass model)
        {
            //// sql语句
            string sql = "update  productclass set supclassid=?supclassid, classname=?classname,priority=?priority ,modify_time=?modify_time";

            if (!string.IsNullOrEmpty(model.imgpath))
            {
                sql = sql + ",imgpath=?imgpath ";
            }

            sql = sql + " where classid=?classid;";

            List <MySqlParameter> parameterList = new List <MySqlParameter>();
            MySqlParameter        parameter     = new MySqlParameter("?classid", MySqlDbType.Int32);

            parameter.Value = model.classid;
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?supclassid", MySqlDbType.Int32);
            parameter.Value = model.supclassid;
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?classname", MySqlDbType.VarChar, 50);
            parameter.Value = model.classname;
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?priority", MySqlDbType.Int32);
            parameter.Value = model.priority;
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?modify_time", MySqlDbType.DateTime);
            parameter.Value = System.DateTime.Now;
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?imgpath", MySqlDbType.VarChar, 255);
            parameter.Value = model.imgpath;
            parameterList.Add(parameter);

            //// 执行操作
            return(PKMySqlHelper.ExecuteNonQuery(sql, parameterList.ToArray()) > 0);
        }
Exemplo n.º 23
0
        /// <summary>
        /// 更新购物车产品的价格等相关信息
        /// </summary>
        /// <param name="shoppingCartId"></param>
        /// <param name="origPrice"></param>
        /// <param name="sellPrice"></param>
        /// <param name="totalPrice"></param>
        /// <param name="buyNum"></param>
        /// <returns></returns>
        public bool UpdatePriceAndNum(string shoppingCartId, string userId, decimal origPrice, decimal sellPrice, decimal totalPrice, int buyNum)
        {
            string sql = "update shoppingCart set origPrice=?origPrice,  sellPrice=?sellPrice,  totalPrice=?totalPrice ";

            if (buyNum != 0)
            {
                sql = sql + ",buyNum=buyNum+?buyNum ";
            }

            sql = sql + " where shoppingCartId=?shoppingCartId and userId=?userId;";

            List <MySqlParameter> parameterList = new List <MySqlParameter>();
            MySqlParameter        parameter     = new MySqlParameter("?shoppingCartId", MySqlDbType.VarChar, 25);

            parameter.Value = shoppingCartId;
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?userId", MySqlDbType.VarChar, 25);
            parameter.Value = userId;
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?buyNum", MySqlDbType.Int32);
            parameter.Value = buyNum;
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?origPrice", MySqlDbType.Decimal);
            parameter.Value = origPrice;
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?sellPrice", MySqlDbType.Decimal);
            parameter.Value = sellPrice;
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?totalPrice", MySqlDbType.Decimal);
            parameter.Value = totalPrice;
            parameterList.Add(parameter);

            //// 执行操作
            return(PKMySqlHelper.ExecuteNonQuery(sql, parameterList.ToArray()) > 0);
        }
Exemplo n.º 24
0
        /// <summary>
        /// 修改用户信息
        /// </summary>
        /// <param name="model">model</param>
        /// <returns></returns>
        public bool ChangAdminUserInfor(Madminuser model)
        {
            //// sql语句
            string sql = "update adminuser  set name = ?name,sex=?sex where adminuserid = ?adminuserid";

            List <MySqlParameter> parameterList = new List <MySqlParameter>();
            MySqlParameter        parameter     = new MySqlParameter("?name", MySqlDbType.VarChar, 50);

            parameter.Value = model.name;
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?sex", MySqlDbType.Int16, 1);
            parameter.Value = model.sex;
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?adminuserid", MySqlDbType.VarChar, 25);
            parameter.Value = model.adminuserid;
            parameterList.Add(parameter);

            //// 执行操作
            return(PKMySqlHelper.ExecuteNonQuery(sql, parameterList.ToArray()) > 0);
        }
        /// <summary>
        /// 更新菜单信息
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool UpdateWxmenu(Mwxmenu model)
        {
            string sql = "update  wxmenu set menuName=?menuName,url=?url,sortNum=?sortNum where id=?id;";
            List <MySqlParameter> parameterList = new List <MySqlParameter>();

            MySqlParameter parameter = new MySqlParameter("?id", MySqlDbType.VarChar, 25);

            parameter.Value = model.id;
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?sortNum", MySqlDbType.VarChar, 25);
            parameter.Value = model.sortNum;
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?menuName", MySqlDbType.VarChar, 50);
            parameter.Value = model.menuName;
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?url", MySqlDbType.VarChar, 1000);
            parameter.Value = model.url;
            parameterList.Add(parameter);
            //// 执行操作
            return(PKMySqlHelper.ExecuteNonQuery(sql, parameterList.ToArray()) > 0);
        }
Exemplo n.º 26
0
        /// <summary>
        /// 新增产品类别
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool AddProduct(Mproduct model)
        {
            //// sql语句

            string sql = "INSERT INTO product(productid,classid,supclassid,className,supclassName,productname,productformat,productformatunit,origprice,sellprice,stock,shelfstate,hassellnum,productdetails,productimgurl,priority,isDelete,isEffective,great_time,modify_time,recommend) " +
                         "VALUES (?productid,?classid,?supclassid,(select classname from productclass where classid=?classid),(select classname from productclass where classid=?supclassid),?productname,?productformat,?productformatunit,?origprice,?sellprice,?stock,?shelfstate,?hassellnum,?productdetails,?productimgurl,?priority,?isDelete,?isEffective,?great_time,?modify_time,recommend)";

            List <MySqlParameter> parameterList = new List <MySqlParameter>();
            MySqlParameter        parameter     = new MySqlParameter("?productid", MySqlDbType.VarChar, 25);

            parameter.Value = model.productid;
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?classid", MySqlDbType.Int32);
            parameter.Value = model.classid;
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?supclassid", MySqlDbType.Int32);
            parameter.Value = model.supclassid;
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?productname", MySqlDbType.VarChar, 100);
            parameter.Value = model.productname;
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?productformat", MySqlDbType.VarChar, 20);
            parameter.Value = model.productformat;
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?productformatunit", MySqlDbType.VarChar, 50);
            parameter.Value = model.productformatunit;
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?origprice", MySqlDbType.Decimal);
            parameter.Value = model.origprice;
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?sellprice", MySqlDbType.Decimal);
            parameter.Value = model.sellprice;
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?stock", MySqlDbType.Int32);
            parameter.Value = model.stock;
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?shelfstate", MySqlDbType.Int32);
            parameter.Value = model.shelfstate;
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?hassellnum", MySqlDbType.Int32);
            parameter.Value = 0;
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?productdetails", MySqlDbType.Text);
            parameter.Value = model.productdetails;
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?productimgurl", MySqlDbType.VarChar, 100);
            parameter.Value = model.productimgurl;
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?priority", MySqlDbType.Int32);
            parameter.Value = model.priority;
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?isDelete", MySqlDbType.Int32);
            parameter.Value = 0;
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?isEffective", MySqlDbType.Int32);
            parameter.Value = 1;
            parameterList.Add(parameter);

            DateTime dateTime = System.DateTime.Now;

            parameter       = new MySqlParameter("?great_time", MySqlDbType.DateTime);
            parameter.Value = dateTime;
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?modify_time", MySqlDbType.DateTime);
            parameter.Value = dateTime;
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?recommend", MySqlDbType.Int32);
            parameter.Value = model.recommend;
            parameterList.Add(parameter);

            //// 执行操作
            return(PKMySqlHelper.ExecuteNonQuery(sql, parameterList.ToArray()) > 0);
        }
Exemplo n.º 27
0
        /// <summary>
        /// 根据产品的价格、库存信息
        /// </summary>
        /// <param name="productid"></param>
        /// <param name="origprice"></param>
        /// <param name="sellprice"></param>
        /// <param name="stock"></param>
        /// <returns></returns>
        public bool UpdateProdctPrice(string productid, decimal origprice, decimal sellprice, int stock, int priority, Mproduct mproduct)
        {
            string sql = "update  product set ";

            if (origprice > 0)
            {
                sql = sql + "  origprice = ?origprice,";
            }

            if (sellprice > 0)
            {
                sql = sql + "  sellprice = ?sellprice,";
            }

            if (stock >= 0)
            {
                sql = sql + "  stock = ?stock,";
            }

            if (priority > 0)
            {
                sql = sql + "  priority = ?priority,";
            }

            if (!string.IsNullOrEmpty(mproduct.productimgurl))
            {
                sql = sql + "  productimgurl = ?productimgurl,";
            }

            if (mproduct.supclassid > 0)
            {
                sql = sql + "  supclassid = " + mproduct.supclassid + ",";
                sql = sql + "  supclassName = (select classname from productclass where classid=" + mproduct.supclassid + "),";
            }

            if (mproduct.classid > 0)
            {
                sql = sql + "  classid = " + mproduct.classid + ",";
                sql = sql + "  className = (select classname from productclass where classid=" + mproduct.classid + "),";
            }

            if (!string.IsNullOrEmpty(mproduct.productname))
            {
                sql = sql + "  productname = ?productname,";
            }


            sql = sql + "  productformat = ?productformat,";
            sql = sql + "  productformatunit = ?productformatunit,";
            sql = sql + "  origprice = ?origprice,";
            sql = sql + "  sellprice = ?sellprice,";
            sql = sql + "  stock = ?stock,";

            sql = sql + "  shelfstate = ?shelfstate,";
            sql = sql + "  priority = ?priority,";
            sql = sql + "  productdetails = ?productdetails,";


            sql = sql.TrimEnd(',') + " where productid=?productid;";


            List <MySqlParameter> parameterList = new List <MySqlParameter>();
            MySqlParameter        parameter     = new MySqlParameter("?productid", MySqlDbType.VarChar, 25);

            parameter.Value = productid;
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?origprice", MySqlDbType.Decimal);
            parameter.Value = origprice;
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?sellprice", MySqlDbType.Decimal);
            parameter.Value = sellprice;
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?stock", MySqlDbType.Int32);
            parameter.Value = stock;
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?productformat", MySqlDbType.VarChar, 20);
            parameter.Value = mproduct.productformat;
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?productformatunit", MySqlDbType.VarChar, 50);
            parameter.Value = mproduct.productformatunit;
            parameterList.Add(parameter);


            parameter       = new MySqlParameter("?shelfstate", MySqlDbType.Int32);
            parameter.Value = mproduct.shelfstate;
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?productdetails", MySqlDbType.Text);
            parameter.Value = mproduct.productdetails;
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?productimgurl", MySqlDbType.VarChar, 100);
            parameter.Value = mproduct.productimgurl;
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?priority", MySqlDbType.Int32);
            parameter.Value = mproduct.priority;
            parameterList.Add(parameter);


            parameter       = new MySqlParameter("?productname", MySqlDbType.VarChar, 100);
            parameter.Value = mproduct.productname;
            parameterList.Add(parameter);


            //// 执行操作
            return(PKMySqlHelper.ExecuteNonQuery(sql, parameterList.ToArray()) > 0);
        }
Exemplo n.º 28
0
        /// <summary>
        /// 使用优惠券
        /// </summary>
        /// <param name="id"></param>
        /// <param name="orderId"></param>
        /// <returns></returns>
        public int UseCoupon(string id, string orderId)
        {
            string sql = $"update usercoupon set isUse=1,orderId='{orderId}',useTime='{System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}',modify_time='{System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}' where id='{id}'";

            return(PKMySqlHelper.ExecuteNonQuery(sql));
        }
        /// <summary>
        /// 新增地址
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool AddMailAddress(MmailAddress model)
        {
            //// sql语句
            string sql = "";

            if (model.isDefault == "1")
            {
                sql = "update mailAddress set isDefault=0 where userId=?userId;";
            }
            sql += "INSERT INTO mailAddress (addressId,userId,userName,province,city,area,detailedAddress,contactName,contactTell,isDefault,isDelete,isEffective,great_time,modify_time) " +
                   "VALUES(?addressId,?userId,?userName,?province,?city,?area,?detailedAddress,?contactName,?contactTell,?isDefault,?isDelete,?isEffective,?great_time,?modify_time)";

            List <MySqlParameter> parameterList = new List <MySqlParameter>();
            MySqlParameter        parameter     = new MySqlParameter("?addressId", MySqlDbType.VarChar, 25);

            parameter.Value = model.addressId;
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?userId", MySqlDbType.VarChar, 25);
            parameter.Value = model.userId;
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?userName", MySqlDbType.VarChar, 500);
            parameter.Value = Base64.EncodeBase64(model.userName);
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?province", MySqlDbType.VarChar, 30);
            parameter.Value = string.IsNullOrEmpty(model.province)?"": model.province;
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?city", MySqlDbType.VarChar, 30);
            parameter.Value = string.IsNullOrEmpty(model.city) ? "" : model.city;
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?area", MySqlDbType.VarChar, 30);
            parameter.Value = string.IsNullOrEmpty(model.area) ? "" : model.area;
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?detailedAddress", MySqlDbType.VarChar, 200);
            parameter.Value = model.detailedAddress;
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?contactName", MySqlDbType.VarChar, 30);
            parameter.Value = model.contactName;
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?contactTell", MySqlDbType.VarChar, 20);
            parameter.Value = model.contactTell;
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?isDefault", MySqlDbType.Int16, 1);
            parameter.Value = model.isDefault;
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?isDelete", MySqlDbType.Int16, 1);
            parameter.Value = 0;
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?isEffective", MySqlDbType.Int16, 1);
            parameter.Value = 1;
            parameterList.Add(parameter);

            DateTime dateTime = System.DateTime.Now;

            parameter       = new MySqlParameter("?great_time", MySqlDbType.DateTime);
            parameter.Value = dateTime;
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?modify_time", MySqlDbType.DateTime);
            parameter.Value = dateTime;
            parameterList.Add(parameter);

            //// 执行操作
            return(PKMySqlHelper.ExecuteNonQuery(sql, parameterList.ToArray()) > 0);
        }
Exemplo n.º 30
0
        /// <summary>
        /// 新增订单
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool Add(MshoppingCart model)
        {
            //// sql语句
            string sql = "INSERT INTO shoppingCart (shoppingCartId,userId,userName,productId,productname,productformat,buyNum,origPrice,sellPrice,totalPrice,isDelete,isEffective,great_time,modify_time) " +
                         "VALUES(?shoppingCartId, ?userId, ?userName, ?productId, ?productname, ?productformat, ?buyNum, ?origPrice, ?sellPrice, ?totalPrice, ?isDelete, ?isEffective, ?great_time, ?modify_time)";

            List <MySqlParameter> parameterList = new List <MySqlParameter>();
            MySqlParameter        parameter     = new MySqlParameter("?shoppingCartId", MySqlDbType.VarChar, 25);

            parameter.Value = model.shoppingCartId;
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?userId", MySqlDbType.VarChar, 25);
            parameter.Value = model.userId;
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?userName", MySqlDbType.VarChar, 500);
            parameter.Value = Base64.EncodeBase64(model.userName);
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?productId", MySqlDbType.VarChar, 25);
            parameter.Value = model.productId;
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?productname", MySqlDbType.VarChar, 100);
            parameter.Value = model.productname;
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?productformat", MySqlDbType.VarChar, 50);
            parameter.Value = model.productformat;
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?buyNum", MySqlDbType.Int32);
            parameter.Value = model.buyNum;
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?origPrice", MySqlDbType.Decimal);
            parameter.Value = model.origPrice;
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?sellPrice", MySqlDbType.Decimal);
            parameter.Value = model.sellPrice;
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?totalPrice", MySqlDbType.Decimal);
            parameter.Value = model.totalPrice;
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?isDelete", MySqlDbType.Int16, 1);
            parameter.Value = 0;
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?isEffective", MySqlDbType.Int16, 1);
            parameter.Value = 1;
            parameterList.Add(parameter);

            DateTime dateTime = System.DateTime.Now;

            parameter       = new MySqlParameter("?great_time", MySqlDbType.DateTime);
            parameter.Value = dateTime;
            parameterList.Add(parameter);

            parameter       = new MySqlParameter("?modify_time", MySqlDbType.DateTime);
            parameter.Value = dateTime;
            parameterList.Add(parameter);

            //// 执行操作
            return(PKMySqlHelper.ExecuteNonQuery(sql, parameterList.ToArray()) > 0);
        }