public virtual async Task FinalResultHandler(IDialogContext context, IAwaitable <string> argument) { string response = await argument; email = response; await context.PostAsync($@"Thank you for your interest, your request has been logged. Our customer service team will get back to you shortly. {Environment.NewLine}Your service request summary: {Environment.NewLine}Complaint Title: {complaint}, {Environment.NewLine}Customer Name: {customerName}, {Environment.NewLine}Phone Number: {phone}, {Environment.NewLine}Email: {email}"); await context.PostAsync("One moment please"); var activity = context.Activity as Activity; if (activity.Type == ActivityTypes.Message) { var connector = new ConnectorClient(new System.Uri(activity.ServiceUrl)); var isTyping = activity.CreateReply("Nerdibot is thinking..."); isTyping.Type = ActivityTypes.Typing; await connector.Conversations.ReplyToActivityAsync(isTyping); // DEMO: I've added this for demonstration purposes, so we have time to see the "Is Typing" integration in the UI. Else the bot is too quick for us :) Thread.Sleep(2500); } //PromptDialog.Confirm( //context: context, //resume: AnythingElseHandler, //prompt: "Is there anything else that I could help?", //retry: "Sorry, I don't understand that."); CRMConnection.CreateCase(complaint, customerName, phone, email); var feedback = ((Activity)context.Activity).CreateReply("Is there anything else that I could help?"); feedback.SuggestedActions = new SuggestedActions() { Actions = new List <CardAction>() { //new CardAction(){ Title = "👍", Type=ActionTypes.PostBack, Value=$"yes-positive-feedback" }, //new CardAction(){ Title = "👎", Type=ActionTypes.PostBack, Value=$"no-negative-feedback" } new CardAction() { Title = "Yes", Type = ActionTypes.PostBack, Value = $"Yes" }, new CardAction() { Title = "No", Type = ActionTypes.PostBack, Value = $"No" } } }; await context.PostAsync(feedback); context.Wait(AnythingElseHandler); }
public async Task RegistrationFinal(IDialogContext context, IAwaitable <IMessageActivity> result) { var response = await result; await context.PostAsync("Thank you for your membership registration. We will check your details and will get back to you shortly."); await context.PostAsync("One moment please"); var activity = context.Activity as Activity; if (activity.Type == ActivityTypes.Message) { var connector = new ConnectorClient(new System.Uri(activity.ServiceUrl)); var isTyping = activity.CreateReply("Nerdibot is thinking..."); isTyping.Type = ActivityTypes.Typing; await connector.Conversations.ReplyToActivityAsync(isTyping); // DEMO: I've added this for demonstration purposes, so we have time to see the "Is Typing" integration in the UI. Else the bot is too quick for us :) Thread.Sleep(2500); } //PromptDialog.Confirm( // context: context, // resume: AnythingElseHandler, // prompt: "Is there anything else that I could help?", // retry: "Sorry, I don't understand that."); CRMConnection.CreateLeadReg(customerName, email, phone, membershipdetails); var feedback = ((Activity)context.Activity).CreateReply("Is there anything else that I could help?"); feedback.SuggestedActions = new SuggestedActions() { Actions = new List <CardAction>() { //new CardAction(){ Title = "👍", Type=ActionTypes.PostBack, Value=$"yes-positive-feedback" }, //new CardAction(){ Title = "👎", Type=ActionTypes.PostBack, Value=$"no-negative-feedback" } new CardAction() { Title = "Yes", Type = ActionTypes.PostBack, Value = $"Yes" }, new CardAction() { Title = "No", Type = ActionTypes.PostBack, Value = $"No" } } }; await context.PostAsync(feedback); context.Wait(AnythingElseHandler); }
public FormDuplicateActions() { InitializeComponent(); var connStrs = ConfigurationManager.ConnectionStrings; var servers = new Dictionary <string, List <CRMConnection> >(); for (int i = 0; i < connStrs.Count; i++) { var connStr = connStrs[i]; var name = connStr.Name; var str = connStr.ConnectionString; if (name.StartsWith("Local")) { continue; } CRMConnection node = new CRMConnection(); node.Name = name; node.Text = name; string[] tokens = str.Split(';'); foreach (var token in tokens) { var subTokens = token.Split('='); var key = subTokens[0]; var val = subTokens[1]; switch (key.ToLower()) { case "hostname": node.Hostname = val; break; case "organization": node.Organization = val; break; case "username": node.Username = val; break; case "password": node.Password = val; break; case "domain": node.Domain = val; break; } } if (!servers.ContainsKey(node.Hostname)) { servers[node.Hostname] = new List <CRMConnection>(); } cbConnectionStrings.Items.Add(node); } }
public bool ProcessBulkRecordDeletion(string environmentSpace, out string errorMsg) { errorMsg = string.Empty; IOrganizationService service = default(IOrganizationService); try { var repAct = new RepositorService(); //make CRM Connection var crmCnct = new CRMConnection(); var connected = crmCnct.CreateCRMConnection(out service, environmentSpace, out errorMsg); if (!connected) { errorMsg = $"No CRM connection established. Please review the URL and Credentials."; return(false); } Trace.WriteLine("Program started; Record deletion initiated."); //Get Config data list var cnfigServ = new ConfigurationService(); List <KeyValuePair <string, int> > config = cnfigServ.GetConfigValues(out errorMsg); if (config == null || config == default(List <KeyValuePair <string, int> >)) { errorMsg = $"Configuration list has returned no data. Program can not continue."; return(false); } //get case types list var crmInput = new CRMService(); List <KeyValuePair <Guid, string> > caseTypes = crmInput.GetCaseTypeList(service, out errorMsg); if (caseTypes == null || caseTypes == default(List <KeyValuePair <Guid, string> >)) { errorMsg = $"Case type list comprised of CRM case types contains no data."; return(false); } // compile config with CRM case type ID's List <KeyValuePair <Guid, int> > compiledCaseTypeList = crmInput.MergeCRMCaseTypesWithConfig(caseTypes, config, out errorMsg); if (compiledCaseTypeList == null || compiledCaseTypeList == default(List <KeyValuePair <Guid, int> >)) { errorMsg = $"The comprised list of case type ID's and configuration value amounts contains no data."; return(false); } //get case count values from config, fetch that many cases of x case type EntityCollection protectedCases = crmInput.GetProtectedCases(service, compiledCaseTypeList, out errorMsg); if (protectedCases == null || protectedCases == default(EntityCollection)) { errorMsg = $"The collection of protected cases has returned containing no data."; return(false); } // bulk update protected cases var updateResponse = repAct.BulkUpdateProtectedCases(service, protectedCases, out errorMsg); if (!updateResponse) { errorMsg = $"There was an error whilst updating all protected cases."; return(false); } //bulk delete unflagged cases var recordsDeleted = crmInput.CreateBulkCaseDeletionJob(service, out errorMsg); if (!recordsDeleted) { errorMsg = $"CRM Bulk Delete for cases message was unsuccessfully sent to CRM."; return(false); } //bulk delete completed system jobs var systemJobsComplete = crmInput.CreateSystemJobDeletionJob(service, out errorMsg); if (!systemJobsComplete) { errorMsg = $"CRM Bulk Delete system jobs was unsuccessfully sent to CRM."; return(false); } Trace.WriteLine("End"); return(true); } catch (FaultException <OrganizationServiceFault> e) { errorMsg = e.Message; Trace.WriteLine(e.Message); return(false); } }