Skip to content

Instantly share code, notes, and snippets.

@junxie6
Created August 9, 2016 17:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save junxie6/3cdef913a7713f9822f1b46bded6c8c5 to your computer and use it in GitHub Desktop.
Save junxie6/3cdef913a7713f9822f1b46bded6c8c5 to your computer and use it in GitHub Desktop.
Answer the prompt automatically in Simply SDK
/// <summary>
/// AskAlert expects a return value of AlertResult.YES or AlertResult.NO
/// </summary>
public override AlertResult AskAlert(SimplyMessage message)
{
Console.WriteLine(message.Message);
if ((new Regex(@"^You did not enter an amount on the invoice")).Match(message.Message).Success)
{
return AlertResult.YES;
}
else if ((new Regex(@"^Quantity exceeds the available stock on hand at")).Match(message.Message).Success)
{
return AlertResult.NO;
}
else if ((new Regex(@"^This sales invoice has not been emailed")).Match(message.Message).Success)
{
return AlertResult.YES;
}
else
{
string answer = Console.ReadLine().ToLower();
if (answer[0] == 'y')
return AlertResult.YES;
else
return AlertResult.NO;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment