コード例 #1
0
ファイル: AlarmAssembler.cs プロジェクト: livak/Publisher
        /// <summary>
        /// Converts this instance of <see cref="Alarm"/> to an instance of <see cref="AlarmDto"/>.
        /// </summary>
        /// <param name="entity"><see cref="Alarm"/> to convert.</param>
        public static AlarmDto ToDTO(this Alarm entity)
        {
            if (entity == null)
            {
                return(null);
            }

            var dto = new AlarmDto();

            dto.AlarmId         = entity.AlarmId;
            dto.Active          = entity.Active;
            dto.Acknowledged    = entity.Acknowledged;
            dto.AlarmLevelName  = entity.AlarmLevelName;
            dto.MaxValue        = entity.MaxValue;
            dto.SetTime         = entity.SetTime;
            dto.MaxValueTime    = entity.MaxValueTime;
            dto.DeactivatedTime = entity.DeactivatedTime;
            dto.SetPoint        = entity.SetPoint;
            dto.Priority        = entity.Priority;
            dto.VariableId      = entity.VariableId;

            entity.OnDTO(dto);

            return(dto);
        }
コード例 #2
0
ファイル: AlarmAssembler.cs プロジェクト: livak/Publisher
        /// <summary>
        /// Converts this instance of <see cref="AlarmDto"/> to an instance of <see cref="Alarm"/>.
        /// </summary>
        /// <param name="dto"><see cref="AlarmDto"/> to convert.</param>
        public static Alarm ToEntity(this AlarmDto dto)
        {
            if (dto == null)
            {
                return(null);
            }

            var entity = new Alarm();

            entity.AlarmId         = dto.AlarmId;
            entity.Active          = dto.Active;
            entity.Acknowledged    = dto.Acknowledged;
            entity.AlarmLevelName  = dto.AlarmLevelName;
            entity.MaxValue        = dto.MaxValue;
            entity.SetTime         = dto.SetTime;
            entity.MaxValueTime    = dto.MaxValueTime;
            entity.DeactivatedTime = dto.DeactivatedTime;
            entity.SetPoint        = dto.SetPoint;
            entity.Priority        = dto.Priority;
            entity.VariableId      = dto.VariableId;

            dto.OnEntity(entity);

            return(entity);
        }
コード例 #3
0
ファイル: AlarmAssembler.cs プロジェクト: livak/Publisher
 /// <summary>
 /// Invoked when <see cref="ToEntity"/> operation is about to return.
 /// </summary>
 /// <param name="entity"><see cref="Alarm"/> converted from <see cref="AlarmDto"/>.</param>
 static partial void OnEntity(this AlarmDto dto, Alarm entity);
コード例 #4
0
ファイル: AlarmAssembler.cs プロジェクト: livak/Publisher
 /// <summary>
 /// Invoked when <see cref="ToDTO"/> operation is about to return.
 /// </summary>
 /// <param name="dto"><see cref="AlarmDto"/> converted from <see cref="Alarm"/>.</param>
 static partial void OnDTO(this Alarm entity, AlarmDto dto);