/// <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)); } }
/// <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"]; }
/// <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"]); }
/// <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); } }