本文整理汇总了C#中Actions.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Actions.ToString方法的具体用法?C# Actions.ToString怎么用?C# Actions.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Actions
的用法示例。
在下文中一共展示了Actions.ToString方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Init
/**
* Overload for Attack Action
*/
public void Init(int type, int attackerId, int targetId)
{
actionType = (Actions)type;
Debug.Log(actionType.ToString());
this.unitId = attackerId;
this.targetId = targetId;
}
示例2: AddAction
public void AddAction(Actions action, object attribute)
{
_currentActions.Add(new ReverseActionValue()
{
_PerformedAction = action,
_ActionAttribute = attribute
});
if (attribute is string)
log.DebugFormat("Inserted rollback action {0} with attribute {1} in the event of failure", action.ToString(), attribute.ToString());
}
示例3: SetParams
public static string SetParams(string listAsmx, Actions action, string listName)
{
return string.Format("{0}?TOOLNAME=ADMIN&ACTION={1}&LISTNAME={2}",
listAsmx, action.ToString(), listName);
}
示例4: StartAction
public bool StartAction(User u, Sections s, Actions a)
{
if (u != null)
{
if (!cHash.ContainsKey(s.ToString()+a.ToString()))
{
ConcurrencyStruct cstruct = new ConcurrencyStruct();
cstruct.user = u;
cstruct.lastHit = DateTime.Now;
cstruct.section = s;
cstruct.action = a;
cHash[s.ToString()+a.ToString()] = cstruct;
return true;
}
else
{
if (s == Sections.ADMIN)
{
return false; // another user is inside administrator
}
return true;
}
}
else
{
throw new NullReferenceException();
}
}
示例5: EndAction
public bool EndAction(User u, Sections s, Actions a)
{
if (u != null)
{
if (cHash.ContainsKey(s.ToString()+a.ToString()))
{
cHash.Remove(s.ToString()+a.ToString());
return true;
}
else
{
return false; // something is wrong
}
}
else
{
throw new NullReferenceException();
}
}
示例6: TrackEvent
public void TrackEvent(Actions action, Categories category, string description, int? value)
{
if (!ReportingAnalytics) return;
var e = AnalyticsEvent.Create(category.ToString(), action.ToString(), description, value);
e.Track();
}
示例7: Details
public ActionResult Details(object id, DetailsViewModel model, Actions formAction = Actions.ViewDetail)
{
switch (formAction)
{
case Actions.ViewDetail:
var user = _providerMembership.GetUserByGuid(Guid.Parse((string)id), false).Data;
var userRoles = _providerRoles.FindByUserName(user.UserName);
model = new DetailsViewModel()
{
UserOriginal = user,
UserUpdated = user,
UserRoles = userRoles.Data,
Roles = _providerRoles.FindAll().Data
};
break;
case Actions.Approve:
model = this.Details_ChangeAproval(model, model.UserOriginal, true);
break;
case Actions.UnApprove:
model = this.Details_ChangeAproval(model, model.UserOriginal, false);
break;
case Actions.UnLock:
model = this.Details_UnLock(model, model.UserOriginal, formAction);
break;
case Actions.Delete:
DataResultBoolean result = _providerMembership.DeleteUser(model.UserOriginal.UserName, true);
if (result.Data)
{
return Redirect(UrlHelperUserAdmin.UserAdminIndex(Url));
}
else
{
ModelState.AddModelError(formAction.ToString(), result.Message);
}
break;
case Actions.Update:
//update roles
this.Details_UpdateRoles(model, Actions.Update);
//update comment
model.UserOriginal.Comment = model.UserUpdated.Comment;
model = this.Details_Update(model, model.UserOriginal, formAction);
break;
default:
break;
}
model.BaseViewModelInfo.Title = GeneralTexts.UserAdmin;
model.BaseViewModelInfo.Breadcrumb.IsVisible = true;
model.BaseViewModelInfo.Breadcrumb.BreadcrumbPaths.AddRange(new List<KeyValuePair<string, string>>() {
new KeyValuePair<string, string>(UserAdminTexts.UserSearch, Url.UserAdminIndex())
});
return View(model);
}
示例8: Details_UpdateRoles
private DetailsViewModel Details_UpdateRoles(DetailsViewModel model, Actions formAction)
{
DataResultBoolean result;
model.UserRoles = model.UserRoles == null ? new string[0] : model.UserRoles;
if (model.UserRoles != null && model.UserRoles.Count() > 0)
{
result = _providerRoles.AddToRoles(model.UserOriginal.UserName, model.UserRoles.ToArray());
if (!result.Data)
{
ModelState.AddModelError(formAction.ToString(), result.Message);
}
}
string[] rolesToRemove = model.Roles.Where(r => !model.UserRoles.Contains(r)).ToArray();
if (rolesToRemove != null && rolesToRemove.Count() > 0)
{
result = _providerRoles.RemoveFromRoles(model.UserOriginal.UserName, rolesToRemove);
if (!result.Data)
{
ModelState.AddModelError(formAction.ToString(), result.Message);
}
}
return model;
}
示例9: Details_Update
private DetailsViewModel Details_Update(DetailsViewModel model, MembershipUserWrapper user, Actions formAction)
{
DataResultBoolean result = this._providerMembership.UpdateUser(user);
if (result.Data)
{
model.ResultLastAction = new DataResultBoolean()
{
IsValid = true,
MessageType = DataResultMessageType.Success,
Message = result.Message
};
}
else
{
ModelState.AddModelError(formAction.ToString(), result.Message);
}
return model;
}
示例10: Details_UnLock
private DetailsViewModel Details_UnLock(DetailsViewModel model, MembershipUserWrapper user, Actions formAction)
{
DataResultBoolean result = this._providerMembership.UnlockUser(user.UserName);
if (result.Data)
{
model.UserOriginal.IsLockedOut = false;
model.ResultLastAction = new DataResultBoolean()
{
IsValid = true,
MessageType = result.MessageType,
Message = result.Message
};
}
else
{
ModelState.AddModelError(formAction.ToString(), result.Message);
}
return model;
}
示例11: display_turn
public void display_turn(Actions action, int amount, bool is_call)
{
if (!is_call
&& action == Actions.CALL)
{
Console.Write("{0} {1}s", name, "Check");
}
else
{
Console.Write("{0} {1}s", name, action.ToString().ToLower());
}
// Jimmy fold; John raise; John bet;
if (action == Actions.BET)
{
Console.WriteLine(" ${0}", amount);
}
else if (action == Actions.RAISE)
{
Console.WriteLine(" by ${0}", amount);
}
else
{
Console.WriteLine();
}
}
示例12: RollbackADAction
private void RollbackADAction(Actions action, object[] attribute)
{
OrganizationalUnits org = null;
Groups grp = null;
Users usr = null;
try
{
log.DebugFormat("Rolling back action {0}...", action.ToString());
switch (action)
{
case Actions.CreateOrganizationalUnit:
org = new OrganizationalUnits(Settings.Username, Settings.DecryptedPassword, Settings.PrimaryDC);
org.Delete(attribute[0].ToString(), true);
log.DebugFormat("Successfully rolled back action {0} at path {1}", action.ToString(), attribute.ToString());
break;
case Actions.CreateSecurityGroup:
grp = new Groups(Settings.Username, Settings.DecryptedPassword, Settings.PrimaryDC);
grp.Delete(attribute[0].ToString());
log.DebugFormat("Successfully rolled back action {0} for group {1}", action.ToString(), attribute.ToString());
break;
case Actions.AddDomains:
org = new OrganizationalUnits(Settings.Username, Settings.DecryptedPassword, Settings.PrimaryDC);
org.RemoveDomains(attribute[0].ToString(), new string[] { attribute[1].ToString() });
log.DebugFormat("Successfully rolled back action {0} for org {1}", action.ToString(), attribute[0]);
break;
default:
log.DebugFormat("Unknown action {0}... Skipping...", action.ToString());
break;
}
}
catch (Exception ex)
{
log.ErrorFormat("Failed to rollback action {0}. Exception: {1}", action.ToString(), ex.ToString());
}
finally
{
if (usr != null)
usr.Dispose();
if (grp != null)
grp.Dispose();
if (org != null)
org.Dispose();
}
}