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


C# RoleType.ToString方法代码示例

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


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

示例1: 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

示例2: 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

示例3: ShareDocument

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

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

            var jarray = new JArray();
            foreach (var usId in usIdList)
            {
                jarray.Add(new JObject(new JProperty("id", usId)));
            }

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

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

示例4: AddPythonRoleCore

        /// <summary>
        /// Adds the given role to both config files and the service def.
        /// </summary>
        /// <param name="role"></param>
        private void AddPythonRoleCore(RoleInfo role, RoleType type)
        {
            Dictionary<string, object> parameters = CreateDefaultParameters(role);

            string scaffoldPath = Path.Combine(Path.Combine(scaffoldingFolderPath, Resources.PythonScaffolding), type.ToString());
            Scaffold.GenerateScaffolding(scaffoldPath, Path.Combine(Paths.RootPath, role.Name), parameters);
        }
开发者ID:jasonnewyork,项目名称:azure-sdk-tools,代码行数:11,代码来源:CloudServiceProject.cs

示例5: AddRoleCore

        /// <summary>
        /// Adds the given role to both config files and the service def.
        /// </summary>
        private void AddRoleCore(String Scaffolding, RoleInfo role, RoleType type)
        {
            Dictionary<string, object> parameters = CreateDefaultParameters(role);
            parameters[ScaffoldParams.NodeModules] = General.GetNodeModulesPath();
            parameters[ScaffoldParams.NodeJsProgramFilesX86] = General.GetWithProgramFilesPath(Resources.NodeProgramFilesFolderName, false);

            string scaffoldPath = Path.Combine(Path.Combine(scaffoldingFolderPath, Scaffolding), type.ToString());
            Scaffold.GenerateScaffolding(scaffoldPath, Path.Combine(Paths.RootPath, role.Name), parameters);
        }
开发者ID:nickchal,项目名称:pash,代码行数:12,代码来源:AzureService.cs

示例6: GeneratePerson

    private void GeneratePerson (XmlElement thisNode, RoleType role, Person lead)
    {
        XmlElement officerNode = thisNode.OwnerDocument.CreateElement("OFFICER");
        thisNode.AppendChild(officerNode);

        officerNode.SetAttribute("personid", lead.PersonId.ToString());
        officerNode.SetAttribute("type", role.ToString());
        if (localCall)
        {
            officerNode.SetAttribute("email", lead.PartyEmail);
            officerNode.SetAttribute("phone", lead.Phone);
            officerNode.InnerText = lead.Name;
        }
        else
        {
            officerNode.SetAttribute("email", "[email protected]");
            officerNode.SetAttribute("phone", "12345678");
            officerNode.InnerText = "Hidden for remote call(" + lead.PersonId.ToString() + ")";
        }
    }
开发者ID:SwarmCorp,项目名称:Swarmops,代码行数:20,代码来源:Ansvariga.aspx.cs

示例7: InitTestUsers

		private void InitTestUsers(RoleType currentUserRole)
		{
			IPrincipal user = Substitute.For<IPrincipal>();
			IIdentity identity = Substitute.For<IIdentity>();
			user.Identity.Returns(identity);
			user.Identity.Name.Returns(CurrentUserLogin);
			user.IsInRole(Arg.Is<string>(p => p == currentUserRole.ToString())).Returns(true);
			ViewContext.HttpContext.User.ReturnsForAnyArgs(user);
			Target.SetFakeControllerContext(ViewContext.HttpContext);

			UsersManagement.GetByEmail(CurrentUserLogin).Returns(new User()
			{
				Email = CurrentUserLogin,
				Roles = new Role[] { new Role() { Id = (int)currentUserRole } }
			});
		}
开发者ID:evkap,项目名称:DVS,代码行数:16,代码来源:UserChangePasswordControllerTest.cs

示例8: CreateGroup

        /// <summary>
        /// Create group if it's not existed
        /// </summary>
        /// <param name="collGroup"></param>
        /// <param name="groupName"></param>
        /// <param name="oWebsite"></param>
        /// <param name="clientContext"></param>
        /// <param name="roleType"></param>
        /// <param name="users"></param>
        private static void CreateGroup(GroupCollection collGroup, string groupName, Web oWebsite, ClientContext clientContext, RoleType roleType, List<FieldUserValue> users)
        {
            try
            {
                Group grp = collGroup.Where(g => g.Title == groupName).FirstOrDefault();
                oWebsite.BreakRoleInheritance(true, false);
                if (grp == null)
                {
                    GroupCreationInformation groupCreationInfo = new GroupCreationInformation();
                    groupCreationInfo.Title = groupName;
                    groupCreationInfo.Description = "Use this group to grant people " + roleType.ToString() + " permissions to the SharePoint site: " + oWebsite.Title;
                    grp = oWebsite.SiteGroups.Add(groupCreationInfo);
                    //clientContext.Load(grp);
                    //clientContext.ExecuteQuery();
                }
                // grant role to group
                RoleDefinitionBindingCollection collRoleDefinitionBinding = new RoleDefinitionBindingCollection(clientContext);
                RoleDefinition oRoleDefinition = oWebsite.RoleDefinitions.GetByType(roleType);
                collRoleDefinitionBinding.Add(oRoleDefinition);
                oWebsite.RoleAssignments.Add(grp, collRoleDefinitionBinding);
                clientContext.Load(grp, group => group.Title);
                clientContext.Load(oRoleDefinition, role => role.Name);
                clientContext.ExecuteQuery();

                // Add users to newly created group or existing group
                AddUsertoGroup(grp, clientContext, users);
            }
            catch (Exception e)
            {
                Console.Write(e.Message);

            }
        }
