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

            switch (entity.EventAction)
            {
            case Models.Enums.Action.Add:
                entity.AddResponse = await client.AddClientAddressAsync(
                    new AddClientAddressRequest()
                {
                    RID         = entity.RID,
                    MessageGuid = Guid.NewGuid(),
                    Address     = entity.Value,
                    PropBag     = Helpers.Settings.PropBag
                });

                break;

            case Models.Enums.Action.Update:
                if (entity.Value.ID.HasValue)
                {
                    entity.UpdateResponse = await client.UpdateClientAddressAsync(
                        new UpdateClientAddressRequest()
                    {
                        RID                      = entity.RID,
                        MessageGuid              = Guid.NewGuid(),
                        NewAddress               = entity.Value,
                        AddressIDToUpdate        = entity.Value.ID.Value,
                        AddressUsageEnumToUpdate = entity.Value.AddressUsages[0].AddressUsageEnum,
                        NewAddressUsageEnum      = entity.Value.AddressUsages[0].AddressUsageEnum,
                        PropBag                  = Helpers.Settings.PropBag
                    });
                }
                break;

            case Models.Enums.Action.Remove:
                if (entity.Value.ID.HasValue)
                {
                    entity.RemoveResponse = await client.RemoveClientAddressAsync(new RemoveClientAddressRequest()
                    {
                        RID         = entity.RID,
                        MessageGuid = Guid.NewGuid(),
                        AddressID   = entity.Value.ID.Value,
                        PropBag     = "<PROPBAG></PROPBAG>"
                    });
                }
                break;
            }
            return(entity);
        }
示例#2
0
 public static async Task<AddressObject> UpdateAddress(AddressObject entity)
 {
     return await LG.Data.Core.Clients.Details.Address.Run(entity);
 }
示例#3
0
 public static async Task<AddressObject> Run(AddressObject entity)
 {
     var client = Connection.Get;
     switch (entity.EventAction)
     {
         case Models.Enums.Action.Add:
             entity.AddResponse = await client.AddClientAddressAsync(
                 new AddClientAddressRequest()
                 {
                     RID = entity.RID,
                     MessageGuid = Guid.NewGuid(),
                     Address = entity.Value,
                     PropBag = Helpers.Settings.PropBag
                 });
             break;
         case Models.Enums.Action.Update:
             if (entity.Value.ID.HasValue)
                 entity.UpdateResponse = await client.UpdateClientAddressAsync(
                     new UpdateClientAddressRequest()
                     {
                         RID = entity.RID,
                         MessageGuid = Guid.NewGuid(),
                         NewAddress = entity.Value,
                         AddressIDToUpdate = entity.Value.ID.Value,
                         AddressUsageEnumToUpdate = entity.Value.AddressUsages[0].AddressUsageEnum,
                         NewAddressUsageEnum = entity.Value.AddressUsages[0].AddressUsageEnum,
                         PropBag = Helpers.Settings.PropBag
                     });
             break;
         case Models.Enums.Action.Remove:
             if (entity.Value.ID.HasValue)
                 entity.RemoveResponse = await client.RemoveClientAddressAsync(new RemoveClientAddressRequest()
                 {
                     RID = entity.RID,
                     MessageGuid = Guid.NewGuid(),
                     AddressID = entity.Value.ID.Value,
                     PropBag = "<PROPBAG></PROPBAG>"
                 });
             break;
     }
     return entity;
 }