예제 #1
0
        /// <summary>
        /// 绑定第三方帐号提示信息
        /// </summary>
        /// <param name="accountTypeKey"></param>
        /// <returns></returns>
        public ActionResult _BindThirdAccount(string accountTypeKey)
        {
            var            accountBindingService = new AccountBindingService();
            AccountType    accountType           = accountBindingService.GetAccountType(accountTypeKey);
            var            currentUserId         = UserContext.CurrentUser != null ? UserContext.CurrentUser.UserId : 0;
            AccountBinding accountBinding        = accountBindingService.GetAccountBinding(currentUserId, accountType.AccountTypeKey);

            ViewData["isExpired"] = accountBinding != null && accountBinding.ExpiredDate.CompareTo(DateTime.UtcNow) < 0;
            return(View(accountType));
        }
예제 #2
0
        /// <summary>
        /// 将EditModel转为数据库实体
        /// </summary>
        /// <returns></returns>
        public AccountType AsAccountType()
        {
            AccountBindingService service     = new AccountBindingService();
            AccountType           accountType = service.GetAccountType(AccountTypeKey);

            accountType.AppKey                   = AppKey ?? string.Empty;
            accountType.AppSecret                = AppSecret ?? string.Empty;
            accountType.IsSync                   = IsSync;
            accountType.IsShareMicroBlog         = IsShareMicroBlog;
            accountType.IsFollowMicroBlog        = IsFollowMicroBlog;
            accountType.OfficialMicroBlogAccount = OfficialMicroBlogAccount ?? string.Empty;
            accountType.IsEnabled                = IsEnabled;

            return(accountType);
        }