public void Control(string input) { CommandController.Commands command = CommandController.GetCommand(input); switch (command) { case CommandController.Commands.EXIT: this.Running = false; break; case CommandController.Commands.START_NEW_GAME: Console.Write("How much players:"); this.game = new Game(int.Parse(Console.ReadLine())); Console.WriteLine(this.game.ToString()); break; default: break; } }
protected void LoadForCurCommand() { Control control = null; string controlPath = string.Empty; cmd = ConvertUtility.ToString(Request.QueryString["cmd"]); CommandInfo command = null; if (cmd != string.Empty) { command = CommandController.GetCommand(cmd); if (command != null) { lbcmd.Text = command.CommandName; //lblTitle.Text = command.CommandName; } } if (command == null) { controlPath = "/UserControls/WelCome.ascx"; } else if (!CurrentUser.IsSuperAdmin && !CommandController.IsAvailableForUser(command.CommandID, CurrentUser.UserID, ConvertUtility.ToInt32(Request.QueryString["portalid"]))) { controlPath = "/UserControls/AccessDeny.ascx"; } else if (File.Exists(Server.MapPath(command.ControlPath))) { control = LoadAdminControl(command.CommandKey); } if (controlPath != string.Empty) { control = LoadControl(controlPath); } if (control != null) { this.placeControls.Controls.Add(control); } else { lblErrorMessage.Text = "Không tìm thấy module !"; } }
protected void cmdUpdate_Click(object sender, EventArgs e) { try { int commandId = ConvertUtility.ToInt32(txtID.Text); CommandInfo command = CommandController.GetCommand(commandId); if (command == null) { command = CommandController.GetCommandWithoutControlPath(commandId); } command.CommandParams = txtParams.Text; command.CommandUrl = txtUrl.Text; command.CommandParentID = ConvertUtility.ToInt32(dropParent.SelectedValue); command.CommandKey = dropCommandKeys.SelectedValue; command.CommandOrder = ConvertUtility.ToInt32(dropIndex.SelectedValue); command.CommandEnable = chkEnable.Checked; command.CommandVisible = chkVisble.Checked; command.IsSuperUser = chkIsSuperUser.Checked; CommandController.UpdateCommand(command); int i = 0; foreach (DataGridItem item in dgrNameFollowLang.Items) { CommandInfo _commandInfo = new CommandInfo(); TextBox txtName = (TextBox)item.FindControl("txtName"); _commandInfo.CommandName = txtName.Text; _commandInfo.CommandID = commandId; CommandController.UpdateCommandByLang(_commandInfo, item.Cells[1].Text); i++; } lblUpdateStatus.Text = MiscUtility.MSG_UPDATE_SUCCESS; } catch (Exception ex) { lblUpdateStatus.Text = ex.Message; } }
public static int CommandID() { return(CommandController.GetCommand(ConvertUtility.ToString(HttpContext.Current.Request["cmd"])).CommandID); }