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


C# AccessLevel.ToString方法代码示例

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


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

示例1: HasAccessLevel

 public static void HasAccessLevel(int id, AccessLevel accessLevel)
 {
     string uriTemplate = _baseAddress + "/odata/HasAccessLevel(ID={0},AccessLevel={1}'{2}')";
     string requestUri = string.Format(uriTemplate, id, typeof(AccessLevel).FullName, accessLevel.ToString());
     using (HttpResponseMessage response = _httpClient.GetAsync(requestUri).Result)
     {
         response.EnsureSuccessStatusCode();
         JObject result = response.Content.ReadAsAsync<JObject>().Result;
         Console.WriteLine("\nEmployee with ID '{0}' has access level '{1}': ", id, accessLevel.ToString());
         Console.WriteLine(result);
     }
 }
开发者ID:nickgoodrow,项目名称:ODataSamples,代码行数:12,代码来源:Program.cs

示例2: QueryEmployeesByAccessLevel

        public static void QueryEmployeesByAccessLevel(AccessLevel accessLevel)
        {
            string uriTemplate = _baseAddress + "/odata/Employees?$filter=AccessLevel has {0}'{1}'";
            string uriHas = string.Format(uriTemplate, typeof(AccessLevel).FullName, accessLevel.ToString());

            using (HttpResponseMessage response = _httpClient.GetAsync(uriHas).Result)
            {
                response.EnsureSuccessStatusCode();
                JObject result = response.Content.ReadAsAsync<JObject>().Result;
                Console.WriteLine("\nEmployees who has the access level '{0}' are:", accessLevel.ToString());
                Console.WriteLine(result);
            }
        }
开发者ID:andreychizhov,项目名称:microsoft-aspnet-samples,代码行数:13,代码来源:Program.cs

示例3: AddAccessLevel

        public static void AddAccessLevel(int id, AccessLevel accessLevel)
        {
            var requestUri = _baseAddress + string.Format("/odata/Employees({0})/{1}.AddAccessLevel", id, _namespace);
            string body = string.Format(@"{{'AccessLevel':'{0}'}}", accessLevel.ToString());
            JObject postContent = JObject.Parse(body);

            using (HttpResponseMessage response = _httpClient.PostAsJsonAsync(requestUri, postContent).Result)
            {
                response.EnsureSuccessStatusCode();
                JObject result = response.Content.ReadAsAsync<JObject>().Result;
                Console.WriteLine("\nThe new access level of employee with ID '{0}' is:", id);
                Console.WriteLine(result);
            }
        }
开发者ID:nickgoodrow,项目名称:ODataSamples,代码行数:14,代码来源:Program.cs

示例4: HasPermission

 public virtual bool HasPermission(AccessLevel permission)
 {
     return HasRight(permission.ToString());
 }
开发者ID:xwyangjshb,项目名称:cuyahoga,代码行数:4,代码来源:Role.cs

示例5: UpdateAccessLevel

 internal void UpdateAccessLevel(string p, AccessLevel accessLevel)
 {
     this.cache[p] = accessLevel.ToString();
 }
开发者ID:theterminator3000,项目名称:fmb,代码行数:4,代码来源:SessionsCollection.cs

示例6: InsertNewSessionImpl

 internal void InsertNewSessionImpl(string newSessionId, AccessLevel al)
 {
     this.cache[newSessionId] = al.ToString();
 }
开发者ID:theterminator3000,项目名称:fmb,代码行数:4,代码来源:SessionsCollection.cs

示例7: GetArgInt

        private static int GetArgInt(Mobile from, string pattern, string args, AccessLevel accessLevel, int defaultValue)
        {   // sanity
            if (from == null || pattern == null)
                return 0;

            // check access
            if (from.AccessLevel < accessLevel)
            {
                from.SendMessage("You must have {0} access to use the {1} switch.", accessLevel.ToString(), pattern);
                return defaultValue;
            }

            // all int switches MUST be exactly of the form "-x=nn" where nn is the int portion. no spaces allowed
            try
			{	// extract the integer argument from the arg-string.
				string argID = String.Format("{0}=", pattern);
				int startIndex = args.IndexOf(argID);
                if (startIndex == -1) throw new ApplicationException();
				int whiteIndex = args.IndexOf(' ',startIndex);
				int intStart = startIndex + pattern.Length + 1;
				string argVal = (whiteIndex == -1) ? args.Substring(intStart) : args.Substring(intStart, whiteIndex - argID.Length);
                int param;
				if (int.TryParse(argVal, out param) == false)
                    throw new ApplicationException();
                else
                    return param;
            }
            catch // no logging here
            {
                from.SendMessage("Poorly formed {0} switch.", pattern);
                return defaultValue;
            }
        }
开发者ID:zerodowned,项目名称:angelisland,代码行数:33,代码来源:WealthTracker.cs

示例8: GetProjectUsers

 ///<summary>
 /// Get appropriate users assigned to a project by access level.
 ///</summary>
 /// <exception cref="MCException"></exception>
 public IList<IAccount> GetProjectUsers(long projectId, AccessLevel access)
 {
     var mc = CreateMantisClientProxyInstance();
     try
     {
         AccountData[] data = mc.mc_project_get_users(Username, Password, projectId.ToString(), access.ToString());
         IList<IAccount> result = new List<IAccount>();
         foreach (var item in data)
         {
             result.Add(new Account(item));
         }
         return result;
     }
     catch (Exception ex)
     {
         throw new MCException(String.Format("Could not get project users for project {0}", projectId), ex);
     }
     finally
     {
         mc.CloseSafely();
     }
 }
开发者ID:kfalconer,项目名称:mantisconnect,代码行数:26,代码来源:Session.cs

示例9: FinishTarget

			private void FinishTarget( Mobile m, Mobile from, AccessLevel level )
			{
				Account acct = m.Account as Account;

				if( acct != null )
					acct.AccessLevel = level;

				m.AccessLevel = level;

				from.SendMessage( String.Format( "The accesslevel for {0} has been changed to {1}.", m.RawName, level.ToString() ) );
			}
开发者ID:greeduomacro,项目名称:hubroot,代码行数:11,代码来源:ChangeAccessLevel.cs


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