开发者ID:nganbui,项目名称:SP,代码行数:42,代码来源:RERProjectStatement.svc.cs

示例9: GetPlayerKey

 public static string GetPlayerKey(RoleType roleType, string keyPostfix)
 {
     return string.Format("{0}_{1}", roleType.ToString().ToLower(), keyPostfix);
 }
开发者ID:justinccdev,项目名称:waterwars,代码行数:4,代码来源:ConfigurationParser.cs

示例10: AddRoleCore

        /// <summary>
        /// Adds the given role to both config files and the service def.
        /// </summary>
        /// <param name="role"></param>
        private void AddRoleCore(RoleInfo role, RoleType type)
        {
            Dictionary<string, object> parameters = new Dictionary<string, object>();
            parameters[ScaffoldParams.Role] = role;
            parameters[ScaffoldParams.Components] = Components;
            parameters[ScaffoldParams.RoleName] = role.Name;
            parameters[ScaffoldParams.InstancesCount] = role.InstanceCount;
            parameters[ScaffoldParams.Port] = Components.GetNextPort();
            parameters[ScaffoldParams.Paths] = Paths;
            parameters[ScaffoldParams.NodeModules] = General.GetNodeModulesPath();

            string scaffoldPath = Path.Combine(Path.Combine(scaffoldingFolderPath, Resources.NodeScaffolding), type.ToString());
            Scaffold.GenerateScaffolding(scaffoldPath, Path.Combine(Paths.RootPath, role.Name), parameters);
        }
开发者ID:glennblock,项目名称:azure-sdk-tools,代码行数:18,代码来源:AzureService.cs

示例11: CreateRole

        public int CreateRole (int personId, RoleType roleType, int organizationId, int nodeId)
        {
            using (DbConnection connection = GetMySqlDbConnection())
            {
                connection.Open();

                DbCommand command = GetDbCommand("CreatePersonRole", connection);
                command.CommandType = CommandType.StoredProcedure;

                AddParameterWithName(command, "personId", personId);
                AddParameterWithName(command, "personRoleType", roleType.ToString());
                AddParameterWithName(command, "organizationId", organizationId);
                AddParameterWithName(command, "geographyId", nodeId);

                return Convert.ToInt32(command.ExecuteScalar());
            }
        }
开发者ID:SwarmCorp,项目名称:Swarmops,代码行数:17,代码来源:Database-Roles.cs

示例12: GetPeopleWithRoleType

        public BasicPersonRole[] GetPeopleWithRoleType (RoleType r, int[] orgId, int[] geoId)   // TODO: Refactor to use ConstructWhereClause
        {
            List<BasicPersonRole> retlist = new List<BasicPersonRole>();
            using (DbConnection connection = GetMySqlDbConnection())
            {
                connection.Open();
                string cmd = "SELECT " + personRoleFieldSequence + " WHERE Name= '" + r.ToString()+"'";
                if (orgId.Length > 0)
                    cmd += " AND OrganzationId IN (" + JoinIds(orgId) + ")";
                if (geoId.Length > 0)
                    cmd += " AND GeographyId IN (" + JoinIds(geoId) + ")";

                DbCommand command = GetDbCommand(cmd, connection);

                using (DbDataReader reader = command.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        retlist.Add(ReadPersonRoleFromDataReader(reader));
                    }
                }
            }
            return retlist.ToArray();
        }
开发者ID:SwarmCorp,项目名称:Swarmops,代码行数:24,代码来源:Database-Roles.cs

示例13: InitTestUser

		private void InitTestUser(RoleType currentUserRole, string login)
		{
			IPrincipal user = Substitute.For<IPrincipal>();
			IIdentity identity = Substitute.For<IIdentity>();
			user.Identity.Returns(identity);
			user.Identity.Name.Returns(login);
			user.IsInRole(Arg.Is<string>(p => p == currentUserRole.ToString())).Returns(true);
			ViewContext.HttpContext.User.ReturnsForAnyArgs(user);
			Target.SetFakeControllerContext(ViewContext.HttpContext);
		}
开发者ID:evkap,项目名称:DVS,代码行数:10,代码来源:AppraiserProfileControllerTest.cs


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