Beispiel #1
0
        public static GetBillableItemResponse ToGetBillableItemResponse(BillableItem entity)
        {
            var response = new GetBillableItemResponse();

            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);
        }
Beispiel #2
0
        public static BillableItem ToBillableItem(GetBillableItemResponse dto)
        {
            var response = new BillableItem();

            switch (dto.BillToType.ToUpper())
            {
            case EntityType.ACCOUNT_ENTITY:
                response.BillToType            = EntityType.ACCOUNT_ENTITY;
                response.BillToAccountEntityId = dto?.BillToId;
                break;

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

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

            return(response);
        }