コード例 #1
0
        public ActionResult ManageIdentificationTypes()
        {
            //获得所有的认证标识
            IEnumerable <IdentificationType> identificationTypes = identificationService.GetIdentificationTypes(null);

            return(View(identificationTypes));
        }
コード例 #2
0
        /// <summary>
        /// 获取某人通过验证的身份认证标识
        /// </summary>
        /// <param name="htmlHelper"></param>
        /// <param name="userId">用户Id</param>
        /// <returns></returns>
        public static MvcHtmlString IdentificationType(this HtmlHelper htmlHelper, long userId)
        {
            if (userId <= 0)
                return MvcHtmlString.Empty;
            //获取某人通过验证的身份认证
            IdentificationService identificationService = new IdentificationService();
            var identificationTypes = identificationService.GetIdentificationTypes(userId);

            if (identificationTypes == null)
                return MvcHtmlString.Empty;

            StringBuilder builder = new StringBuilder();
            TagBuilder imgBuilder;

            foreach (var identificationType in identificationTypes)
            {
                imgBuilder = new TagBuilder("img");
                imgBuilder.MergeAttribute("src", SiteUrls.Instance().LogoUrl(identificationType.IdentificationTypeLogo, TenantTypeIds.Instance().IdentificationType(), ImageSizeTypeKeys.Instance().Small()));
                imgBuilder.MergeAttribute("alt", identificationType.Name);
                imgBuilder.MergeAttribute("title", identificationType.Name);
                builder.Append(imgBuilder.ToString());
            }

            return MvcHtmlString.Create(builder.ToString());
        }
コード例 #3
0
        /// <summary>
        /// 获取某人通过验证的身份认证标识
        /// </summary>
        /// <param name="htmlHelper"></param>
        /// <param name="userId">用户Id</param>
        /// <returns></returns>
        public static MvcHtmlString IdentificationType(this HtmlHelper htmlHelper, long userId)
        {
            if (userId <= 0)
            {
                return(MvcHtmlString.Empty);
            }
            //获取某人通过验证的身份认证
            IdentificationService identificationService = new IdentificationService();
            var identificationTypes = identificationService.GetIdentificationTypes(userId);

            if (identificationTypes == null)
            {
                return(MvcHtmlString.Empty);
            }

            StringBuilder builder = new StringBuilder();
            TagBuilder    imgBuilder;

            foreach (var identificationType in identificationTypes)
            {
                imgBuilder = new TagBuilder("img");
                imgBuilder.MergeAttribute("src", SiteUrls.Instance().LogoUrl(identificationType.IdentificationTypeLogo, TenantTypeIds.Instance().IdentificationType(), ImageSizeTypeKeys.Instance().Small()));
                imgBuilder.MergeAttribute("alt", identificationType.Name);
                imgBuilder.MergeAttribute("title", identificationType.Name);
                builder.Append(imgBuilder.ToString());
            }

            return(MvcHtmlString.Create(builder.ToString()));
        }