示例#1
0
        private async Task InsertDateRecivedAsync(IDialogContext context, IAwaitable <object> result)
        {
            HubSpotMethodClass method = new HubSpotMethodClass();

            string messege = "Goodbye";

            try
            {
                var      activity = await result as Activity;
                string   dates    = activity.Text;
                DateTime date     = DateTime.ParseExact(dates, "yyyy-MM-dd HH:mm:ss", System.Globalization.CultureInfo.InvariantCulture);
                eventDate = (long)method.GetTime(date.AddHours(4));

                InsertEventClass insertedevent = new InsertEventClass();
                insertedevent.name        = eventName;
                insertedevent.description = eventDescription;
                insertedevent.eventDate   = eventDate;

                method.InsertEvent(Key, insertedevent);
                await context.PostAsync(messege);

                context.Wait(MessegeRecivedAsync);
            }
            catch
            {
                messege = "Enter please corect date.";
                await context.PostAsync(messege);

                context.Wait(InsertDateRecivedAsync);
            }
            //await context.PostAsync(messege);
            //context.Wait(MessegeRecivedAsync);
        }
示例#2
0
        private async Task DateHandler(IDialogContext context, IAwaitable <string> result)
        {
            var d = await result;

            Date = d;

            HubSpotMethodClass method   = new HubSpotMethodClass();
            DateTime           date     = DateTime.ParseExact(Date, "yyyy-MM-dd HH:mm:ss", System.Globalization.CultureInfo.InvariantCulture);
            long             task_date  = (long)method.GetTime(date.AddHours(4));
            InsertEventClass insertluis = new InsertEventClass();

            insertluis.name        = Name;
            insertluis.description = Description;
            insertluis.eventDate   = task_date;

            method.InsertEvent(HubKey, insertluis);

            await context.PostAsync($@"Your task succesful added thank you)
                  {Environment.NewLine} Your task:
                   {Environment.NewLine} Name: {Name}
                   {Environment.NewLine}Description: {Description}
                   {Environment.NewLine}Date: {Date}");
        }