Ejemplo n.º 1
0
        public static GetStorageRevenueResponse ToBillToStorageResponse(ServiceOrderStorageRevenue entity)
        {
            //TODO: Make this generic so that we don't have duplicate code from above.

            GetStorageRevenueResponse response = new GetStorageRevenueResponse();

            if (!string.IsNullOrEmpty(entity.BillToType))
            {
                switch (entity.BillToType.ToUpper())
                {
                case EntityType.ACCOUNT_ENTITY:
                    response.BillToType  = EntityType.ACCOUNT_ENTITY;
                    response.BillToId    = entity.BillToAccountEntityId;
                    response.BillToName  = entity.BillToAccountEntity?.Name;
                    response.BillToLabel = $"{EntityType.ACCOUNT_ENTITY}-{entity.BillToAccountEntityId}";
                    break;

                case EntityType.VENDOR:
                    response.BillToType  = EntityType.VENDOR;
                    response.BillToId    = entity.BillToVendorId;
                    response.BillToName  = entity.BillToVendor?.Name;
                    response.BillToLabel = $"{EntityType.VENDOR}-{entity.BillToVendorId}";
                    break;

                case EntityType.TRANSFEREE:
                    response.BillToType  = EntityType.TRANSFEREE;
                    response.BillToId    = entity.BillToTransfereeId;
                    response.BillToName  = $"{entity.BillToTransferee?.FirstName} {entity.BillToTransferee?.LastName}";
                    response.BillToLabel = $"{EntityType.TRANSFEREE}-{entity.BillToTransfereeId}";
                    break;
                }
            }

            return(response);
        }
Ejemplo n.º 2
0
        public static ServiceOrderStorageRevenue ToBillToStorageRevenue(dynamic entity)
        {
            //TODO: Make this generic so that we don't have duplicate code from above.

            ServiceOrderStorageRevenue response = new ServiceOrderStorageRevenue();

            if (!string.IsNullOrEmpty(entity.BillToType))
            {
                switch (entity.BillToType.ToUpper())
                {
                case EntityType.ACCOUNT_ENTITY:
                    response.BillToType            = EntityType.ACCOUNT_ENTITY;
                    response.BillToAccountEntityId = entity?.BillToId;
                    break;

                case EntityType.VENDOR:
                    response.BillToType     = EntityType.VENDOR;
                    response.BillToVendorId = entity?.BillToId;
                    break;

                case EntityType.TRANSFEREE:
                    response.BillToType         = EntityType.TRANSFEREE;
                    response.BillToTransfereeId = entity?.BillToId;
                    break;
                }
            }

            return(response);
        }