public static DictionaryItemDto ToDictionaryItemDto(this MasterData entity) { if (entity == null) { return(null); } DictionaryItemDto dto = new DictionaryItemDto { Key = entity.Key, Value = entity.Text, DisplayText = entity.Text, Code = entity.Value, TypeGroup = entity.GroupName }; return(dto); }
public static ManagementFactorDto ToManagementFactorDto(this ManagementFactor entity, DictionaryItemDto factorGroup) { if (entity == null) { return(null); } ManagementFactorDto dto = new ManagementFactorDto(); dto.CopyPropertiesFrom(entity); dto.Unit = entity.MeasureUnit.ToMeasureUnitDto(); dto.DataType = entity.DataType.ToDictionaryItemDto <FactorDataType>(); dto.FactorGroup = factorGroup; return(dto); }
public static NotificationDto ToNotificationDto(this NotificationResultDto entity, DictionaryItemDto factorGroups) { if (entity == null) { return(null); } ShortFarmingLocationDto farmingLocation = new ShortFarmingLocationDto { Id = entity.FarmingLocationId, Name = entity.FarmingLocationName, Code = entity.FarmingLocationCode }; NotificationDto dto = new NotificationDto() { Id = entity.Id, FarmingLocation = farmingLocation, ManagementFactor = new ShortManagementFactorDto { Id = entity.ManagementFactorId, Name = entity.ManagementFactorName, Code = entity.ManagementFactorCode }, ShrimpCrop = new ShrimpCropDto { Id = entity.ShrimpCropId, Name = entity.ShrimpCropName, Code = entity.ShrimpCropCode, FromDate = entity.ShrimpCropFromDate.ToSecondsTimestamp(), ToDate = entity.ShrimpCropToDate.ToSecondsTimestamp(), FarmingLocation = farmingLocation, ShrimpBreed = new ShrimpBreedDto { Id = entity.ShrimpBreedId, Name = entity.ShrimpBreedName, Code = entity.ShrimpBreedCode, Description = entity.ShrimpBreedDescription, Attachment = entity.ShrimpBreedAttachment }, }, ExecutionTime = entity.ExecutionTime.ToSecondsTimestamp(), FromDate = entity.FromDate.ToSecondsTimestamp(), ToDate = entity.ToDate.ToSecondsTimestamp(), Status = entity.Status, CreatedAt = DateTime.UtcNow.ToSecondsTimestamp(), Type = entity.Type.ToDictionaryItemDto <NotifyType>(), Frequency = entity.Frequency.ToDictionaryItemDto <ShrimpCropFrequency>(), FactorGroup = factorGroups, }; return(dto); }