Ejemplo n.º 1
0
        protected static void FromDtoSet(FACTS.Framework.DAL.DbContext dbContext, EmployerUnitDto dto, EmployerUnit entity, Dictionary <FACTS.Framework.Dto.BaseDto, BaseEntity> dtoEntities)
        {
            entity.CountyCode          = dto.CountyCode;
            entity.CreateDateTime      = dto.CreateDateTime;
            entity.CreateUserId        = dto.CreateUserId;
            entity.DoingBusinessAsName = dto.DoingBusinessAsName;
            entity.EmployerId          = dto.EmployerId;
            entity.EmployerUnitSeqNo   = dto.EmployerUnitSeqNo;
            entity.FirstWageDate       = dto.FirstWageDate;
            entity.StatusCode          = dto.StatusCode;
            entity.StatusDate          = dto.StatusDate;
            entity.UpdateDateTime      = dto.UpdateDateTime;
            entity.UpdateNumber        = dto.UpdateNumber;
            entity.UpdateProcess       = dto.UpdateProcess;
            entity.UpdateUserId        = dto.UpdateUserId;

            entity.Employer = (dto.Employer == null) ? null : Employer.FromDto(dbContext, dto.Employer, dtoEntities);
            if (dto.AddressLinks != null)
            {
                foreach (AddressLinkDto addressLink in dto.AddressLinks)
                {
                    entity.AddressLinks.Add(DbEntities.AddressLink.FromDto(dbContext, addressLink, dtoEntities));
                }
            }
        }
        protected static void FromDtoSet(FACTS.Framework.DAL.DbContext dbContext, VoluntaryPlanWaiverRequestDto dto, VoluntaryPlanWaiverRequest entity, Dictionary <FACTS.Framework.Dto.BaseDto, BaseEntity> dtoEntities)
        {
            entity.EmployerId = dto.EmployerId;
            entity.EndDate    = dto.EndDate;
            entity.IsVoluntaryPlanWaiverRequestAcknowledged = dto.IsVoluntaryPlanWaiverRequestAcknowledged;
            entity.StartDate = dto.StartDate;

            entity.Employer = (dto.Employer == null) ? null : Employer.FromDto(dbContext, dto.Employer, dtoEntities);
            if (dto.VoluntaryPlanWaiverRequestTypes != null)
            {
                foreach (VoluntaryPlanWaiverRequestTypeDto voluntaryPlanWaiverRequestType in dto.VoluntaryPlanWaiverRequestTypes)
                {
                    entity.VoluntaryPlanWaiverRequestTypes.Add(DbEntities.VoluntaryPlanWaiverRequestType.FromDto(dbContext, voluntaryPlanWaiverRequestType, dtoEntities));
                }
            }
        }
Ejemplo n.º 3
0
        /// <summary>Convert from VoluntaryPlanWaiverRequest 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 VoluntaryPlanWaiverRequest entity</returns>
        public static VoluntaryPlanWaiverRequest FromDto(FACTS.Framework.DAL.DbContext dbContext, VoluntaryPlanWaiverRequestDto dto, Dictionary <FACTS.Framework.Dto.BaseDto, BaseEntity> dtoEntities = null)
        {
            dtoEntities = dtoEntities ?? new Dictionary <FACTS.Framework.Dto.BaseDto, BaseEntity>();
            if (dtoEntities.ContainsKey(dto))
            {
                return((VoluntaryPlanWaiverRequest)dtoEntities[dto]);
            }

            VoluntaryPlanWaiverRequest entity = new VoluntaryPlanWaiverRequest();

            dtoEntities.Add(dto, entity);

            entity.CreateDateTime = dto.CreateDateTime;
            entity.CreateUserId   = dto.CreateUserId;
            entity.EmployerId     = dto.EmployerId;
            entity.EndDate        = dto.EndDate;
            entity.FormId         = dto.FormId;
            entity.IsVoluntaryPlanWaiverRequestAcknowledged = dto.IsVoluntaryPlanWaiverRequestAcknowledged;
            entity.StartDate      = dto.StartDate;
            entity.UpdateDateTime = dto.UpdateDateTime;
            entity.UpdateNumber   = dto.UpdateNumber;
            entity.UpdateProcess  = dto.UpdateProcess;
            entity.UpdateUserId   = dto.UpdateUserId;
            entity.VoluntaryPlanWaiverRequestId = dto.VoluntaryPlanWaiverRequestId;

            entity.Employer = (dto.Employer == null) ? null : Employer.FromDto(dbContext, dto.Employer, dtoEntities);
            entity.Form     = (dto.Form == null) ? null : Form.FromDto(dbContext, dto.Form, dtoEntities);
            if (dto.VoluntaryPlanWaiverRequestTypes != null)
            {
                foreach (VoluntaryPlanWaiverRequestTypeDto voluntaryPlanWaiverRequestType in dto.VoluntaryPlanWaiverRequestTypes)
                {
                    entity.VoluntaryPlanWaiverRequestTypes.Add(DbEntities.VoluntaryPlanWaiverRequestType.FromDto(dbContext, voluntaryPlanWaiverRequestType, dtoEntities));
                }
            }

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

            return(entity);
        }
