Beispiel #1
0
        public static async Task <PhoneObject> Run(PhoneObject entity)
        {
            var client = Connection.Get;

            switch (entity.EventAction)
            {
            case Models.Enums.Action.Add:
                entity.AddResponse = await client.AddClientPhoneAsync(
                    new AddClientPhoneRequest()
                {
                    RID         = entity.RID,
                    MessageGuid = Guid.NewGuid(),
                    Phone       = new Services.CMS.Phone()
                    {
                        PhoneCountryCode = "1",
                        PhoneNumber      = entity.Value.PhoneNumber,
                        PhoneUsages      = entity.Value.PhoneUsages
                    },
                    PropBag = Helpers.Settings.PropBag
                });

                break;

            case Models.Enums.Action.Update:
                if (entity.Value.ID.HasValue)
                {
                    entity.UpdateResponse = await client.UpdateClientPhoneAsync(
                        new UpdateClientPhoneRequest()
                    {
                        RID                    = entity.RID,
                        MessageGuid            = Guid.NewGuid(),
                        NewPhone               = entity.Value,
                        PhoneIDToUpdate        = entity.Value.ID.Value,
                        NewPhoneUsageEnum      = PhoneUsageEnum.Business,
                        PhoneUsageEnumToUpdate = PhoneUsageEnum.Business,
                        PropBag                = Helpers.Settings.PropBag
                    });
                }
                break;

            case Models.Enums.Action.Remove:
                if (entity.Value.ID.HasValue)
                {
                    entity.RemoveResponse = await client.RemoveClientPhoneAsync(new RemoveClientPhoneRequest()
                    {
                        RID         = entity.RID,
                        MessageGuid = Guid.NewGuid(),
                        PhoneID     = entity.Value.ID.Value,
                        PropBag     = "<PROPBAG></PROPBAG>"
                    });
                }
                break;
            }
            return(entity);
        }
Beispiel #2
0
 public static async Task<PhoneObject> UpdatePhone(PhoneObject entity)
 {
     return await LG.Data.Core.Clients.Details.Phone.Run(entity);
 }
Beispiel #3
0
        public static async Task<PhoneObject> Run(PhoneObject entity)
        {
            var client = Connection.Get;
            switch (entity.EventAction)
            {
                case Models.Enums.Action.Add:
                    entity.AddResponse = await client.AddClientPhoneAsync(
                        new AddClientPhoneRequest()
                        {
                            RID = entity.RID,
                            MessageGuid = Guid.NewGuid(),
                            Phone = new Services.CMS.Phone()
                            {
                                PhoneCountryCode = "1",
                                PhoneNumber = entity.Value.PhoneNumber,
                                PhoneUsages = entity.Value.PhoneUsages
                            },
                            PropBag = Helpers.Settings.PropBag
                        });
                    break;
                case Models.Enums.Action.Update:
                    if (entity.Value.ID.HasValue)
                        entity.UpdateResponse = await client.UpdateClientPhoneAsync(
                            new UpdateClientPhoneRequest()
                            {
                                RID = entity.RID,
                                MessageGuid = Guid.NewGuid(),
                                NewPhone = entity.Value,
                                PhoneIDToUpdate = entity.Value.ID.Value,
                                NewPhoneUsageEnum = PhoneUsageEnum.Business,
                                PhoneUsageEnumToUpdate = PhoneUsageEnum.Business,
                                PropBag = Helpers.Settings.PropBag
                            });
                    break;
                case Models.Enums.Action.Remove:
                    if (entity.Value.ID.HasValue)
                        entity.RemoveResponse = await client.RemoveClientPhoneAsync(new RemoveClientPhoneRequest()
                        {
                            RID = entity.RID,
                            MessageGuid = Guid.NewGuid(),
                            PhoneID = entity.Value.ID.Value,
                            PropBag = "<PROPBAG></PROPBAG>"
                        });
                    break;

            }
            return entity;
        }