public void DoQuickCode(string quickCode, string reference, bool newPage, bool saveHistory, bool autoExecute) { quickCode = quickCode.Trim(); if (Array.Find(UserContext.ProhibitedActions, x => string.Compare(x.Trim(), quickCode.Trim(), StringComparison.OrdinalIgnoreCase) == 0) != null) { // Some quick codes are just prohibited, so don't even try to process them. return; } bool inMenu = false; TroposResourceProvider trp = new TroposResourceProvider(this.UserContext); if (quickCode == null || string.IsNullOrEmpty(quickCode.Trim())) { StringBuilder message = new StringBuilder(); message.Append(trp.GetResource("MSG_QUICK_CODE_MISSING").Trim()); message.Append("."); message.Append("<br/>"); message.Append("<br/>"); message.Append(trp.GetResource("MSG_ENTER_VALUE_AND_TRY_AGAIN").Trim()); message.Append(" "); message.Append(trp.GetResource("MSG_OR_SELECT_FROM_MENU").Trim()); message.Append("."); QCError(quickCode, message.ToString()); return; } Session["menuStateArray"] = menuStateControl.Value; //Save current menu state in session for cross page navigation AbstractMenuItem _mi; //Find the quick code in the user menu if (UserContext.QuickCodes.Find(x => string.Compare(x.Trim(), quickCode.Trim(), StringComparison.OrdinalIgnoreCase) == 0) == null) { inMenu = false; if (UserContext.BypassMenus || Array.Find(UserContext.PermittedActions, x => string.Compare(x.Trim(), quickCode.Trim(), StringComparison.OrdinalIgnoreCase) == 0) != null) { //Not found in user menu, try to get details from Tropos MenuItemFactory _mif = new MenuItemFactory(); _mi = _mif.ItemForQuickCode(this.UserContext, quickCode); if (_mi == null) { StringBuilder message = new StringBuilder(); message.AppendFormat(trp.GetResource("MSG_QUICK_CODE_X_DOES_NOT_EXIST").Trim(), quickCode.Trim()); message.Append("."); message.Append("<br/>"); message.Append("<br/>"); message.Append(trp.GetResource("MSG_ENTER_VALUE_AND_TRY_AGAIN").Trim()); message.Append("."); QCError(quickCode, message.ToString()); return; } } else { StringBuilder message = new StringBuilder(); message.AppendFormat(trp.GetResource("MSG_QUICK_CODE_X_DOES_NOT_EXIST").Trim(), quickCode.Trim()); message.Append(" "); message.Append(trp.GetResource("MSG_IN_YOUR_MENU").Trim()); message.Append("."); message.Append("<br/>"); message.Append("<br/>"); message.Append(trp.GetResource("MSG_ENTER_VALUE_AND_TRY_AGAIN").Trim()); message.Append(" "); message.Append(trp.GetResource("MSG_OR_SELECT_FROM_MENU").Trim()); message.Append("."); QCError(quickCode, message.ToString()); return; } } else { inMenu = true; _mi = UserContext.TroposRoles.Find(x => ((x is TroposUI.Common.Menu.Transaction && x.TransactionList.IndexOf(quickCode.Trim(), StringComparison.OrdinalIgnoreCase) >= 0) || x.TransactionList.ToUpper(CultureInfo.InvariantCulture) == quickCode.ToUpper(CultureInfo.InvariantCulture).Trim())); if (_mi == null) { StringBuilder message = new StringBuilder(); message.AppendFormat(trp.GetResource("MSG_QUICK_CODE_X_DOES_NOT_EXIST").Trim(), quickCode.Trim()); message.Append(" "); message.Append(trp.GetResource("MSG_IN_YOUR_MENU").Trim()); message.Append("."); message.Append("<br/>"); message.Append("<br/>"); message.Append(trp.GetResource("MSG_REFRESH_PAGE_AND_TRY_AGAIN").Trim()); message.Append("."); QCError(quickCode, message.ToString()); return; } } if (!(newPage || _mi.LaunchInNewWindow) || !_mi.AllowNewWindow) { //selectedNode.Value = _mi.ChildCode; selectedNode.Value = _mi.TroposUniqueMenuID.ToString(CultureInfo.InvariantCulture); ScriptManager.RegisterStartupScript(this, this.GetType(), "reinstateMenu", "$(initialise);$(forceMenuSelection);", true); } LaunchMenuItem(_mi, quickCode, reference, newPage, inMenu, saveHistory, autoExecute); }