예제 #1
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);
        }
예제 #2
0
        /// <summary>Convert from VoluntaryPlanWaiverRequestType entity to DTO w/o checking entity state or entity navigation</summary>
        /// <param name="dto">DTO to use if already created instead of creating new one (can be inherited class instead as opposed to base class)</param>
        /// <returns>Resultant VoluntaryPlanWaiverRequestType DTO</returns>
        public VoluntaryPlanWaiverRequestTypeDto ToDto(VoluntaryPlanWaiverRequestTypeDto dto = null)
        {
            dto       = dto ?? new VoluntaryPlanWaiverRequestTypeDto();
            dto.IsNew = false;

            dto.CreateDateTime      = CreateDateTime;
            dto.CreateUserId        = CreateUserId;
            dto.DurationInWeeksCode = DurationInWeeksCode;
            dto.FormId         = FormId;
            dto.LeaveTypeCode  = LeaveTypeCode;
            dto.PercentagePaid = PercentagePaid;
            dto.UpdateDateTime = UpdateDateTime;
            dto.UpdateNumber   = UpdateNumber;
            dto.UpdateProcess  = UpdateProcess;
            dto.UpdateUserId   = UpdateUserId;

            return(dto);
        }
예제 #3
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);
        }
예제 #4
0
        /// <summary>Convert from VoluntaryPlanWaiverRequestType entity to DTO</summary>
        /// <param name="dbContext">DB Context to use for setting DTO state</param>
        /// <param name="dto">DTO to use if already created instead of creating new one (can be inherited class instead as opposed to base class)</param>
        /// <param name="entityDtos">Used internally to track which entities have been converted to DTO's already (to avoid re-converting when circularly referenced)</param>
        /// <returns>Resultant VoluntaryPlanWaiverRequestType DTO</returns>
        public VoluntaryPlanWaiverRequestTypeDto ToDtoDeep(FACTS.Framework.DAL.DbContext dbContext, VoluntaryPlanWaiverRequestTypeDto dto = null, Dictionary <BaseEntity, FACTS.Framework.Dto.BaseDto> entityDtos = null)
        {
            entityDtos = entityDtos ?? new Dictionary <BaseEntity, FACTS.Framework.Dto.BaseDto>();
            if (entityDtos.ContainsKey(this))
            {
                return((VoluntaryPlanWaiverRequestTypeDto)entityDtos[this]);
            }

            dto = ToDto(dto);
            entityDtos.Add(this, dto);

            System.Data.Entity.Infrastructure.DbEntityEntry <VoluntaryPlanWaiverRequestType> entry = dbContext?.Entry(this);
            dto.IsNew     = (entry?.State == EntityState.Added);
            dto.IsDeleted = (entry?.State == EntityState.Deleted);

            if (entry?.Reference(x => x.VoluntaryPlanWaiverRequest)?.IsLoaded == true)
            {
                dto.VoluntaryPlanWaiverRequest = VoluntaryPlanWaiverRequest?.ToDtoDeep(dbContext, entityDtos: entityDtos);
            }

            return(dto);
        }
        /// <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);
        }