/// <summary>Convert from EmployerAccountTransaction 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 EmployerAccountTransaction entity</returns> public static EmployerAccountTransaction FromDto(FACTS.Framework.DAL.DbContext dbContext, EmployerAccountTransactionDto dto, Dictionary <FACTS.Framework.Dto.BaseDto, BaseEntity> dtoEntities = null) { dtoEntities = dtoEntities ?? new Dictionary <FACTS.Framework.Dto.BaseDto, BaseEntity>(); if (dtoEntities.ContainsKey(dto)) { return((EmployerAccountTransaction)dtoEntities[dto]); } EmployerAccountTransaction entity = new EmployerAccountTransaction(); 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); }
/// <summary>Convert from EmployerAccountTransaction 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 EmployerAccountTransaction entity</returns> public static EmployerAccountTransaction FromDto(FACTS.Framework.DAL.DbContext dbContext, EmployerAccountTransactionDto dto, Dictionary <FACTS.Framework.Dto.BaseDto, BaseEntity> dtoEntities = null) { dtoEntities = dtoEntities ?? new Dictionary <FACTS.Framework.Dto.BaseDto, BaseEntity>(); if (dtoEntities.ContainsKey(dto)) { return((EmployerAccountTransaction)dtoEntities[dto]); } EmployerAccountTransaction entity = new EmployerAccountTransaction(); dtoEntities.Add(dto, entity); entity.CreateDateTime = dto.CreateDateTime; entity.CreateUserId = dto.CreateUserId; entity.DueDate = dto.DueDate; entity.EmployerId = dto.EmployerId; entity.OwedAmount = dto.OwedAmount; entity.ReportingQuarter = dto.ReportingQuarter; entity.ReportingYear = dto.ReportingYear; entity.StatusCode = dto.StatusCode; entity.ThresholdAmount = dto.ThresholdAmount; entity.TransactionSeqNo = dto.TransactionSeqNo; entity.TypeCode = dto.TypeCode; entity.UnpaidAmount = dto.UnpaidAmount; 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 (dbContext != null) { dbContext.Entry(entity).State = (dto.IsNew ? EntityState.Added : (dto.IsDeleted ? EntityState.Deleted : EntityState.Modified)); } return(entity); }
protected static void FromDtoSet(FACTS.Framework.DAL.DbContext dbContext, EmployerAccountTransactionDto dto, EmployerAccountTransaction entity, Dictionary <FACTS.Framework.Dto.BaseDto, BaseEntity> dtoEntities) { entity.CreateDateTime = dto.CreateDateTime; entity.CreateUserId = dto.CreateUserId; entity.DueDate = dto.DueDate; entity.EmployerId = dto.EmployerId; entity.OwedAmount = dto.OwedAmount; entity.ReportingQuarter = dto.ReportingQuarter; entity.ReportingYear = dto.ReportingYear; entity.StatusCode = dto.StatusCode; entity.ThresholdAmount = dto.ThresholdAmount; entity.TransactionSeqNo = dto.TransactionSeqNo; entity.TypeCode = dto.TypeCode; entity.UnpaidAmount = dto.UnpaidAmount; 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); }