• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# RoleType类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中RoleType的典型用法代码示例。如果您正苦于以下问题:C# RoleType类的具体用法?C# RoleType怎么用?C# RoleType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



RoleType类属于命名空间,在下文中一共展示了RoleType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: User

 /// <summary>
 /// constructor
 /// </summary>
 /// <param name="id">id of the user</param>
 /// <param name="name">name of the user</param>
 /// <param name="username">username of the user (represented by email)</param>
 /// <param name="roleId">role represented by the enum</param>
 public User(int id, string name, string username, int roleId)
 {
     this.Id = id;
     this.Name = name;
     this.Username = username;
     Role = (RoleType)roleId;
 }
开发者ID:marouanopen,项目名称:ICT4Reals,代码行数:14,代码来源:User.cs


示例2: Create

 public static PaperLetter Create(int creatingPersonId, int organizationId, string fromName,
     string[] replyAddressLines, DateTime receivedDate, int toPersonId, RoleType toPersonInRole, bool personal)
 {
     return FromIdentity(SwarmDb.GetDatabaseForWriting().
         CreatePaperLetter(organizationId, fromName, String.Join("|", replyAddressLines),
                           receivedDate, toPersonId, toPersonInRole, personal, creatingPersonId));
 }
开发者ID:SwarmCorp,项目名称:Swarmops,代码行数:7,代码来源:PaperLetter.cs


示例3: AuthorizeRequest

        public bool AuthorizeRequest(HttpContext httpContext, RoleType minimumRoleType)
        {
            try
            {
                // If global admin services, authentication was handled by IIS
                if (ServiceContext.IsAdminServiceHost)
                    return HttpContext.Current.User.Identity.IsAuthenticated;

                // Attempt to obtain token from request
                var token = ExtractAuthorizationToken(httpContext.Request);

                if (token != null)
                {
                    // Create a user context from the token
                    var userContext = CreateUserContextFromToken(httpContext, token, minimumRoleType);

                    if (userContext != null)
                    {
                        // Add token to HTTP context for future reference
                        HttpContext.Current.Items.Add(CommonParameters.UserContext, userContext);
                        return true;
                    }
                }
            }
            catch (Exception ex)
            {
                ServiceContext.Logger.Error("Error while authenticating user", ex);
            }

            return false;
        }
开发者ID:rickeygalloway,项目名称:Test,代码行数:31,代码来源:AuthManager.cs


示例4: User

 /// <summary>
 /// constructor
 /// </summary>
 /// <param name="id">id of the user</param>
 /// <param name="name">name of the user</param>
 /// <param name="username">username of the user (represented by email)</param>
 /// <param name="roleId">role represented by the enum</param>
 public User(int id, string name, string username, int roleId)
 {
     Allowedpages = new List<string>();
     this.Id = id;
     this.Name = name;
     this.Username = username;
     Role = (RoleType)roleId;
     if (RoleId == 1)
     {
         Allowedpages.Add("beheer");
         Allowedpages.Add("inuitrij");
         Allowedpages.Add("reparatie");
         Allowedpages.Add("schoonmaak");
     }
     if (RoleId == 2)
     {
         Allowedpages.Add("inuitrij");
     }
     if (RoleId == 3)
     {
         Allowedpages.Add("beheer");
     }
     if (RoleId == 4)
     {
         Allowedpages.Add("reparatie");
     }
     if (RoleId == 5)
     {
         Allowedpages.Add("schoonmaak");
     }
 }
开发者ID:marouanopen,项目名称:ICT4RealsWebForms,代码行数:38,代码来源:User.cs


示例5: ShareDocument

        public DocumentShare ShareDocument(Guid dlId, Guid usId, string message = "", RoleType linkRole = RoleType.Viewer)
        {
            if (dlId.Equals(Guid.Empty))
            {
                throw new ArgumentException("dlId is required but was an empty Guid", "dlId");
            }
            if (usId.Equals(Guid.Empty))
            {
                throw new ArgumentException("dlId is required but was an empty Guid", "usId");
            }

            switch (linkRole)
            {
                case RoleType.Owner:
                case RoleType.Editor:
                    linkRole = RoleType.Editor;
                    break;
                default:
                    linkRole = RoleType.Viewer;
                    break;
            }

            dynamic postData = new ExpandoObject();
            postData.users = usId;
            postData.message = message;
            postData.baseUrl = ShareUrl;
            postData.isPublic = "true";
            postData.linkRole = linkRole.ToString().ToLower();

            return HttpHelper.Put<DocumentShare>(VVRestApi.GlobalConfiguration.Routes.DocumentsIdShares, "", GetUrlParts(), this.ClientSecrets, this.ApiTokens, postData, dlId, usId);
        }
