/// <summary>Convert from VoluntaryPlanWaiverRequestType DTO to entity</summary>
        /// <param name="dbContext">DB Context to use for attaching entity</param>
        /// <param name="dto">DTO to convert from</param>
        /// <param name="dtoEntities">Used internally to track which dtos have been converted to entites already (to avoid re-converting when circularly referenced)</param>
        /// <returns>Resultant VoluntaryPlanWaiverRequestType entity</returns>
        public static VoluntaryPlanWaiverRequestType FromDto(FACTS.Framework.DAL.DbContext dbContext, VoluntaryPlanWaiverRequestTypeDto dto, Dictionary <FACTS.Framework.Dto.BaseDto, BaseEntity> dtoEntities = null)
        {
            dtoEntities = dtoEntities ?? new Dictionary <FACTS.Framework.Dto.BaseDto, BaseEntity>();
            if (dtoEntities.ContainsKey(dto))
            {
                return((VoluntaryPlanWaiverRequestType)dtoEntities[dto]);
            }

            VoluntaryPlanWaiverRequestType entity = new VoluntaryPlanWaiverRequestType();

            dtoEntities.Add(dto, entity);

            entity.CreateDateTime                   = dto.CreateDateTime;
            entity.CreateUserId                     = dto.CreateUserId;
            entity.DurationInWeeksCode              = dto.DurationInWeeksCode;
            entity.LeaveTypeCode                    = dto.LeaveTypeCode;
            entity.PercentagePaid                   = dto.PercentagePaid;
            entity.UpdateDateTime                   = dto.UpdateDateTime;
            entity.UpdateNumber                     = dto.UpdateNumber;
            entity.UpdateProcess                    = dto.UpdateProcess;
            entity.UpdateUserId                     = dto.UpdateUserId;
            entity.VoluntaryPlanWaiverRequestId     = dto.VoluntaryPlanWaiverRequestId;
            entity.VoluntaryPlanWaiverRequestTypeId = dto.VoluntaryPlanWaiverRequestTypeId;

            entity.VoluntaryPlanWaiverRequest = (dto.VoluntaryPlanWaiverRequest == null) ? null : VoluntaryPlanWaiverRequest.FromDto(dbContext, dto.VoluntaryPlanWaiverRequest, dtoEntities);

            if (dbContext != null)
            {
                dbContext.Entry(entity).State = (dto.IsNew ? EntityState.Added : (dto.IsDeleted ? EntityState.Deleted : EntityState.Modified));
            }

            return(entity);
        }
Beispiel #2
0
        /// <summary>Convert from VoluntaryPlanWaiverRequestType DTO to entity</summary>
        /// <param name="dbContext">DB Context to use for attaching entity</param>
        /// <param name="dto">DTO to convert from</param>
        /// <param name="dtoEntities">Used internally to track which dtos have been converted to entites already (to avoid re-converting when circularly referenced)</param>
        /// <returns>Resultant VoluntaryPlanWaiverRequestType entity</returns>
        public static VoluntaryPlanWaiverRequestType FromDto(FACTS.Framework.DAL.DbContext dbContext, VoluntaryPlanWaiverRequestTypeDto dto, Dictionary <FACTS.Framework.Dto.BaseDto, BaseEntity> dtoEntities = null)
        {
            dtoEntities = dtoEntities ?? new Dictionary <FACTS.Framework.Dto.BaseDto, BaseEntity>();
            if (dtoEntities.ContainsKey(dto))
            {
                return((VoluntaryPlanWaiverRequestType)dtoEntities[dto]);
            }

            VoluntaryPlanWaiverRequestType entity = new VoluntaryPlanWaiverRequestType();

            dtoEntities.Add(dto, entity);
            FromDtoSet(dbContext, dto, entity, dtoEntities);

            if (dbContext != null)
            {
                dbContext.Entry(entity).State = (dto.IsNew ? EntityState.Added : (dto.IsDeleted ? EntityState.Deleted : EntityState.Modified));
            }

            return(entity);
        }
Beispiel #3
0
        protected static void FromDtoSet(FACTS.Framework.DAL.DbContext dbContext, VoluntaryPlanWaiverRequestTypeDto dto, VoluntaryPlanWaiverRequestType entity, Dictionary <FACTS.Framework.Dto.BaseDto, BaseEntity> dtoEntities)
        {
            entity.CreateDateTime      = dto.CreateDateTime;
            entity.CreateUserId        = dto.CreateUserId;
            entity.DurationInWeeksCode = dto.DurationInWeeksCode;
            entity.FormId         = dto.FormId;
            entity.LeaveTypeCode  = dto.LeaveTypeCode;
            entity.PercentagePaid = dto.PercentagePaid;
            entity.UpdateDateTime = dto.UpdateDateTime;
            entity.UpdateNumber   = dto.UpdateNumber;
            entity.UpdateProcess  = dto.UpdateProcess;
            entity.UpdateUserId   = dto.UpdateUserId;

            entity.VoluntaryPlanWaiverRequest = (dto.VoluntaryPlanWaiverRequest == null) ? null : VoluntaryPlanWaiverRequest.FromDto(dbContext, dto.VoluntaryPlanWaiverRequest, dtoEntities);
        }