/// <summary>
        /// 获取haojima用户id   如果没有则创建用户
        /// </summary>
        /// <param name="userName"></param>
        /// <returns></returns>
        private int GetUserId(string userName)
        {
            BlogUsersSetBLL user        = new BlogUsersSetBLL();
            var             blogtagmode = user.GetList(t => t.UserName == userName);

            if (blogtagmode.Count() >= 1)
            {
                return(blogtagmode.FirstOrDefault().Id);
            }
            else
            {
                user.Add(new ModelDB.BlogUsersSet()
                {
                    UserName     = userName,
                    IsDel        = false,
                    UserPass     = "******".MD5().MD5(),
                    UserNickname = string.IsNullOrEmpty(blogName.Trim()) ? userName : blogName,
                    IsLock       = false,
                    UserMail     = "无效",
                    UserInfo     = new UserInfo()
                });
                try
                {
                    user.save(false);
                }
                catch (Exception ex)
                {
                    throw;
                }

                return(GetUserId(userName));
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// 获取所有博客的用户信息
 /// </summary>
 /// <param name="newCache">是否重新获取</param>
 /// <returns></returns>
 public static List<BlogUsersSet> GetAllUserInfo(bool newCache = false)
 {
     if (null == HttpRuntime.Cache["UserInfo"] || newCache)
     {
         BLL.BlogUsersSetBLL user = new BlogUsersSetBLL();
         HttpRuntime.Cache["UserInfo"] = user.GetList(t => true).ToList();
     }
     return (List<BlogUsersSet>)HttpRuntime.Cache["UserInfo"];
 }
Exemplo n.º 3
0
 /// <summary>
 /// 获取所有博客的用户信息
 /// </summary>
 /// <param name="newCache">是否重新获取</param>
 /// <returns></returns>
 public static List <BlogUsersSet> GetAllUserInfo(bool newCache = false)
 {
     if (null == HttpRuntime.Cache["UserInfo"] || newCache)
     {
         BLL.BlogUsersSetBLL user = new BlogUsersSetBLL();
         HttpRuntime.Cache["UserInfo"] = user.GetList(t => true).ToList();
     }
     return((List <BlogUsersSet>)HttpRuntime.Cache["UserInfo"]);
 }
Exemplo n.º 4
0
        /// <summary>
        /// 获取haojima用户id   如果没有则创建用户
        /// </summary>
        /// <param name="userName"></param>
        /// <returns></returns>
        private int GetUserId(string userName)
        {
            BlogUsersSetBLL user = new BlogUsersSetBLL();
            var blogtagmode = user.GetList(t => t.UserName == userName);
            if (blogtagmode.Count() >= 1)
                return blogtagmode.FirstOrDefault().Id;
            else
            {
                user.Add(new ModelDB.BlogUsersSet()
                {
                    UserName = userName,
                    IsDel = false,
                    UserPass = "******".MD5().MD5(),
                    UserNickname = string.IsNullOrEmpty(blogName.Trim()) ? userName : blogName,
                    IsLock = false,
                    UserMail = "无效",
                    UserInfo = new UserInfo()
                });
                try
                {
                    user.save(false);
                }
                catch (Exception ex)
                {

                    throw;
                }

                return GetUserId(userName);
            }
        }