开发者ID:kcruzado,项目名称:csdotnet-rest-client-library,代码行数:31,代码来源:DocumentShareManager.cs


示例6: AddRoleSyncRoot

        private object AddRoleSyncRoot(RoleType roleType)
        {
            var roleSyncRoot = new object();

            RoleSyncRoots.Add(roleType, roleSyncRoot);

            return roleSyncRoot;
        }
开发者ID:bhaktapk,项目名称:com-prerit,代码行数:8,代码来源:RoleService.cs


示例7: BasicPersonRole

 /// <summary>
 /// Normal constructor.
 /// </summary>
 /// <param name="personId">The person Id.</param>
 /// <param name="roleType">The node-specific role.</param>
 /// <param name="organizationId">The organization Id.</param>
 /// <param name="geographyId">The node Id.</param>
 public BasicPersonRole (int roleId, int personId, RoleType type, int organizationId, int geographyId)
 {
     this.roleId = roleId;
     this.personId = personId;
     this.type = type;
     this.organizationId = organizationId;
     this.geographyId = geographyId;
 }
开发者ID:SwarmCorp,项目名称:Swarmops,代码行数:15,代码来源:BasicPersonRole.cs


示例8: ParseRoleType_ReturnsCorrectString

        public void ParseRoleType_ReturnsCorrectString(RoleType roleType, string expected)
        {
            //act
            var result = EnumFactory.ParseRoleType(roleType);

            //assert
            result.Should().Be(expected);
        }
开发者ID:letmeproperty,项目名称:Applications,代码行数:8,代码来源:EnumFactory_TestFixture.cs


示例9: BusinessAccount

        /// <summary>
        /// Gets the business account for an Id.
        /// It will return one entity as an IQueryable for performance.
        /// Returns null if the user does not have access to the BusinessAccount.
        /// </summary>
        /// <param name="coreEntitiesContainer">The core entities container.</param>
        /// <param name="businessAccountId">The businessAccount Id.</param>
        /// <param name="allowedRoleTypes">Return null if the user does not have access to one of these role types.</param>
        public static IQueryable<BusinessAccount> BusinessAccount(this CoreEntitiesContainer coreEntitiesContainer, Guid businessAccountId, RoleType[] allowedRoleTypes)
        {
            var ownerParty = from role in RolesCurrentUserHasAccessTo(coreEntitiesContainer, allowedRoleTypes)
                             where role.OwnerBusinessAccountId == businessAccountId
                             select role.OwnerBusinessAccount;

            return ownerParty;
        }
开发者ID:FoundOPS,项目名称:server,代码行数:16,代码来源:AuthenticationLogic.cs


示例10: EnumHelper_Parse_ReturnsCorrectEnum

        public void EnumHelper_Parse_ReturnsCorrectEnum(string value, RoleType roleType)
        {
            //act
            var result = EnumHelper<RoleType>.Parse(value);

            //assert
            result.Should().Be(roleType);
        }
开发者ID:letmeproperty,项目名称:Applications,代码行数:8,代码来源:EnumHelper_TestFixture.cs


示例11: PrintGeography

    string PrintGeography (Geography geo)
    {
        StringBuilder sbl = new StringBuilder();
        RoleType[] rolesToShow = new RoleType[] { RoleType.OrganizationChairman, RoleType.OrganizationVice1, RoleType.OrganizationSecretary, RoleType.LocalLead, RoleType.LocalDeputy };
        Organizations orgs = Organizations.GetOrganizationsAvailableAtGeography(geo.Identity);
        foreach (Organization org in orgs)
        {
            Dictionary<int, bool> listedPersons = new Dictionary<int, bool>();
            if (org.IsOrInherits(Organization.UPSEid))
            {
                if (org.AnchorGeographyId == geo.Identity || org.UptakeGeographies.Contains(geo))
                {
                    RoleLookup officers = RoleLookup.FromOrganization(org);
                    bool foundRole = false;
                    foreach (RoleType rt in rolesToShow)
                    {
                        foundRole |= officers[rt].Count > 0;
                        if (foundRole) break;
                    }

                    if (foundRole)
                    {
                        sbl.Append("<br><br><b>" + HttpUtility.HtmlEncode(org.Name) + ":</b>");
                        foreach (RoleType rt in rolesToShow)
                            foreach (Activizr.Logic.Pirates.PersonRole r in officers[rt])
                            {
                                if (!listedPersons.ContainsKey(r.PersonId))
                                {
                                    sbl.Append(PrintOfficer(r));
                                    listedPersons[r.PersonId] = true;
                                }
                            }

                        sbl.Append("<br>");
                    }
                }
            }
            else
            {
                RoleLookup officers = RoleLookup.FromGeographyAndOrganization(geo, org);

                if (officers[RoleType.LocalLead].Count > 0 || officers[RoleType.LocalDeputy].Count > 0)
                {
                    sbl.Append("<br><br><b>" + HttpUtility.HtmlEncode(org.Name) + ", " + HttpUtility.HtmlEncode(geo.Name) + ":</b>");
                    foreach (RoleType rt in rolesToShow)
                        foreach (Activizr.Logic.Pirates.PersonRole r in officers[rt])
                            if (!listedPersons.ContainsKey(r.PersonId))
                            {
                                sbl.Append(PrintOfficer(r));
                                listedPersons[r.PersonId] = true;
                            }

                    sbl.Append("<br>");
                }
            }
        }
        return sbl.ToString();
    }
