Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Authorize void previous round item in a macro

Status
Not open for further replies.

Martin B

Programmer
Oct 29, 2020
20
0
0
DK
I'm trying to build a macro that will delete a menu item from a previous round - the caveat is that the employee does not have the right to do this, and I want to authorize that operation as part of the macro.

The menu item is a placeholder for some other stuff, and the larger objective is to replace it (in reality replace its reference, if anyone has an idea to do that).

Locating the detail and determining if the employee has rights or not is already in place, the question is why Simphony still prompts for prev void round auth...

Code:
public void DeleteDetail(int detailLink, int reason, int auth)
{
    var commands = new List<OpsCommand>
    {
        new OpsCommand {Command = OpsCommandType.DetailSelected, Number = detailLink},
        new OpsCommand {Command = OpsCommandType.Void},
        new OpsCommand {Command = OpsCommandType.EnterKey},
    };

    if (auth != 0)
    {
        commands.Add(new OpsCommand { Command = OpsCommandType.AsciiData, Text = auth.ToString() });
        commands.Add(new OpsCommand { Command = OpsCommandType.EnterKey });
    }

    if (reason != 0)
    {
        commands.Add(new OpsCommand { Command = OpsCommandType.AsciiData, Text = reason.ToString() });
        commands.Add(new OpsCommand { Command = OpsCommandType.EnterKey });
    }

    Invoke(() => OpsContext.ProcessCommand(new OpsCommand { Command = OpsCommandType.Macro, Data = commands }));
}



The Invoke method in the bottom is just a helper method to ensure that we execute on the right thread.

Code:
protected void Invoke(Action a)
{
    OpsContext.InvokeOnCommandThread(delegate
    {
        a.Invoke();

        return null;
    }, null);
}



I have not tried to build the macro on the page design, but I assume the result will be the same.

Any ideas?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top