Ejemplo n.º 4
0
        /// <summary>Convert from EmployerUnit 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 EmployerUnit entity</returns>
        public static EmployerUnit FromDto(FACTS.Framework.DAL.DbContext dbContext, EmployerUnitDto dto, Dictionary <FACTS.Framework.Dto.BaseDto, BaseEntity> dtoEntities = null)
        {
            dtoEntities = dtoEntities ?? new Dictionary <FACTS.Framework.Dto.BaseDto, BaseEntity>();
            if (dtoEntities.ContainsKey(dto))
            {
                return((EmployerUnit)dtoEntities[dto]);
            }

            EmployerUnit entity = new EmployerUnit();

            dtoEntities.Add(dto, entity);

            entity.CountyCode          = dto.CountyCode;
            entity.CreateDateTime      = dto.CreateDateTime;
            entity.CreateUserId        = dto.CreateUserId;
            entity.DoingBusinessAsName = dto.DoingBusinessAsName;
            entity.EmployerId          = dto.EmployerId;
            entity.EmployerUnitSeqNo   = dto.EmployerUnitSeqNo;
            entity.FirstWageDate       = dto.FirstWageDate;
            entity.StatusCode          = dto.StatusCode;
            entity.StatusDate          = dto.StatusDate;
            entity.UpdateDateTime      = dto.UpdateDateTime;
            entity.UpdateNumber        = dto.UpdateNumber;
            entity.UpdateProcess       = dto.UpdateProcess;
            entity.UpdateUserId        = dto.UpdateUserId;

            entity.Employer = (dto.Employer == null) ? null : Employer.FromDto(dbContext, dto.Employer, dtoEntities);
            if (dto.AddressLinks != null)
            {
                foreach (AddressLinkDto addressLink in dto.AddressLinks)
                {
                    entity.AddressLinks.Add(DbEntities.AddressLink.FromDto(dbContext, addressLink, dtoEntities));
                }
            }

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

            return(entity);
        }
Ejemplo n.º 5
0
        protected static void FromDtoSet(FACTS.Framework.DAL.DbContext dbContext, AddressLinkDto dto, AddressLink entity, Dictionary <FACTS.Framework.Dto.BaseDto, BaseEntity> dtoEntities)
        {
            entity.AddressId         = dto.AddressId;
            entity.AddressLinkId     = dto.AddressLinkId;
            entity.AddressTypeCode   = dto.AddressTypeCode;
            entity.AgentId           = dto.AgentId;
            entity.CreateDateTime    = dto.CreateDateTime;
            entity.CreateUserId      = dto.CreateUserId;
            entity.EmployerId        = dto.EmployerId;
            entity.EmployerUnitSeqNo = dto.EmployerUnitSeqNo;
            entity.StatusCode        = dto.StatusCode;
            entity.UpdateDateTime    = dto.UpdateDateTime;
            entity.UpdateNumber      = dto.UpdateNumber;
            entity.UpdateProcess     = dto.UpdateProcess;
            entity.UpdateUserId      = dto.UpdateUserId;

            entity.Address      = (dto.Address == null) ? null : Address.FromDto(dbContext, dto.Address, dtoEntities);
            entity.Employer     = (dto.Employer == null) ? null : Employer.FromDto(dbContext, dto.Employer, dtoEntities);
            entity.EmployerUnit = (dto.EmployerUnit == null) ? null : EmployerUnit.FromDto(dbContext, dto.EmployerUnit, dtoEntities);
        }
Ejemplo n.º 6
0
        /// <summary>Convert from AddressLink 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 AddressLink entity</returns>
        public static AddressLink FromDto(FACTS.Framework.DAL.DbContext dbContext, AddressLinkDto dto, Dictionary <FACTS.Framework.Dto.BaseDto, BaseEntity> dtoEntities = null)
        {
            dtoEntities = dtoEntities ?? new Dictionary <FACTS.Framework.Dto.BaseDto, BaseEntity>();
            if (dtoEntities.ContainsKey(dto))
            {
                return((AddressLink)dtoEntities[dto]);
            }

            AddressLink entity = new AddressLink();

            dtoEntities.Add(dto, entity);

            entity.AddressId         = dto.AddressId;
            entity.AddressLinkId     = dto.AddressLinkId;
            entity.AddressTypeCode   = dto.AddressTypeCode;
            entity.AgentId           = dto.AgentId;
            entity.CreateDateTime    = dto.CreateDateTime;
            entity.CreateUserId      = dto.CreateUserId;
            entity.EmployerId        = dto.EmployerId;
            entity.EmployerUnitSeqNo = dto.EmployerUnitSeqNo;
            entity.StatusCode        = dto.StatusCode;
            entity.UpdateDateTime    = dto.UpdateDateTime;
            entity.UpdateNumber      = dto.UpdateNumber;
            entity.UpdateProcess     = dto.UpdateProcess;
            entity.UpdateUserId      = dto.UpdateUserId;

            entity.Address      = (dto.Address == null) ? null : Address.FromDto(dbContext, dto.Address, dtoEntities);
            entity.Employer     = (dto.Employer == null) ? null : Employer.FromDto(dbContext, dto.Employer, dtoEntities);
            entity.EmployerUnit = (dto.EmployerUnit == null) ? null : EmployerUnit.FromDto(dbContext, dto.EmployerUnit, dtoEntities);

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

            return(entity);
        }