本文整理汇总了C#中Enums.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Enums.ToString方法的具体用法?C# Enums.ToString怎么用?C# Enums.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Enums
的用法示例。
在下文中一共展示了Enums.ToString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Button
public static MvcHtmlString Button(string caption, Enums.ButtonStyle style, Enums.ButtonSize size)
{
if (size != Enums.ButtonSize.Normal)
{
return new MvcHtmlString(string.Format("<button type=\"button\" class=\"btn btn-{0} btn-{1}\">{2}</button>", style.ToString().ToLower(), ToBootstrapSize(size), caption));
}
return new MvcHtmlString(string.Format("<button type=\"button\" class=\"btn btn-{0}\">{1}</button>", style.ToString().ToLower(), caption));
}
示例2: getLocalizationTextFromKey
public static string getLocalizationTextFromKey(string key, Enums.Language locLanguage)
{
string locText = "";
if (_localizationData.keys.IndexOf (key) == -1)
{
return key;
}
else
{
JSONObject obj = _localizationData.list[_localizationData.keys.IndexOf(key)];
if(obj[locLanguage.ToString ()]) { locText = obj[locLanguage.ToString()].ToString (); }
else {locText = key; }
return locText;
}
}
示例3: CheckPrivilege
public static bool CheckPrivilege(Page page, Enums.ModuleKey moduleKey, Enums.Privilege enPriv)//,object privilegeTable
{
DataTable dt = page.Session["AdminFunction"] as DataTable;
try
{
//if ((page.Session["Users"] as NT.Entities.User).IsSuperManager == "yes")//如果是超级管理员
// return true;
}
catch
{
page.Response.Write("<script>parent.location='" + page.ResolveUrl("~/Admin/Login.aspx") + "'</script>");
return false;
}
if (dt.Rows.Count == 0)
{
page.Response.Redirect("~/Admin/NoRights.aspx");
return false;
}
DataRow[] rows = dt.Select(string.Format("ModuleKey='{0}' and PrivilegeId={1}",moduleKey.ToString(),(int)enPriv));
if (rows != null && rows.Length > 0)
{
return true;
}
else
{
page.Response.Redirect("~/Admin/NoRights.aspx");
return false;
}
}
示例4: IsHavePrivilege
public static bool IsHavePrivilege(long userId, Enums.ModuleKey moduleKey, Enums.Privilege enPriv)
{
DataSet ds = SqlHelper.ExecuteDataSet(CommandType.StoredProcedure, "sp_CheckPrivilege", new SqlParameter[] {
new SqlParameter("@CustomerId", userId),
new SqlParameter("@ModuleKey", moduleKey.ToString()),
new SqlParameter("@PrivilegeId", (int)enPriv)});
if (ds != null && ds.Tables.Count > 0)
{
return ConvertTool.ToBool(ds.Tables[0].Rows[0][0]);
}
return false;
}
示例5: BootstrapButton
public static MvcHtmlString BootstrapButton(this HtmlHelper helper, string caption, Enums.ButtonType type,
Enums.ButtonStyle style, Enums.ButtonSize size)
{
var format = "";
if (type == Enums.ButtonType.Button)
{
format = "<button type=\"button\" class=\"btn btn-{0} {1}\">{2}</button>";
}
else if (type == Enums.ButtonType.Submit)
{
format = "<input type=\"submit\" class=\"btn btn-{0} {1}\" value=\"{2}\"/>";
}
return new MvcHtmlString(string.Format(format, style.ToString().ToLower(), ToBootstrapSize(size), caption));
}
示例6: AddArrowType
public void AddArrowType(Enums.Arrows type)
{
if(type > 0 && type < Enums.Arrows.NumTypes)
{
// Find the running timer associated with the type
TokenTimer t = timers.Find(i => i.ID.Equals(type.ToString()));
// If the type has not been added yet
if (t == null)
{
// Add a new Token Timer and initialize it
TokenTimer tt = gameObject.AddComponent<TokenTimer>();
tt.Initialize(TokenTimer.TOKEN_INTERVAL, type.ToString());
// Make sure that the type is removed from the component when the timer times out
tt.TimeOut += new TokenTimer.TimerEvent(RemoveToken);
types = Bitwise.SetBit(types, (int)type);
timers.Add(tt);
}
else
{
// Type has already been added so we just need to reset the timer
t.Reset();
}
}
}
示例7: hasAppPermission
/// <summary>
/// Checks whether the user has opted in to an extended application permission.
/// </summary>
/// <param name="ext_perm">String identifier for the extended permission that is being checked for. Must be one of status_update or photo_upload.</param>
/// <returns>Returns 1 or 0.</returns>
public bool hasAppPermission(Enums.Extended_Permissions ext_perm)
{
var parameterList = new Dictionary<string, string>
{
{"method", "facebook.users.hasAppPermission"},
{"ext_perm", ext_perm.ToString()}
};
var response = _api.SendRequest(parameterList);
return string.IsNullOrEmpty(response) || users_hasAppPermission_response.Parse(response).TypedValue;
}
示例8: BootstrapErrorField
public static MvcHtmlString BootstrapErrorField(this HtmlHelper helper, string id, Enums.MessageFieldStyle style)
{
var format = "<div id=\"{0}\" class=\"alert alert-{1}\" hidden />";
return new MvcHtmlString(string.Format(format, id, style.ToString().ToLower()));
}
示例9: GetEffect
/// <summary>
/// Gets the prefab based on the arrow type.
/// </summary>
/// <param name="type">The type of arrow that needs a prefab.</param>
/// <returns>The appropriate effect for the arrow property.</returns>
public GameObject GetEffect(Enums.Arrows type)
{
return effectPrefabs.Find(x => x.name.StartsWith(type.ToString()));
}
示例10: GetRandomJokeBasedOn
public string GetRandomJokeBasedOn(Enums.Prisoner Prisoner)
{
int PositionToReturn = Random.Range(1,10);
List<string> Joke;
RandomGuyJokes.TryGetValue(Prisoner, out Joke);
if(Joke != null && Joke.Count == 10)
{
Debug.Log("Joke for " + Prisoner.ToString() + " = " + Joke[PositionToReturn]);
return Joke[PositionToReturn];
}
return "JokeNotFound";
}
示例11: WriteOperateLogs
/// <summary>
/// 写后台管理员操作日志
/// </summary>
/// <param name="context"></param>
/// <param name="doType"></param>
/// <param name="module"></param>
/// <param name="summary"></param>
public static void WriteOperateLogs(Enums.Privilege doType,string module,string summary)
{
try
{
// 浏览者操作系统的默认语言
//Request.ServerVariables.Get("HTTP_ACCEPT_LANGUAGE")
//客户端ip:
//Request.ServerVariables.Get("Remote_Addr");
//客户端主机名:
//Request.ServerVariables.Get("Remote_Host");
//服务器ip:
//Request.ServerVariables.Get("Local_Addr");
//服务器名:
//Request.ServerVariables.Get("Server_Name");
//获得用户登陆名
//Request.ServerVariables.Get("LOGON_USER");
HttpContext context = HttpContext.Current;
HttpRequest request = context.Request;
NT.Entities.User user = context.Session["Users"] as NT.Entities.User;
NT.Entities.SystemLogs log = new NT.Entities.SystemLogs();
log.Ip = "Ip:" + request.ServerVariables.Get("Remote_Addr") + " Host:" + request.ServerVariables.Get("Remote_Host") + " Browser:" + getBrowser() + " Agent:" + SystemCheck() + " URL:" + request.RawUrl;
log.Operater = user.UserName;
log.UserId = user.UserId;
log.Summary = summary;
log.Module = module;
log.DoType = doType.ToString();
log.DoTime = System.DateTime.Now;
NT.Data.DataRepository.SystemLogsProvider.Insert(log);
}
catch { }
}
示例12: JABBER_CLIENT_OnError
void JABBER_CLIENT_OnError(Enums.ErrorType type, string message)
{
buttonTestConnection.BackColor = Color.Tomato;
MessageBox.Show(message, "Jabber Error: " + type.ToString(), MessageBoxButtons.OK, MessageBoxIcon.Error);
buttonTestConnection.Enabled = true;
}
示例13: GetSiteListFields
/// <summary>
/// 从多网站表单数据根据网站编码是提取该站字段
/// </summary>
/// <param name="lst"></param>
/// <param name="sitecode">网站编号</param>
/// <returns></returns>
public static List<DbMetaEntity> GetSiteListFields(List<DbMetaEntity> lst, Enums.WebSites sitecode)
{
return GetListFields(lst, sitecode.ToString());
}
示例14: _jabberConnection_ErrorRaised
void _jabberConnection_ErrorRaised(Enums.ErrorType type, string message)
{
Log.Error(String.Format("Jabber error: {0} {1}", type.ToString(), message));
switch (type) {
case Enums.ErrorType.Authentification:
Log.Error("Your jabber username or password is invalid");
break;
case Enums.ErrorType.Server:
Reconnect();
break;
case Enums.ErrorType.Warning:
case Enums.ErrorType.Query:
//do nothing for now
break;
case Enums.ErrorType.Client:
default:
Close();
this._jabberConnection.Dispose();
this._jabberConnection = new nJim.Jabber();
Login();
break;
}
OnError(type, message);
}
示例15: RemoveArrowType
public void RemoveArrowType(Enums.Arrows type)
{
// Clear the appropriate token bit and remove the timer from the list of running timers
types = Bitwise.ClearBit(types, (int) type);
TokenTimer t = timers.Find(i => i.ID.Equals(type.ToString()));
timers.Remove(t);
}