Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2017
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. public static void swapShift(string shiftDate, string otherID)
  2. {
  3. var url = "https://myshiftplannercloud.azurewebsites.net/api/ChatBot/SwapShift?employeeID=joe512";
  4. var syncClient = new WebClient();
  5. var data = "&date=" + shiftDate + "&swapwith=" + otherID;
  6. syncClient.UploadString(url, data);
  7. }
  8.  
  9. // Other (hopefully) unrelated code goes here
  10.  
  11. if (activity.Text.ToUpper().Contains("SWAP"))
  12. {
  13. ConnectorClient connector = new ConnectorClient(new Uri(activity.ServiceUrl));
  14. string dateInput = activity.Text.Substring((activity.Text.IndexOf("/") - 2), 8);
  15. DateTime date = DateTime.ParseExact(dateInput, "dd/MM/yy", CultureInfo.InvariantCulture);
  16. string dateOutput = date.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture);
  17. string userID = "Frank";
  18. swapShift(dateOutput, userID);
  19. Activity reply = activity.CreateReply($"I've swapped your shift with " + userID + " and let your manager know");
  20. await connector.Conversations.ReplyToActivityAsync(reply);
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement