本文整理汇总了C#中Discuz.Entity.UserInfo类的典型用法代码示例。如果您正苦于以下问题:C# UserInfo类的具体用法?C# UserInfo怎么用?C# UserInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UserInfo类属于Discuz.Entity命名空间,在下文中一共展示了UserInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ShowPage
protected override void ShowPage()
{
pagetitle = "用户控制面板";
if (userid == -1)
{
AddErrLine("你尚未登录");
return;
}
user = Discuz.Forum.Users.GetUserInfo(userid);
if (!IsErr())
{
score = Scoresets.GetValidScoreName();
avatar = user.Avatar;
avatarurl = "";
avatartype = 1;
avatarwidth = 0;
avatarheight = 0;
if (Utils.CutString(avatar, 0, 15).ToLower().Equals(@"avatars\common\"))
{
avatartype = 0;
}
else if (Utils.CutString(avatar, 0, 7).ToLower().Equals("http://"))
{
avatarurl = avatar;
avatartype = 2;
avatarwidth = user.Avatarwidth;
avatarheight = user.Avatarheight;
}
}
}
示例2: ShowPage
protected override void ShowPage()
{
pagetitle = "用户控制面板";
if (userid == -1)
{
AddErrLine("你尚未登录");
return;
}
user = Users.GetUserInfo(userid);
//得到当前用户请求的页数
//获取主题总数
topiccount = Topics.GetMyUnauditTopicCount(user.Uid, -2);
//获取总页数
pagecount = topiccount % 16 == 0 ? topiccount / 16 : topiccount / 16 + 1;
pagecount = pagecount == 0 ? 1 : pagecount;
//修正请求页数中可能的错误
pageid = pageid < 1 ? 1 : pageid;
pageid = pageid > pagecount ? pagecount : pageid;
//查找需要审核的主题
topics = Topics.GetMyUnauditTopic(user.Uid, 16, pageid, -2);
pagenumbers = Utils.GetPageNumbers(pageid, pagecount, "myaudittopics.aspx", 8);
}
示例3: GetFriendInfo
public string GetFriendInfo()
{
GetFriendInfoParams actionParams = JavaScriptConvert.DeserializeObject<GetFriendInfoParams>(JsonParams);
ShortUserInfo shortInfo = Forum.Users.GetShortUserInfo(actionParams.Uid);
UserInfo user = new UserInfo();
user.Uid = shortInfo.Uid;
user.UserName = shortInfo.Username;
GetFriendInfoResponse gfiResponse = new GetFriendInfoResponse();
gfiResponse.TotalNum = Forum.Friendship.GetUserFriendsCount(user.Uid);
gfiResponse.Me = user;
List<FriendshipInfo> friendshipList = Friendship.GetUserFriendsList(user.Uid, 1, actionParams.ShowFriendsNum);
List<Friend> friendList = new List<Friend>();
foreach (FriendshipInfo info in friendshipList)
{
friendList.Add(new Friend(info.FriendUid, info.FriendUserName.Trim()));
}
gfiResponse.Friends = friendList;
return GetResult(gfiResponse);
}
示例4: UserNameChange
/// <summary>
/// 更新用户名
/// </summary>
/// <param name="userInfo">当前用户信息</param>
/// <param name="oldusername">以前用户的名称</param>
/// <returns></returns>
public static bool UserNameChange(UserInfo userInfo, string oldusername)
{
//将新主题表
Data.Topics.UpdateTopicLastPoster(userInfo.Uid, userInfo.Username);
Data.Topics.UpdateTopicPoster(userInfo.Uid, userInfo.Username);
//更新帖子表
//foreach (DataRow dr in Data.PostTables.GetAllPostTableName().Rows)
//{
Data.Posts.UpdatePostPoster(userInfo.Uid, userInfo.Username);
//}
//更新短消息
Data.PrivateMessages.UpdatePMSenderAndReceiver(userInfo.Uid, userInfo.Username);
//更新公告
Data.Announcements.UpdateAnnouncementPoster(userInfo.Uid, userInfo.Username);
//更新统计表中的信息
if (Data.Statistics.UpdateStatisticsLastUserName(userInfo.Uid, userInfo.Username) != 0)
{
Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/Statistics");
}
//更新论坛版主相关信息
//foreach (DataRow dr in Data.Forums.GetModerators(oldusername).Rows)
//{
// string moderators = "," + dr["moderators"].ToString().Trim() + ",";
// if (moderators.IndexOf("," + oldusername + ",") >= 0)
// Forums.UpdateForumField(Utils.StrToInt(dr["fid"], 0),"moderators",dr["moderators"].ToString().Trim().Replace(oldusername, userInfo.Username));
//}
//更新版块版主的名字
Forums.UpdateModeratorName(oldusername, userInfo.Username);
return true;
}
示例5: ShowPage
protected override void ShowPage()
{
pagetitle = "用户控制面板";
if (userid == -1)
{
AddErrLine("你尚未登录");
return;
}
user = Users.GetUserInfo(userid);
//得到当前用户请求的页数
//获取主题总数
topiccount = Topics.GetTopicsCountbyUserId(userid, false);
//获取总页数
pagecount = topiccount % 16 == 0 ? topiccount / 16 : topiccount / 16 + 1;
pagecount = pagecount == 0 ? 1 : pagecount;
//修正请求页数中可能的错误
pageid = pageid < 1 ? 1 : pageid;
pageid = pageid > pagecount ? pagecount : pageid;
topics = Topics.GetTopicsByUserId(userid, pageid, 16, 600, config.Hottopic);
pagenumbers = Utils.GetPageNumbers(pageid, pagecount, "mytopics.aspx", 8);
}
示例6: ShowPage
protected override void ShowPage()
{
pagetitle = "用户控制面板";
if (userid == -1)
{
AddErrLine("你尚未登录");
return;
}
user = Discuz.Forum.Users.GetUserInfo(userid);
if (DNTRequest.IsPost())
{
string oldpassword = DNTRequest.GetString("oldpassword");
string newpassword = DNTRequest.GetString("newpassword");
string newpassword2 = DNTRequest.GetString("newpassword2");
if (Discuz.Forum.Users.CheckPassword(userid, oldpassword, true) == -1)
{
AddErrLine("你的原密码错误");
}
if (newpassword != newpassword2)
{
AddErrLine("新密码两次输入不一致");
}
if (newpassword.Equals(""))
{
newpassword = oldpassword;
}
if (newpassword.Length < 6)
{
AddErrLine("密码不得少于6个字符");
}
if (IsErr())
{
return;
}
else
{
//判断是否需要修改安全提问
Discuz.Forum.Users.UpdateUserPassword(userid, newpassword);
if (DNTRequest.GetString("changesecques") != "")
{
Discuz.Forum.Users.UpdateUserSecques(userid, DNTRequest.GetInt("question", 0), DNTRequest.GetString("answer"));
}
ForumUtils.WriteCookie("password",
ForumUtils.SetCookiePassword(Utils.MD5(newpassword), config.Passwordkey));
OnlineUsers.UpdatePassword(olid, Utils.MD5(newpassword));
SetUrl("usercpnewpassword.aspx");
SetMetaRefresh();
SetShowBackLink(true);
AddMsgLine("修改密码完毕, 同时已经更新了您的登录信息");
}
}
}
示例7: SaveUserInfo
/// <summary>
/// 更新用户信息
/// </summary>
/// <param name="userInfo">要保存的用户信息(密码为明文)</param>
/// <returns>返回经过处理之后的实际用户信息</returns>
public UserInfo SaveUserInfo(UserInfo userInfo)
{
if (Utils.StrIsNullOrEmpty(userInfo.Salt))
userInfo.Salt = ForumUtils.CreateAuthStr(6, false);
userInfo.Password = GetEncryptedPassword(userInfo, userInfo.Password);
return Users.UpdateUser(userInfo) ? userInfo : null;
}
示例8: SaveUserInfo
/// <summary>
/// 更新用户信息
/// </summary>
/// <param name="userInfo">要保存的用户信息(密码为明文)</param>
/// <returns>返回经过处理之后的实际用户信息</returns>
public UserInfo SaveUserInfo(UserInfo userInfo)
{
if(Utils.StrIsNullOrEmpty(userInfo.Salt))
userInfo.Salt = Forum.ForumUtils.CreateAuthStr(6,false);
userInfo.Password = Utils.MD5(Utils.MD5(userInfo.Password) + userInfo.Salt); //两遍MD5
return Discuz.Data.Users.UpdateUser(userInfo) ? userInfo : null;
}
示例9: CheckPassword
/// <summary>
/// 检查密码
/// </summary>
/// <param name="userInfo">通过username获取的用户信息,用于进行密码验证</param>
/// <param name="postpassword">用户提交的密码</param>
/// <returns>返回当前用户信息与提交密码的验证结果</returns>
public bool CheckPassword(UserInfo userInfo, string postpassword)
{
if (userInfo == null)
{
return false;
}
var doubleMd5 = GetEncryptedPassword(userInfo, postpassword);
return doubleMd5 == userInfo.Password; //比较
}
示例10: ShowPage
protected override void ShowPage()
{
pagetitle = "查看用户信息";
if (usergroupinfo.Allowviewpro != 1)
{
AddErrLine(string.Format("您当前的身份 \"{0}\" 没有查看用户资料的权限", usergroupinfo.Grouptitle));
if (userid < 1)
needlogin = true;
return;
}
if (DNTRequest.GetString("username").Trim() == "" && DNTRequest.GetString("userid").Trim() == "")
{
AddErrLine("错误的URL链接");
return;
}
int id = DNTRequest.GetInt("userid", -1);
if (id == -1)
id = Users.GetUserId(Utils.UrlDecode(DNTRequest.GetString("username")));
if (id == -1)
{
AddErrLine("该用户不存在");
return;
}
user = Users.GetUserInfo(id);
if (user == null)
{
AddErrLine("该用户不存在");
return;
}
//用户设定Email保密时,清空用户的Email属性以避免被显示
if (user.Showemail != 1 && id != userid)
user.Email = "";
//获取积分机制和用户组信息,底层有缓存
score = Scoresets.GetValidScoreName();
group = UserGroups.GetUserGroupInfo(user.Groupid);
admininfo = AdminUserGroups.AdminGetAdminGroupInfo(usergroupid);
score1 = ((decimal)user.Extcredits1).ToString();
score2 = ((decimal)user.Extcredits2).ToString();
score3 = ((decimal)user.Extcredits3).ToString();
score4 = ((decimal)user.Extcredits4).ToString();
score5 = ((decimal)user.Extcredits5).ToString();
score6 = ((decimal)user.Extcredits6).ToString();
score7 = ((decimal)user.Extcredits7).ToString();
score8 = ((decimal)user.Extcredits8).ToString();
}
示例11: ShowPage
protected override void ShowPage()
{
pagetitle = "查看用户信息";
if (usergroupinfo.Allowviewpro != 1)
{
AddErrLine(string.Format("您当前的身份 \"{0}\" 没有查看用户资料的权限", usergroupinfo.Grouptitle));
if (userid < 1)
needlogin = true;
return;
}
if (DNTRequest.GetString("username").Trim() == "" && DNTRequest.GetString("userid").Trim() == "")
{
AddErrLine("错误的URL链接");
return;
}
int id = DNTRequest.GetInt("userid", -1);
if (id == -1)
{
id = Discuz.Forum.Users.GetUserID(Utils.UrlDecode(DNTRequest.GetString("username")));
}
if (id == -1)
{
AddErrLine("该用户不存在");
return;
}
user = Discuz.Forum.Users.GetUserInfo(id);
if (user == null)
{
AddErrLine("该用户不存在");
return;
}
//用户设定Email保密时,清空用户的Email属性以避免被显示
if (user.Showemail != 1)
{
user.Email = "";
}
//获取金币机制和用户组信息,底层有缓存
score = Scoresets.GetValidScoreName();
group = UserGroups.GetUserGroupInfo(user.Groupid);
admininfo = AdminUserGroups.AdminGetAdminGroupInfo(usergroupid);
}
示例12: GetUserExtCredit
/// <summary>
/// 返回相应用户扩展积分字段信息
/// </summary>
/// <param name="userInfo"></param>
/// <param name="extId"></param>
/// <returns></returns>
public static float GetUserExtCredit(UserInfo userInfo, int extId)
{
switch (extId)
{
case 1: return userInfo.Extcredits1;
case 2: return userInfo.Extcredits2;
case 3: return userInfo.Extcredits3;
case 4: return userInfo.Extcredits4;
case 5: return userInfo.Extcredits5;
case 6: return userInfo.Extcredits6;
case 7: return userInfo.Extcredits7;
case 8: return userInfo.Extcredits8;
default: return 0;
}
}
示例13: UpdateUserAllInfo
/// <summary>
/// 更新用户全部信息
/// </summary>
/// <param name="__userinfo"></param>
/// <returns></returns>
public static bool UpdateUserAllInfo(UserInfo userInfo)
{
Users.UpdateUser(userInfo);
//当用户不是版主(超级版主)或管理员
if ((userInfo.Adminid == 0) || (userInfo.Adminid > 3))
{
//删除用户在版主列表中相关数据
Data.Moderators.DeleteModerator(userInfo.Uid);
//同时更新版块相关的版主信息
UpdateForumsFieldModerators(userInfo.Username);
}
#region 以下为更新该用户的扩展信息
string signature = Utils.HtmlEncode(ForumUtils.BanWordFilter(userInfo.Signature));
UserGroupInfo usergroupinfo = AdminUserGroups.AdminGetUserGroupInfo(userInfo.Groupid);
GeneralConfigInfo config = GeneralConfigs.GetConfig();
PostpramsInfo postPramsInfo = new PostpramsInfo();
postPramsInfo.Usergroupid = usergroupinfo.Groupid;
postPramsInfo.Attachimgpost = config.Attachimgpost;
postPramsInfo.Showattachmentpath = config.Showattachmentpath;
postPramsInfo.Hide = 0;
postPramsInfo.Price = 0;
postPramsInfo.Sdetail = userInfo.Signature;
postPramsInfo.Smileyoff = 1;
postPramsInfo.Bbcodeoff = 1 - usergroupinfo.Allowsigbbcode;
postPramsInfo.Parseurloff = 1;
postPramsInfo.Showimages = usergroupinfo.Allowsigimgcode;
postPramsInfo.Allowhtml = 0;
postPramsInfo.Smiliesinfo = Smilies.GetSmiliesListWithInfo();
postPramsInfo.Customeditorbuttoninfo = Editors.GetCustomEditButtonListWithInfo();
postPramsInfo.Smiliesmax = config.Smiliesmax;
postPramsInfo.Signature = 1;
postPramsInfo.Onlinetimeout = config.Onlinetimeout;
userInfo.Signature = signature;
userInfo.Authstr = ForumUtils.CreateAuthStr(20);
userInfo.Sightml = UBB.UBBToHTML(postPramsInfo);
Users.UpdateUser(userInfo);
#endregion
Users.UpdateUserForumSetting(userInfo);
return true;
}
示例14: IsLogin
protected bool IsLogin()
{
if (userid == -1)
{
AddErrLine("你尚未登录");
return false;
}
user = Users.GetUserInfo(userid);
if (user == null)
{
AddErrLine("用户不存在");
return false;
}
return true;
}
示例15: MergeFeedTemplateData
/// <summary>
/// 绑定feed模板中的变量值
/// </summary>
/// <param name="template"></param>
/// <param name="dataJson"></param>
/// <param name="userInfo"></param>
/// <returns></returns>
public static string MergeFeedTemplateData(string template, string dataJson, UserInfo userInfo)
{
Dictionary<string, string> dataList = new Dictionary<string, string>();
if (!string.IsNullOrEmpty(dataJson))
dataList = JavaScriptConvert.DeserializeObject<Dictionary<string, string>>(dataJson);
string actorData = string.Format("<a href=\"{0}\">{1}</a>", Urls.UserInfoAspxRewrite(userInfo.Uid), userInfo.Username);
dataList.Add("actor", actorData);
foreach (string key in dataList.Keys)
{
template = template.Replace("{" + key + "}", dataList[key]);
}
return template;
}