当前位置: 首页>>代码示例>>C#>>正文


C# UserInfo.Update方法代码示例

本文整理汇总了C#中UserInfo.Update方法的典型用法代码示例。如果您正苦于以下问题:C# UserInfo.Update方法的具体用法?C# UserInfo.Update怎么用?C# UserInfo.Update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UserInfo的用法示例。


在下文中一共展示了UserInfo.Update方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: MapFacebookUserProfile

    /// <summary>
    /// Maps the values of Facebook user profile attributes to the values of CMS user fields depending on the current settings.
    /// </summary>
    /// <param name="mappingTrigger">Specifies when the mapping of Facebook user profile occurs.</param>
    /// <param name="user">The CMS user.</param>
    /// <param name="userProfileId">The Facebook user profile identifier.</param>
    /// <param name="facebookAccessToken">The Facebook access token.</param>
    /// <remarks>
    /// The CMS user name is updated only if it was generated by the CMS.
    /// </remarks>
    private void MapFacebookUserProfile(FacebookUserProfileMappingTriggerEnum mappingTrigger, UserInfo user, string userProfileId, string facebookAccessToken)
    {
        IFacebookUserProvider facebookUserProvider = new FacebookUserProvider();
        var facebookUser = facebookUserProvider.GetFacebookUser(userProfileId, facebookAccessToken);
        bool userChanged = false;

        // Change user's full name if it is in default format
        if (String.IsNullOrEmpty(user.FullName) || (user.FullName == UserInfoProvider.FACEBOOKID_FULLNAME_PREFIX + userProfileId))
        {
            user.FullName = facebookUser.FacebookName;
            userChanged = true;
        }

        // Map Facebook user on appropriate action
        if (FacebookMappingHelper.GetUserProfileMappingTrigger(SiteContext.CurrentSiteName) == mappingTrigger)
        {
            FacebookMappingHelper.MapUserProfile(facebookUser, user);
            userChanged = true;
        }

        if (userChanged)
        {
            user.Update();
        }
    }
开发者ID:arvind-web-developer,项目名称:csharp-projects-Jemena-Kentico-CMS,代码行数:35,代码来源:FacebookConnectLogon.ascx.cs

示例2: UpdateUser

 public string UpdateUser(int ID, string Name, string DisplayName, int GroupID, string Password, string Email, string BirthDay, bool IsSaveOnServer, bool IsSuperUser, bool SignUp)
 {
     string str = "";
     if (SignUp || IsAuthenticated(out str))
     {
         try
         {
             bool isUsernameFree = (UserInfo.Get(Name) == null);
             if (ID == -1)
                 str += (SignUp ? "" : ", ") + "\"username_valid\":" + (isUsernameFree ? "true" : "false");
             if (isUsernameFree && Name.Trim().Length > 0 && DisplayName.Trim().Length > 0 && Password.Length > 0 )
             {
                 UserInfo info = new UserInfo();
                 info.UserID = ID;
                 info.Username = Name;
                 info.DisplayName = DisplayName;
                 info.GroupeID = GroupID;
                 info.Password = Coding.Encrypt(Name + Password.Length.ToString(), Password);
                 info.Email = Email;
                 info.BirthDay = BirthDay=="31/12/10"?Null.NullDate:DateTime.Parse(BirthDay);
                 info.IsSaveOnServer = IsSaveOnServer;
                 info.IsSuperuser = IsSuperUser;
                 info.Update();
                 str += ", \"data\": " + info.ToJSON();
             }
         }
         catch
         {
             str += ", \"error\": \"Error on database update.\"";
         }
     }
     return str;
 }
开发者ID:rosenkolev,项目名称:Communication-System,代码行数:33,代码来源:WebService.cs


注:本文中的UserInfo.Update方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。