/// <summary>Convert from TaxableAmountSum 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 TaxableAmountSum DTO</returns> public TaxableAmountSumDto ToDto(TaxableAmountSumDto dto = null) { dto = dto ?? new TaxableAmountSumDto(); dto.IsNew = false; dto.CreateDateTime = CreateDateTime; dto.CreateUserId = CreateUserId; dto.EmployerId = EmployerId; dto.Quarter1GrossAmt = Quarter1GrossAmt; dto.Quarter1TaxableAmt = Quarter1TaxableAmt; dto.Quarter2GrossAmt = Quarter2GrossAmt; dto.Quarter2TaxableAmt = Quarter2TaxableAmt; dto.Quarter3GrossAmt = Quarter3GrossAmt; dto.Quarter3TaxableAmt = Quarter3TaxableAmt; dto.Quarter4GrossAmt = Quarter4GrossAmt; dto.Quarter4TaxableAmt = Quarter4TaxableAmt; dto.ReportingQuarter = ReportingQuarter; dto.ReportingYear = ReportingYear; dto.StatusCode = StatusCode; dto.TaxableAmountSeqNo = TaxableAmountSeqNo; dto.UpdateDateTime = UpdateDateTime; dto.UpdateNumber = UpdateNumber; dto.UpdateProcess = UpdateProcess; dto.UpdateUserId = UpdateUserId; return(dto); }
public WageSubmissionViewModel() { ListWageUnitDetailDto = new List <WageUnitCustomDto>(); ListWageEmployerUnitSummary = new List <WageDetailSummaryViewModel>(); Employer = new EmployerDto(); EmployerAccountTransactionDto = new EmployerAccountTransactionDto(); TaxableAmountSumDto = new TaxableAmountSumDto(); }
protected static void FromDtoSet(FACTS.Framework.DAL.DbContext dbContext, TaxableAmountSumDto dto, TaxableAmountSum entity, Dictionary <FACTS.Framework.Dto.BaseDto, BaseEntity> dtoEntities) { entity.CreateDateTime = dto.CreateDateTime; entity.CreateUserId = dto.CreateUserId; entity.EmployerId = dto.EmployerId; entity.Quarter1GrossAmt = dto.Quarter1GrossAmt; entity.Quarter1TaxableAmt = dto.Quarter1TaxableAmt; entity.Quarter2GrossAmt = dto.Quarter2GrossAmt; entity.Quarter2TaxableAmt = dto.Quarter2TaxableAmt; entity.Quarter3GrossAmt = dto.Quarter3GrossAmt; entity.Quarter3TaxableAmt = dto.Quarter3TaxableAmt; entity.Quarter4GrossAmt = dto.Quarter4GrossAmt; entity.Quarter4TaxableAmt = dto.Quarter4TaxableAmt; entity.ReportingQuarter = dto.ReportingQuarter; entity.ReportingYear = dto.ReportingYear; entity.StatusCode = dto.StatusCode; entity.TaxableAmountSeqNo = dto.TaxableAmountSeqNo; 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); }
/// <summary>Convert from TaxableAmountSum 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 TaxableAmountSum entity</returns> public static TaxableAmountSum FromDto(FACTS.Framework.DAL.DbContext dbContext, TaxableAmountSumDto dto, Dictionary <FACTS.Framework.Dto.BaseDto, BaseEntity> dtoEntities = null) { dtoEntities = dtoEntities ?? new Dictionary <FACTS.Framework.Dto.BaseDto, BaseEntity>(); if (dtoEntities.ContainsKey(dto)) { return((TaxableAmountSum)dtoEntities[dto]); } TaxableAmountSum entity = new TaxableAmountSum(); 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 TaxableAmountSum 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 TaxableAmountSum DTO</returns> public TaxableAmountSumDto ToDtoDeep(FACTS.Framework.DAL.DbContext dbContext, TaxableAmountSumDto dto = null, Dictionary <BaseEntity, FACTS.Framework.Dto.BaseDto> entityDtos = null) { entityDtos = entityDtos ?? new Dictionary <BaseEntity, FACTS.Framework.Dto.BaseDto>(); if (entityDtos.ContainsKey(this)) { return((TaxableAmountSumDto)entityDtos[this]); } dto = ToDto(dto); entityDtos.Add(this, dto); System.Data.Entity.Infrastructure.DbEntityEntry <TaxableAmountSum> entry = dbContext?.Entry(this); dto.IsNew = (entry?.State == EntityState.Added); dto.IsDeleted = (entry?.State == EntityState.Deleted); if (entry?.Reference(x => x.Employer)?.IsLoaded == true) { dto.Employer = Employer?.ToDtoDeep(dbContext, entityDtos: entityDtos); } return(dto); }
/// <summary>Convert from TaxableAmountSum 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 TaxableAmountSum entity</returns> public static TaxableAmountSum FromDto(FACTS.Framework.DAL.DbContext dbContext, TaxableAmountSumDto dto, Dictionary <FACTS.Framework.Dto.BaseDto, BaseEntity> dtoEntities = null) { dtoEntities = dtoEntities ?? new Dictionary <FACTS.Framework.Dto.BaseDto, BaseEntity>(); if (dtoEntities.ContainsKey(dto)) { return((TaxableAmountSum)dtoEntities[dto]); } TaxableAmountSum entity = new TaxableAmountSum(); dtoEntities.Add(dto, entity); entity.CreateDateTime = dto.CreateDateTime; entity.CreateUserId = dto.CreateUserId; entity.EmployerId = dto.EmployerId; entity.Quarter1GrossAmt = dto.Quarter1GrossAmt; entity.Quarter1TaxableAmt = dto.Quarter1TaxableAmt; entity.Quarter2GrossAmt = dto.Quarter2GrossAmt; entity.Quarter2TaxableAmt = dto.Quarter2TaxableAmt; entity.Quarter3GrossAmt = dto.Quarter3GrossAmt; entity.Quarter3TaxableAmt = dto.Quarter3TaxableAmt; entity.Quarter4GrossAmt = dto.Quarter4GrossAmt; entity.Quarter4TaxableAmt = dto.Quarter4TaxableAmt; entity.ReportingQuarter = dto.ReportingQuarter; entity.ReportingYear = dto.ReportingYear; entity.StatusCode = dto.StatusCode; entity.TaxableAmountSeqNo = dto.TaxableAmountSeqNo; 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); }