本文整理汇总了C#中User.update方法的典型用法代码示例。如果您正苦于以下问题:C# User.update方法的具体用法?C# User.update怎么用?C# User.update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类User
的用法示例。
在下文中一共展示了User.update方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Create
public virtual Result Create( User user, String connectType, AccessToken token )
{
UserConnect connect = GetConnectInfo( token.Uid, connectType );
if (connect != null) {
return new Result( "本帐号已经绑定: uid=" + token.Uid + ",connectType=" + connectType );
}
UserConnect x = new UserConnect();
x.User = user;
x.ConnectType = connectType;
x.Uid = token.Uid;
x.Name = token.Name;
x.AccessToken = token.Token;
x.RefreshToken = token.RefreshToken;
x.ExpiresIn = token.ExpiresIn;
x.Scope = token.Scope;
Result result = x.insert();
if (result.IsValid) {
user.IsBind = 1;
user.update();
}
return result;
}
示例2: onUpdateBtn
protected void onUpdateBtn(object sender, EventArgs e)
{
User user = new User();
user.update(Param);
alertAndGoback("Updated!");
return;
}
示例3: UpdateLastLogin
// 每次页面加载都要检查
public virtual void UpdateLastLogin( User user, String ip )
{
if (user.LastLoginTime.ToShortDateString() != DateTime.Now.ToShortDateString()) {
user.LoginDay++;
user.LoginCount++;
user.LastLoginTime = DateTime.Now;
user.LastLoginIp = ip;
user.update();
}
}
示例4: updateLastLogin
// 直接登录
private void updateLastLogin( User user, String ip )
{
if (user.LastLoginTime.ToShortDateString() != DateTime.Now.ToShortDateString()) {
user.LoginDay++;
}
user.LoginCount++;
user.LastLoginTime = DateTime.Now;
user.LastLoginIp = ip;
user.update();
}
示例5: Friends
public Friends(JSONArray array)
{
this.friends = new Dictionary<string, User>();//new User[friends.Length];
foreach (JSONValue friend in array)
{
User friend_user = new User();
friend_user.update(friend.Obj);
friend_user.is_connected = false;
this.friends.Add(friend_user.username, friend_user);
}
}
示例6: AddLogAndPass
public virtual void AddLogAndPass( User user, string ip )
{
user.IsPicError = 0;
user.update();
UserErrorPic log = new UserErrorPic();
log.UserId = user.Id;
log.Ip = ip;
log.IsPass = 1;
log.ReviewMsg = "auto pass";
log.insert();
}
示例7: UnLike
public void UnLike( User user, PhotoPost post )
{
PhotoLike p = this.GetOne( user.Id, post.Id );
p.delete();
post.Likes = PhotoLike.count( "PostId=" + post.Id );
post.update();
user.Likes = PhotoLike.count( "UserId=" + user.Id );
user.update( "Likes" );
}
示例8: Like
public void Like( User user, PhotoPost post )
{
PhotoLike x = new PhotoLike();
x.Post = post;
x.User = user;
x.insert();
post.Likes = PhotoLike.count( "PostId=" + post.Id );
post.update();
user.Likes = PhotoLike.count( "UserId=" + user.Id );
user.update( "Likes" );
}
示例9: SaveFirstLogin
public void SaveFirstLogin()
{
if (ctx.viewer.IsLogin) {
echoError( "对不起,您已经登录" );
return;
}
Object connectType = ctx.web.SessionGet( "__connectType" );
if (connectType == null) {
echoError( "无效的 connect type" );
return;
}
AuthConnect connect = AuthConnectFactory.GetConnect( connectType.ToString() );
if (connect == null) {
echoError( "此连接类型不存在:" + connectType );
return;
}
AccessToken accessToken = getAccessToken();
OAuthUserProfile userProfile = connect.GetUserProfile( accessToken );
if (userProfile == null) {
echoError( "无法获取正常 user profile" );
return;
}
accessToken.Name = userProfile.Name;
// 注册用户
User user = new User();
user.Name = ctx.Post( "userName" );
user.Url = ctx.Post( "userUrl" );
Result result = userService.RegisterNoPwd( user );
if (result.HasErrors) {
echoError( result );
return;
}
result = AvatarUploader.SaveRemote( userProfile.PicUrlBig, user.Id );
if (result.IsValid) {
user.Pic = result.Info.ToString();
user.update();
}
else {
echoError( result );
return;
}
// 是否开启空间
RegHelper.CheckUserSpace( user, ctx );
// 绑定用户
Result saveResult = connectService.Create( user, connect.GetType().FullName, accessToken );
if (saveResult.IsValid) {
UserConnect userConnect = saveResult.Info as UserConnect;
loginService.Login( user, userConnect.Id, LoginTime.OneWeek, ctx.Ip, ctx ); // 登录
echoRedirect( "登录成功", "/" );
}
else {
echoError( saveResult );
}
}
示例10: addNotificationCount
// User 的最新通知数是缓存的
private void addNotificationCount( User receiver )
{
if (receiver == null) return;
receiver.NewNotificationCount++;
receiver.update( "NewNotificationCount" );
}
示例11: deleteUserPic
private void deleteUserPic( User user )
{
if (user.Pic != UserFactory.Guest.Pic) {
AvatarUploader.Delete( user.Pic );
}
user.Pic = "";
user.update();
}
示例12: UserUpdate
/// <summary>
/// 资料同步修改
/// </summary>
/// <param name="user"></param>
public void UserUpdate( User user )
{
if (user == null) throw new ArgumentNullException();
User dbUser = getUserByName( user.Name );
if (dbUser == null) throw new NullReferenceException( "试图修改的用户不存在,用户名=" + user.Name );
user.Id = dbUser.Id;
user.update();
}
示例13: createPersonalSite
private void createPersonalSite( User user )
{
// 将博客=>设为个人空间首页
UserMenu blogMenu = getBlogMenu( user );
blogMenu.Url = "default";
ServiceMap.GetMenuService( typeof( User ) ).Update( blogMenu );
// 修改路由default;default:{owner=admin,ownertype=user}
updateRoute( user );
// 修改主题
user.TemplateId = 31;
user.update();
// done
updateSiteDone();
// 重启网站
sys.Clear.ClearAll();
}