Exemplo n.º 1
0
        /// <summary>
        /// In stock a new product
        /// </summary>
        /// <param name="product"></param>
        /// <param name="price"></param>
        /// <param name="amount"></param>
        /// <param name="remark"></param>
        /// <returns>入库成功,返回true,否则返回false</returns>
        public static bool InStockProduct(ProductItem product, decimal price, int amount, string remark)
        {
            using (SolemartDBContext context = new SolemartDBContext())
            {
                /* 在增加新产品的时候,先不增加库存数量,设置该库存为0,后面入库操作再填写库存数量 */
                ProductItem existProduct = context.ProductItems.Find(product.ProductID);
                if (existProduct == null)
                {
                    //the count of product's stock is the amount for the first time in stock.
                    product.StockCount = amount;
                    context.ProductItems.Add(product);
                }
                else
                {
                    existProduct.StockCount += amount;
                }

                InStockItem stockItem = new InStockItem {
                    ProductID = product.ProductID, Price = price, Amount = amount, InStockTime = DateTime.Now, Remark = remark
                };
                context.InStockItems.Add(stockItem);
                if (context.SaveChanges() > 0)
                {
                    if (allSaledProducts != null)
                    {
                        allSaledProducts.Clear();
                    }
                    return(true);
                }
                return(false);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Set the logo image for product.
        /// </summary>
        /// <param name="productID"></param>
        /// <param name="imageID"></param>
        /// <returns></returns>
        public static bool SetProductLogImage(int productID, int imageID)
        {
            using (SolemartDBContext context = new SolemartDBContext())
            {
                ProductImageItem imageItem = context.ProductImageItems.FirstOrDefault(p => (p.ProductID == productID && p.ImageID == imageID));

                ProductImageItem logoImageItem = context.ProductImageItems.FirstOrDefault(p => (p.ProductID == productID && p.ForLogo));
                //如果已经是LOGO的图片
                if (imageItem != null && imageItem.ForLogo)
                {
                    return(true);
                }

                //设置的图片不是原来的LOGO图片
                if (imageItem != null)
                {
                    imageItem.ForLogo = true;
                    if (logoImageItem != null)
                    {
                        logoImageItem.ForLogo = false;
                    }

                    if (context.SaveChanges() > 0)
                    {
                        if (allProductLogoImages != null)
                        {
                            allProductLogoImages.Clear();
                        }
                        return(true);
                    }
                }

                return(false);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// The user confirm the order
        /// </summary>
        /// <param name="orderID">要确认的订单ID</param>
        /// <returns>用户的确认结果</returns>
        public static bool ConfirmOrder(int orderID)
        {
            using (SolemartDBContext context = new SolemartDBContext())
            {
                OrderItem order = context.OrderItems.Find(orderID);
                if (order == null || order.Status != OrderStatus.Sending)
                {
                    return(false);
                }
                order.Status = OrderStatus.Received;
                order.HasPay = true;

                //             SELECT ProductID, SUM(Amount) FROM OrderDetailItems
                //WHERE OrderID IN (SELECT OrderID FROM OrderItems WHERE STATUS=3)
                //GROUP BY ProductID
                var q = from o in context.OrderDetailItems
                        where o.OrderID == orderID
                        select o;

                List <OrderDetailItem> itemList = q.ToList();
                foreach (var item in itemList)
                {
                    ProductItem product = context.ProductItems.Find(item.ProductID);
                    product.StockCount -= item.Amount;
                    if (product.ReserveCount > item.Amount)
                    {
                        product.ReserveCount -= item.Amount;
                    }
                }

                return(context.SaveChanges() > 0);
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Put on the product for saling.
        /// </summary>
        /// <param name="newSaledProductItem">The product put to saling.</param>
        /// <returns>return true if success, or return false</returns>
        public static bool PutToSaling(SaledProductItem newSaledProductItem)
        {
            using (SolemartDBContext context = new SolemartDBContext())
            {
                SaledProductItem oldSaledProductItem = context.SaledProductItems.FirstOrDefault(spi => (spi.ProductID == newSaledProductItem.ProductID));
                if (oldSaledProductItem != null)
                {
                    oldSaledProductItem.Price       = newSaledProductItem.Price;
                    oldSaledProductItem.Discount    = newSaledProductItem.Discount;
                    oldSaledProductItem.SpecialFlag = newSaledProductItem.SpecialFlag;
                }
                else
                {
                    context.SaledProductItems.Add(newSaledProductItem);
                }

                if (context.SaveChanges() > 0)
                {
                    if (allSaledProducts != null)
                    {
                        allSaledProducts.Clear();
                    }
                    return(true);
                }

                return(false);
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// Add a new user from weixin client.
        /// </summary>
        /// <returns>成功注册返回新注册的用户对象,否则返回null</returns>
        public static UserItem AddWeixinUser(string openID)
        {
            string username = GenerateRandomUserName();

            using (SolemartDBContext context = new SolemartDBContext())
            {
                while (context.UserItems.FirstOrDefault(u => u.UserName == username) != null)
                {
                    username = GenerateRandomUserName();
                }

                int userid = context.RegisterNewWeixinUser(username, DateTime.Now);
                if (userid > 0)
                {
                    context.UserAppendInfoItems.Add(new UserAppendInfoItem {
                        UserID = userid, BirthDay = new DateTime(1970, 1, 1), Address = "", Phone = "", Sex = SystemUtil.Sex.Unknown
                    });
                    context.SaveChanges();
                    return(new UserItem {
                        UserID = userid, UserName = username, Roles = Role.NormalUser.ToString(), LoginType = LoginType.Weixin
                    });
                }

                return(null);
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// Add new category
        /// </summary>
        /// <param name="newCategory">The category want to add</param>
        /// <returns>Return true if success, or return false</returns>
        public Result <string> AddNewCategory(CategoryItem newCategory)
        {
            using (SolemartDBContext context = new SolemartDBContext())
            {
                //Not allow the same name of the same parent category.
                if (context.CategoryItems.FirstOrDefault(c => (c.CategoryName == newCategory.CategoryName && c.ParentCategoryID == newCategory.ParentCategoryID)) != null)
                {
                    return(Result <string> .DuplicatedField);
                }

                context.CategoryItems.Add(newCategory);
                if (context.SaveChanges() <= 0)
                {
                    return(Result <string> .NormalErrorResult);
                }

                if (newCategory.ParentCategoryID != null)
                {
                    CategoryItem parentCategory = GetCategoryInList(categoryList, newCategory.ParentCategoryID);
                    if (parentCategory.SubCategories == null)
                    {
                        parentCategory.SubCategories = new List <CategoryItem>();
                    }

                    parentCategory.SubCategories.Add(newCategory);
                }
                else
                {
                    categoryList.Add(newCategory);
                }

                return(Result <string> .SuccessResult);
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// The user take off the point.(for return the goods)
        /// </summary>
        /// <param name="pointAmount"></param>
        /// <returns></returns>
        public bool TakeOffPoint(int pointAmount)
        {
            using (SolemartDBContext context = new SolemartDBContext())
            {
                UserAppendInfoItem tempUserItem = context.UserAppendInfoItems.FirstOrDefault(u => u.UserID == userItem.UserID);
                if (tempUserItem != null && tempUserItem.PointAmount >= pointAmount)
                {
                    tempUserItem.PointAmount -= pointAmount;
                }

                //记录积分的变更
                context.UserPointITems.Add(new UserPointItem {
                    UserID = UserID, PointAmount = -pointAmount, PointType = PointType.ReturnGoods, TransTime = DateTime.Now, Remark = ""
                });
                if (context.SaveChanges() > 0)
                {
                    if (userItem.AppendInfo != null)
                    {
                        userItem.AppendInfo.PointAmount -= pointAmount;
                    }
                    return(true);
                }

                return(false);
            }
        }
Exemplo n.º 8
0
 /// <summary>
 /// Publish a new bulletin
 /// </summary>
 /// <param name="bulletin">The bulletin information</param>
 /// <returns></returns>
 public static bool CreateNewBulletin(BulletinItem bulletin)
 {
     using (SolemartDBContext context = new SolemartDBContext())
     {
         bulletin.PublishTime = DateTime.Now;
         context.BulletinItems.Add(bulletin);
         return(context.SaveChanges() > 0);
     }
 }
Exemplo n.º 9
0
        /// <summary>
        /// Add new brand info
        /// </summary>
        /// <param name="newBrand">品牌的名称</param>
        /// <returns>新创建的品牌信息对象</returns>
        public static BrandItem AddNewBrand(BrandItem newBrand)
        {
            using (SolemartDBContext context = new SolemartDBContext())
            {
                context.BrandItems.Add(newBrand);
                if (context.SaveChanges() > 0)
                {
                    return(newBrand);
                }

                return(null);
            }
        }
Exemplo n.º 10
0
 /// <summary>
 /// Add a new vendor item
 /// </summary>
 /// <param name="vendor">供应商名称</param>
 /// <returns>成功添加一个供应商,返回true,否则返回false</returns>
 public static bool AddNewVendor(VendorItem vendor)
 {
     using (SolemartDBContext context = new SolemartDBContext())
     {
         VendorItem oldVendor = context.VendorItems.FirstOrDefault(v => v.VendorName == vendor.VendorName);
         if (oldVendor != null)
         {
             return(false);
         }
         context.VendorItems.Add(vendor);
         return(context.SaveChanges() > 0);
     }
 }
Exemplo n.º 11
0
        /// <summary>
        /// Delete a vendor item
        /// </summary>
        /// <param name="vendorID">要删除的供应商ID</param>
        /// <returns>是否删除成功</returns>
        public static bool DeleteVendor(int vendorID)
        {
            using (SolemartDBContext context = new SolemartDBContext())
            {
                VendorItem vendor = context.VendorItems.Find(vendorID);
                if (vendor != null)
                {
                    context.VendorItems.Remove(vendor);
                    return(context.SaveChanges() > 0);
                }

                return(false);
            }
        }
Exemplo n.º 12
0
        /// <summary>
        /// The user publish a advise
        /// </summary>
        /// <param name="userID">发表建议的用户ID</param>
        /// <param name="content">建议的内容</param>
        /// <returns>是否成功发表</returns>
        public static bool NewAdvise(int userID, string content)
        {
            using (SolemartDBContext context = new SolemartDBContext())
            {
                AdviserItem advise = new AdviserItem();
                advise.UserID     = userID;
                advise.Content    = content;
                advise.AdviseTime = DateTime.Now;
                advise.IsViewed   = false;
                context.AdviserItems.Add(advise);

                return(context.SaveChanges() > 0);
            }
        }
Exemplo n.º 13
0
 /// <summary>
 /// Sending the order
 /// </summary>
 /// <param name="orderID">要发货的订单的订单号</param>
 /// <returns>是否发货成功</returns>
 public static bool SendOrder(int orderID)
 {
     using (SolemartDBContext context = new SolemartDBContext())
     {
         OrderItem order = context.OrderItems.Find(orderID);
         if (order == null || order.Status != OrderStatus.Ordered)
         {
             return(false);
         }
         order.Status   = OrderStatus.Sending;
         order.SendTime = DateTime.Now;
         return(context.SaveChanges() > 0);
     }
 }
Exemplo n.º 14
0
        /// <summary>
        /// unreserve the product
        /// </summary>
        /// <param name="productID">要去除的商品保留数量列表</param>
        /// <param name="count"></param>
        /// <returns>成功返回true,否则返回false</returns>
        public static bool UnReserveProducts(int productID, int count)
        {
            using (SolemartDBContext context = new SolemartDBContext())
            {
                ProductItem product = context.ProductItems.Find(productID);
                if (product != null && product.ReserveCount >= count)
                {
                    product.ReserveCount += count;
                    return(context.SaveChanges() > 0);
                }

                return(false);
            }
        }
Exemplo n.º 15
0
        /// <summary>
        /// Update birthday of the user
        /// </summary>
        /// <param name="userID">要更新的用户的ID</param>
        /// <param name="newBirthDay">新的用户的生日</param>
        /// <returns>是否成功更新, true:更新成功, false:更新失败</returns>
        public static bool UpdateUserBirthDay(int userID, DateTime newBirthDay)
        {
            using (SolemartDBContext context = new SolemartDBContext())
            {
                UserAppendInfoItem userAppendInfo = context.UserAppendInfoItems.Find(userID);
                if (userAppendInfo != null)
                {
                    userAppendInfo.BirthDay = newBirthDay;
                    return(context.SaveChanges() > 0);
                }

                return(false);
            }
        }
Exemplo n.º 16
0
        /// <summary>
        /// Make a comment for a product
        /// </summary>
        /// <param name="userID">进行评论的用户</param>
        /// <param name="product">要评论的商品对象</param>
        /// <param name="level">评价的星级</param>
        /// <param name="content">评论的内容</param>
        /// <returns>是否评论成功,成功返回true,否则返回false</returns>
        public static bool CommentProduct(int userID, int productID, EvaluteGrade level, string content)
        {
            using (SolemartDBContext context = new SolemartDBContext())
            {
                ProductCommentItem productComment = new ProductCommentItem();
                productComment.UserID      = userID;
                productComment.ProductID   = productID;
                productComment.Grade       = level;
                productComment.Content     = content;
                productComment.CommentTime = DateTime.Now;
                context.ProductCommentItems.Add(productComment);

                return(context.SaveChanges() > 0);
            }
        }
Exemplo n.º 17
0
        /// <summary>
        /// User pay the order
        /// </summary>
        /// <param name="orderID">要支付的订单的ID</param>
        /// <returns>是否成功支付</returns>
        public static bool PayOrder(int orderID, string tradeNo = "")
        {
            using (SolemartDBContext context = new SolemartDBContext())
            {
                OrderItem order = context.OrderItems.Find(orderID);
                if (order == null || order.HasPay)
                {
                    return(false);
                }

                order.HasPay  = true;
                order.TradeNo = tradeNo;
                return(context.SaveChanges() > 0);
            }
        }
Exemplo n.º 18
0
        /// <summary>
        /// Update user info
        /// </summary>
        /// <param name="user">要更新的用户的ID</param>
        /// <returns>是否成功更新, true:更新成功, false:更新失败</returns>
        public static bool UpdateUserInfo(UserItem user)
        {
            using (SolemartDBContext context = new SolemartDBContext())
            {
                UserItem old = context.UserItems.Find(user.UserID);
                if (old != null)
                {
                    old.UserName = user.UserName;
                    old.Email    = user.Email;
                    return(context.SaveChanges() > 0);
                }

                return(false);
            }
        }
Exemplo n.º 19
0
        /// <summary>
        /// 使用openID的用户,如微信用户等
        /// </summary>
        /// <param name="openID">The user's openid of third part</param>
        /// <param name="type">The login type</param>
        public SolemartUser(string openID, LoginType type)
        {
            using (SolemartDBContext context = new SolemartDBContext())
            {
                UserItem useritem = context.UserItems.FirstOrDefault(u => (u.LoginType == type && u.OpenID == openID));

                //如果useritem为空,用户曾经登陆过,直接取数据库中的数据
                if (useritem != null)
                {
                    Log.Instance.WriteLog(string.Format("the user[openid:[{0}], type:[{1}]] has login before.", openID, type));
                    this.userItem          = useritem;
                    useritem.LastLoginTime = DateTime.Now;
                    //不管是不是匿名用户,都用购物车
                    cart = GetUserCart();
                    context.SaveChanges();
                }
                else
                {
                    Log.Instance.WriteLog(string.Format("the user[openid:[{0}], type:[{1}]] is first login.", openID, type));
                    this.userItem = new UserItem {
                        OpenID = openID, LoginType = type, Roles = Role.NormalUser.RoleID.ToString(), RegTime = DateTime.Now, LastLoginTime = DateTime.Now
                    };
                    context.UserItems.Add(this.userItem);
                    context.UserAppendInfoItems.Add(new UserAppendInfoItem {
                        UserID = this.userItem.UserID, BirthDay = new DateTime(1970, 1, 1), Address = "", Phone = "", Sex = SystemUtil.Sex.Unknown
                    });
                    cart = new Cart(this);
                    //写入数据库
                    if (context.SaveChanges() <= 0)
                    {
                        Log.Instance.WriteWarn(string.Format("SolemartUser save failed. userid[{0}]", this.userItem.UserID));
                    }
                }
                isAnonymous = false;
            }
        }
Exemplo n.º 20
0
 /// <summary>
 /// Add an image to the product
 /// </summary>
 /// <param name="image"></param>
 /// <returns>是否添加成功</returns>
 public static bool AddNewImageToProduct(ProductImageItem image)
 {
     using (SolemartDBContext context = new SolemartDBContext())
     {
         image.AddTime = DateTime.Now;
         context.ProductImageItems.Add(image);
         if (context.SaveChanges() > 0)
         {
             if (allProductLogoImages != null)
             {
                 allProductLogoImages.Clear();
             }
             return(true);
         }
         return(false);
     }
 }
Exemplo n.º 21
0
        /// <summary>
        /// Shipping the product
        /// </summary>
        /// <param name="productIDs">要出货的商品列表</param>
        /// <returns>出货成功返回true,否则返回false</returns>
        public static bool ShippingProducts(IEnumerable <OrderDetailItem> items)
        {
            using (SolemartDBContext context = new SolemartDBContext())
            {
                foreach (OrderDetailItem item in items)
                {
                    ProductItem product = context.ProductItems.Find(item.ProductID);
                    if (product != null && product.ReserveCount >= item.Amount)
                    {
                        product.ReserveCount -= item.Amount;
                        product.StockCount   -= item.Amount;
                    }
                }

                return(context.SaveChanges() > 0);
            }
        }
Exemplo n.º 22
0
        /// <summary>
        /// Add a new favorite for user
        /// </summary>
        /// <param name="userID">添加收藏夹项的用户</param>
        /// <param name="productID">添加的商品</param>
        /// <returns>成功收藏返回true,否则返回false</returns>
        public static bool AddNewFavorite(int userID, int productID)
        {
            using (SolemartDBContext context = new SolemartDBContext())
            {
                FavoriteItem favorite = context.FavoriteItems.FirstOrDefault(f => (f.UserID == userID && f.ProductID == productID));
                if (favorite != null)
                {
                    favorite.FavoriteTime = DateTime.Now;
                }
                else
                {
                    context.FavoriteItems.Add(favorite);
                }

                return(context.SaveChanges() > 0);
            }
        }
Exemplo n.º 23
0
        /// <summary>更新了品牌的LOGO图片
        /// </summary>
        /// <param name="newBrand">要更新的品牌</param>
        /// <returns>是否更新成功</returns>
        public static bool UpdateBrandItem(BrandItem newBrand)
        {
            using (SolemartDBContext context = new SolemartDBContext())
            {
                BrandItem oldBrand = context.BrandItems.Find(newBrand.BrandID);
                if (oldBrand != null)
                {
                    oldBrand.ZhName      = newBrand.ZhName;
                    oldBrand.EnName      = newBrand.EnName;
                    oldBrand.BrandLogo   = newBrand.BrandLogo;
                    oldBrand.BrandUrl    = newBrand.BrandUrl;
                    oldBrand.Description = newBrand.Description;
                    return(context.SaveChanges() > 0);
                }

                return(false);
            }
        }
Exemplo n.º 24
0
 public void VendorItemTest()
 {
     using (SolemartDBContext context = new SolemartDBContext())
     {
         context.ClearTableData(typeof(VendorItem));
         VendorItem vendor = new VendorItem {
             VendorName = "vendor_01", Address = "address_01", ContactName = "测试名", Evaluation = "", ExtContent = "", VendorEmail = "*****@*****.**", VendorPhone = "88888888", VendorUrl = "http://test.com"
         };
         context.VendorItems.Add(vendor);
         Assert.IsTrue(context.SaveChanges() > 0);
         vendor = context.VendorItems.Find(1);
         Assert.IsNotNull(vendor);
         Assert.AreEqual <string>("vendor_01", vendor.VendorName);
         Assert.AreEqual <string>("测试名", vendor.ContactName);
         context.ClearTableData(typeof(VendorItem));
         Assert.AreEqual <int>(0, context.VendorItems.Count());
     }
 }
Exemplo n.º 25
0
        /// <summary>
        /// Modify the the product information
        /// </summary>
        /// <param name="product">The modified product item</param>
        /// <returns>是否修改成功</returns>
        public static bool ModifyProductInfo(ProductItem product)
        {
            using (SolemartDBContext context = new SolemartDBContext())
            {
                ProductItem oldProduct = context.ProductItems.Find(product.ProductID);
                if (oldProduct == null)
                {
                    return(false);
                }

                if (!string.IsNullOrWhiteSpace(product.ProductName))
                {
                    oldProduct.ProductName = product.ProductName;
                }
                if (!string.IsNullOrWhiteSpace(product.Unit))
                {
                    oldProduct.Unit = product.Unit;
                }
                if (!string.IsNullOrWhiteSpace(product.Specification))
                {
                    oldProduct.Specification = product.Specification;
                }
                if (!string.IsNullOrWhiteSpace(product.Description))
                {
                    oldProduct.Description = product.Description;
                }
                if (!string.IsNullOrWhiteSpace(product.ProducingArea))
                {
                    oldProduct.ProducingArea = product.ProducingArea;
                }
                oldProduct.CategoryID = product.CategoryID;

                if (context.SaveChanges() > 0)
                {
                    if (allSaledProducts != null)
                    {
                        allSaledProducts.Clear();
                    }
                    return(true);
                }
                return(false);
            }
        }
Exemplo n.º 26
0
        /// <summary>
        /// Set the username
        /// </summary>
        /// <param name="username"></param>
        /// <returns></returns>
        public bool SetUserName(string username)
        {
            using (SolemartDBContext context = new SolemartDBContext())
            {
                UserItem tempUserItem = context.UserItems.Find(userItem.UserID);
                if (tempUserItem != null)
                {
                    tempUserItem.UserName = username;
                }

                if (context.SaveChanges() > 0)
                {
                    userItem.UserName = username;
                    return(true);
                }

                return(false);
            }
        }
Exemplo n.º 27
0
        /// <summary>
        /// Set the username
        /// </summary>
        /// <param name="email"></param>
        /// <returns></returns>
        public bool SetEmail(string email)
        {
            using (SolemartDBContext context = new SolemartDBContext())
            {
                UserItem tempUserItem = context.UserItems.Find(userItem.UserID);
                if (tempUserItem != null)
                {
                    tempUserItem.Email = email;
                }

                if (context.SaveChanges() > 0)
                {
                    userItem.Email = email;
                    return(true);
                }

                return(false);
            }
        }
Exemplo n.º 28
0
        public bool SetBirthDay(DateTime birthDay)
        {
            using (SolemartDBContext context = new SolemartDBContext())
            {
                UserAppendInfoItem tempUserItem = context.UserAppendInfoItems.FirstOrDefault(u => u.UserID == userItem.UserID);
                if (tempUserItem != null)
                {
                    tempUserItem.BirthDay = birthDay;
                }

                if (context.SaveChanges() > 0)
                {
                    userItem.AppendInfo.BirthDay = birthDay;
                    return(true);
                }

                return(false);
            }
        }
Exemplo n.º 29
0
        /// <summary>
        /// Set the user head Image
        /// </summary>
        /// <param name="imgUrl"></param>
        /// <returns></returns>
        public bool SetHeadImage(string imgUrl)
        {
            using (SolemartDBContext context = new SolemartDBContext())
            {
                UserAppendInfoItem tempUserItem = context.UserAppendInfoItems.FirstOrDefault(u => u.UserID == userItem.UserID);
                if (tempUserItem != null)
                {
                    tempUserItem.HeadImageUrl = imgUrl;
                }

                if (context.SaveChanges() > 0)
                {
                    userItem.AppendInfo.HeadImageUrl = imgUrl;
                    return(true);
                }

                return(false);
            }
        }
Exemplo n.º 30
0
        /// <summary>
        /// Add a new qq user
        /// </summary>
        /// <param name="openid">用户名</param>
        /// <returns>成功注册返回新注册的用户对象,否则返回null</returns>
        public static UserItem AddNewQQUser(string openid, string nickname)
        {
            using (SolemartDBContext context = new SolemartDBContext())
            {
                int userid = context.RegisterNewQQUser(nickname, "", "", DateTime.Now);
                if (userid > 0)
                {
                    context.UserAppendInfoItems.Add(new UserAppendInfoItem {
                        UserID = userid, BirthDay = new DateTime(1970, 1, 1), Address = "", Phone = "", Sex = SystemUtil.Sex.Unknown
                    });
                    context.SaveChanges();
                    return(new UserItem {
                        UserID = userid, UserName = nickname, Email = "", Roles = Role.NormalUser.ToString(), LoginType = SystemUtil.LoginType.QQ
                    });
                }

                return(null);
            }
        }