當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。