开发者ID:SwarmCorp,项目名称:Swarmops,代码行数:58,代码来源:GeographyOfficers.aspx.cs


示例12: HasAnyRole

 public bool HasAnyRole(RoleType[] types)
 {
     foreach (var role in types)
     {
         if (HasRole(role))
             return true;
     }
     return false;
 }
开发者ID:LordBlacksun,项目名称:Allegiance-Community-Security-System,代码行数:9,代码来源:Login.cs


示例13: Create

		public virtual ViewResult Create(RoleType roleType)
		{
			if(roleType != RoleType.Admin && roleType != RoleType.Broker && roleType != RoleType.Manager)
			{
				throw new NotSupportedException();
			}

			return View();
		}
开发者ID:UHgEHEP,项目名称:test,代码行数:9,代码来源:UserController.cs


示例14: GetRoleByType

 public Role GetRoleByType(RoleType type)
 {
     using (var db = new BlogContext())
     {
         return (from p in db.Roles
         where p.Type == type
         select p).FirstOrDefault();
     }
 }
开发者ID:pabloperfalc,项目名称:TallerDiseno,代码行数:9,代码来源:RoleDataAccess.cs


示例15: IsInRole

        public static bool IsInRole(this IPrincipal principal, RoleType roleType)
        {
            if (principal == null)
            {
                throw new ArgumentNullException("principal");
            }

            return principal.IsInRole(Enum.GetName(typeof(RoleType), roleType));
        }
开发者ID:bhaktapk,项目名称:com-prerit,代码行数:9,代码来源:IPrincipalExtensions.cs


示例16: CheckRole

 /// <summary>
 /// 检验当前登录用户的权限
 /// </summary>
 /// <param name="role"></param>
 /// <returns></returns>
 public bool CheckRole(RoleType role)
 {
     AdminUser user = GetUser();
     CommonLoger.Info(role.ToString() + user.RoleType.ToString());
     if (user == null || (int)user.RoleType != (int)role)
         return false;
     else
         return true;
 }
开发者ID:sclynton,项目名称:CrazyBull,代码行数:14,代码来源:CheckLogin.cs


示例17: GetRole

        public Role GetRole(RoleType roleType)
        {
            if (!Enum.IsDefined(typeof(RoleType), roleType))
            {
                throw new ArgumentOutOfRangeException("roleType");
            }

            return _cache[CreateRoleKey(roleType)] as Role;
        }
开发者ID:bhaktapk,项目名称:com-prerit,代码行数:9,代码来源:CacheService.cs


示例18: CanModify

		public bool CanModify(RoleType userRole, RoleType editUserRole)
		{
			var canModify = (userRole == RoleType.DvsSuperAdmin || userRole == RoleType.DvsAdmin);
			if (userRole != RoleType.DvsSuperAdmin && editUserRole == RoleType.DvsSuperAdmin)
			{
				canModify = false;
			}

			return canModify;
		}
开发者ID:evkap,项目名称:DVS,代码行数:10,代码来源:DVSViewEditController.cs


示例19: GetAliveItemIndex

 //获取存活物体索引号
 public List<int> GetAliveItemIndex(RoleType type)
 {
     List<int> alive = new List<int>();
     for (int i = 0; i < BattleRoleList.Count; i++) {
         if (BattleRoleList[i].roleType == type && BattleRoleList[i].hp > 0) {
             alive.Add(i);
         }
     }
     return alive;
 }
开发者ID:JudyPhy,项目名称:JudyPhy-Project,代码行数:11,代码来源:BattleMgr.cs


示例20: GetFakeUser

 public static ICurrentUser GetFakeUser(RoleType roleType)
 {
     return new CurrentUser()
     {
         Role = roleType,
         Name = "name",
         ServicerId = 1,
         OrganizationId = 2
     };
 }
开发者ID:mharen,项目名称:service-tracker,代码行数:10,代码来源:Statics.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# RoleViewModel类代码示例发布时间:2022-05-24
下一篇:
C# RoleStore类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap