本文整理汇总了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);
}
}
示例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);
}
}
示例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);
}
}
示例4: HasPermission
public virtual bool HasPermission(AccessLevel permission)
{
return HasRight(permission.ToString());
}
示例5: UpdateAccessLevel
internal void UpdateAccessLevel(string p, AccessLevel accessLevel)
{
this.cache[p] = accessLevel.ToString();
}
示例6: InsertNewSessionImpl
internal void InsertNewSessionImpl(string newSessionId, AccessLevel al)
{
this.cache[newSessionId] = al.ToString();
}
示例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;
}
}
示例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();
}
}
示例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() ) );
}