示例#1
0
        public WasteManagementEvent TransformToExceptionModel(WasteManagementEventEntity entity)
        {
            WasteManagementEvent wasteManagementEventModel = new WasteManagementEvent
            {
                Vin           = entity.Vin,
                AccountId     = entity.AccountId,
                EventId       = entity.EventId,
                EventType     = entity.EventType,
                TransactionId = entity.TransactionId,
                DateTime      = TimeZoneInfo.ConvertTime(entity.DateTime, pstTimeZone, TimeZoneInfo.Utc),
                Address       = new Address()
                {
                    Street1 = entity.Street1,
                    Street2 = entity.Street2,
                    City    = entity.City,
                    ZipCode = entity.ZipCode,
                    State   = entity.State,
                    Country = entity.Country,
                },
                Latitude       = entity.Latitude,
                Longitude      = entity.Longitude,
                ContainerColor = entity.ContainerColor,
                ContainerSize  = entity.ContainerSize,
                VideoStatus    = entity.VideoStatus,
                ContainerType  = entity.ContainerType
            };



            if (entity.ExceptionDetails != null)
            {
                wasteManagementEventModel.ExceptionDetails = new ExceptionDetails
                {
                    Type          = entity.ExceptionDetails.Type,
                    Description   = entity.ExceptionDetails.Description,
                    ContactName   = entity.ExceptionDetails.ContactName,
                    ContactNumber = entity.ExceptionDetails.ContactNumber,
                    Notes         = entity.ExceptionDetails.Notes,
                    PictureUrls   = TransformExceptionUrlEnityListToArray(entity.Images)
                };
            }

            if (entity.Videos != null)
            {
                wasteManagementEventModel.VideoUrls = TransformToVideoUrlList(entity.Videos);
            }
            return(wasteManagementEventModel);
        }
示例#2
0
        public WasteManagementEventEntity TransformToExceptionEntity(WasteManagementEvent model)
        {
            WasteManagementEventEntity wasteManagementEventEntity = new WasteManagementEventEntity
            {
                Vin            = model.Vin,
                AccountId      = model.AccountId,
                EventId        = model.EventId,
                EventType      = model.EventType,
                TransactionId  = model.TransactionId,
                DateTime       = TimeZoneInfo.ConvertTimeFromUtc(model.DateTime, pstTimeZone),
                Street1        = model.Address.Street1,
                Street2        = model.Address.Street2,
                City           = model.Address.City,
                ZipCode        = model.Address.ZipCode,
                State          = model.Address.State,
                Country        = model.Address.Country,
                Latitude       = model.Latitude,
                Longitude      = model.Longitude,
                DateReceived   = TimeZoneInfo.ConvertTimeFromUtc(System.DateTime.UtcNow, pstTimeZone),
                ContainerColor = model.ContainerColor,
                ContainerSize  = model.ContainerSize,
                ContainerType  = model.ContainerType
            };

            if (model.ExceptionDetails != null)
            {
                wasteManagementEventEntity.ExceptionDetails = new ExceptionDetailsEntity
                {
                    Type          = model.ExceptionDetails.Type,
                    ContactName   = model.ExceptionDetails.ContactName,
                    ContactNumber = model.ExceptionDetails.ContactNumber,
                    Description   = model.ExceptionDetails.Description,
                    Notes         = model.ExceptionDetails.Notes
                };
                wasteManagementEventEntity.Images = TransformToExceptionUrlEntityList(model.ExceptionDetails.PictureUrls);
            }

            if (model.VideoUrls != null)
            {
                wasteManagementEventEntity.Videos = TransformToVideoUrlEntityList(model.EventId, model.VideoUrls);
            }

            return(wasteManagementEventEntity);
        }