Example #1
0
        private string CancelInvite(IStepInput input)
        {
            var CancelAttendees = (InviteAttendeesInput)input;
            var invite          = InviteInput.FromDict(this.Data);

            if (!IsCallRepeated(invite))
            {
                EnsureCallIsNotRepeated(invite);
            }
            else
            {
                return("<response>Invite cancelled already</response>");
            }

            //This is how we ensure we dont contact the same people over the same message again
            //Think duplicate calls to the API
            if (DataSerializer.DeserializeData(WorkflowEngine.GetDataKey("multi_invite", CancelAttendees.UniqueCallId)) != null)
            {
                return("<response>Contacts have been notified already</response>");
            }
            else
            {
                DataSerializer.SerializeData(WorkflowEngine.GetDataKey("multi_invite", CancelAttendees.UniqueCallId), new DataStorage());
            }

            foreach (var contact in CancelAttendees.Attendees)
            {
                CancelAttendee(invite, contact);
            }

            return("<response>Event cancelled succesfully</response>");
        }
Example #2
0
        private string InviteAttendees(IStepInput input)
        {
            var inviteAttendees = (InviteAttendeesInput)input;

            if (!this.Data.ContainsKey("invite_unique_id"))
            {
                return("<response>The invite with id " + inviteAttendees.InviteId + " doesnt exists, please create the invite first</response>");
            }

            if (!IsCallRepeated(inviteAttendees))
            {
                EnsureCallIsNotRepeated(inviteAttendees);
            }
            else
            {
                return("<response>Contacts notified already</response>");
            }

            var invite = InviteInput.FromDict(this.Data);

            foreach (var contact in inviteAttendees.Attendees)
            {
                InviteAttendee(invite, contact);
            }

            return("<response>Contacts notified succesfully</response>");
        }
Example #3
0
        private string InviteCallReply(IStepInput input)
        {
            if (Data["invite_unique_id"] != null)
            {
                var invite  = InviteInput.FromDict(this.Data);
                var contact = Contact.FromDict(this.Data);

                var message = "Hello {0}, You have been invited to {1} on {2}. Please press 1 if you want to come, 2 if not.";

                message = string.Format(
                    message,
                    contact.Name,
                    invite.Title,
                    invite.Start.ToString()
                    );

                XmlWriter.EnterNumber(
                    message,
                    new Dictionary <string, string>()
                {
                    { "step", "callreply" },
                    { "type", "invite" }
                }
                    );
            }
            else
            {
                XmlWriter.SayMessage("You have not been invited to this event, hang up");
            }

            return(XmlWriter.ToString());
        }
Example #4
0
        private string InviteEmailReply(IStepInput input)
        {
            if (Data["invite_unique_id"] != null)
            {
                var invite  = InviteInput.FromDict(this.Data);
                var contact = Contact.FromDict(this.Data);

                Bus.Send(new CreateEmailMessage()
                {
                    Id           = Guid.NewGuid().ToString(),
                    Address      = contact.Email,
                    Sender       = "*****@*****.**",
                    Subject      = "Thanks for your Reply",
                    BodyTemplate = invite.ResponseEmailTemplate
                });

                Bus.Send(GetApiCall("email", "yes"));

                if (invite.ResponseEmailTemplate != null && !string.IsNullOrEmpty(invite.ResponseEmailTemplate.RedirectUrl))
                {
                    var templateManager = new MemoryTemplateManager();
                    return(templateManager.Fill(invite.ResponseEmailTemplate.RedirectUrl, this.Data));
                }
                else
                {
                    return("<Response>Thank you for your response</Response>");
                }
            }
            else
            {
                return("<Response>You havent been invited</Response>");
            }
        }
Example #5
0
        private string InviteSmsReply(IStepInput input)
        {
            if (Data["invite_unique_id"] != null)
            {
                string message = (input["Body"].ToLower() == "yes")
                    ? "I'm glad you coming!"
                    : "Im so sorry to hear that you cannot come";

                if (Data.ContainsKey("responded"))
                {
                    message = "You already responded to the invitation";
                }

                var phoneNumber = input["Phone"].NormalizePhone();

                Bus.Send(new CreateSmsMessage()
                {
                    PhoneNumber = phoneNumber,
                    Message     = message,
                    Id          = Guid.NewGuid().ToString()
                });

                Bus.Send(GetApiCall("sms", input["Body"]));

                return("<response>Response To Confirmation sent succesfully</response>");
            }
            else
            {
                return("<Response>You havent been invited</Response>");
            }
        }
Example #6
0
 private void Awake()
 {
     _lobbyToggle   = lobbyToggleProvider.value;
     _bankingToggle = bankingToggleProvider.value;
     _betStepper    = betStepProvider.value;
     _autoBetToggle = autoBetToggleProvider.value;
     _soundToggle   = soundToggleProvider.value;
 }
Example #7
0
        public virtual string Execute(string step, IStepInput input)
        {
            if (!Steps.ContainsKey(step))
            {
                throw new Exception("There is no step defined for workflow: " + this.GetType().Name + " with name: " + step);
            }

            return(Steps[step].Execute(input));
        }
Example #8
0
        private string InviteCallReplyResult(IStepInput input)
        {
            var message = string.Empty;

            message = input["Body"] == "1" ? "I'm glad you comming!" : "I'm dissapointed";

            Bus.Send(GetApiCall("voice", (input["Body"] == "1")?"yes":"no"));

            XmlWriter.SayMessage(message);
            return(XmlWriter.ToString());
        }
Example #9
0
        private string CreateInvite(IStepInput input)
        {
            var invite   = input as InviteInput;
            var inviteId = invite.InviteId;

            if (!IsCallRepeated(invite))
            {
                EnsureCallIsNotRepeated(invite);
            }
            else
            {
                return("<response>Invite sent already</response>");
            }

            Trace.WriteLine("Starting to Send invite with Id: " + inviteId);
            this.Data.Update(invite.ToDict());

            ShareToSocialNetworks(invite);

            return("<response>Invite sent succesfully</response>");
        }
Example #10
0
 public IActionOutput Execute(IStepInput input)
 {
     throw new NotImplementedException();
 }
Example #11
0
 public override string Execute(string step, IStepInput input)
 {
     return("<?xml version='1.0' encoding='UTF-8'?><Response><Hangup/></Response>");
 }
Example #12
0
 private bool isStepEnabled(IStepInput control)
 {
     return(control.isVisible && control.isEnabled);
 }
Example #13
0
 public override string Execute(IStepInput input)
 {
     return(Twiml);
 }
Example #14
0
 public abstract string Execute(IStepInput input);
Example #15
0
 public abstract IActionOutput Execute(IStepInput input);
Example #16
0
 public string Execute(IStepInput input)
 {
     return(toExecute(input));
 }