Created
August 9, 2016 17:05
-
-
Save junxie6/3cdef913a7713f9822f1b46bded6c8c5 to your computer and use it in GitHub Desktop.
Answer the prompt automatically in Simply SDK
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <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