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);
        }
        public static ShortFarmingLocationDto ToShortFarmingLocationDto(this FarmingLocation entity)
        {
            if (entity == null)
            {
                return(null);
            }

            ShortFarmingLocationDto dto = new ShortFarmingLocationDto();

            dto.CopyPropertiesFrom(entity);

            return(dto);
        }
        public static WorkDto ToWorkDto(this WorkResultDto entity)
        {
            if (entity == null)
            {
                return(null);
            }

            ShortFarmingLocationDto farmingLocation = new ShortFarmingLocationDto
            {
                Id   = entity.FarmingLocationId,
                Name = entity.FarmingLocationName,
                Code = entity.FarmingLocationCode
            };

            ShrimpBreedDto shrimpBreed = new ShrimpBreedDto
            {
                Id          = entity.ShrimpBreedId,
                Name        = entity.ShrimpBreedName,
                Code        = entity.ShrimpBreedCode,
                Description = entity.ShrimpBreedDescription,
                Attachment  = entity.ShrimpBreedAttachment
            };

            WorkDto dto = new WorkDto();

            dto.Id              = entity.Id;
            dto.Name            = entity.Name;
            dto.ExecutionTime   = entity.ExecutionTime.ToSecondsTimestamp();
            dto.Value           = entity.Value;
            dto.FarmingLocation = farmingLocation;

            dto.ShrimpBreed = shrimpBreed;

            dto.Curator = new UserDto
            {
                Id       = entity.UserId,
                FullName = entity.FullName,
                Address  = entity.Address,
                Phone    = entity.Phone,
                Email    = entity.Email,
            };

            dto.ShrimpCrop = new ShrimpCropDto
            {
                Id              = entity.ShrimpCropId,
                Name            = entity.ShrimpCropName,
                Code            = entity.ShrimpCropCode,
                FromDate        = entity.ShrimpCropFromDate.ToSecondsTimestamp(),
                ToDate          = entity.ShrimpCropToDate.ToSecondsTimestamp(),
                FarmingLocation = farmingLocation,
                ShrimpBreed     = shrimpBreed,
            };

            dto.ManagementFactor = new ShortManagementFactorDto
            {
                Id   = entity.ManagementFactorId,
                Name = entity.ManagementFactorName,
                Code = entity.ManagementFactorCode
            };

            dto.MeasureUnit = new MeasureUnitDto
            {
                Id         = entity.MeasureUnitId,
                Name       = entity.MeasureUnitName,
                Desciption = entity.MeasureUnitDesciption
            };

            dto.ModifiedAt  = entity.ModifiedAt.ToSecondsTimestamp();
            dto.SampleValue = entity.SampleValue;
            dto.Description = entity.Description;
            dto.age         = (int)(entity.ExecutionTime - entity.ShrimpCropFromDate).TotalDays;
            dto.Pictures    = entity.Pictures == null ? null : entity.Pictures.Split(',').Select(x => x.ToTempUploadDto()).ToArray();

            return(dto);
        }