public MakePaymentViewModel() { PaymentMainDto = new PaymentMainDto(); PaymentProfileDto = new PaymentProfileDto(); EmployerAccountTransactionDto = new EmployerAccountTransactionDto(); EmployerDto = new EmployerDto(); }
public WageSubmissionViewModel() { ListWageUnitDetailDto = new List <WageUnitDetailDto>(); ListWageEmployerUnitSummary = new List <WageDetailSummary>(); Employer = new EmployerDto(); EmployerAccountTransactionDto = new EmployerAccountTransactionDto(); }
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); }
/// <summary>Convert from EmployerAccountTransaction 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 EmployerAccountTransaction DTO</returns> public EmployerAccountTransactionDto ToDto(EmployerAccountTransactionDto dto = null) { dto = dto ?? new EmployerAccountTransactionDto(); dto.IsNew = false; dto.CreateDateTime = CreateDateTime; dto.CreateUserId = CreateUserId; dto.DueDate = DueDate; dto.EmployerId = EmployerId; dto.OwedAmount = OwedAmount; dto.ReportingQuarter = ReportingQuarter; dto.ReportingYear = ReportingYear; dto.StatusCode = StatusCode; dto.ThresholdAmount = ThresholdAmount; dto.TransactionSeqNo = TransactionSeqNo; dto.TypeCode = TypeCode; dto.UnpaidAmount = UnpaidAmount; dto.UpdateDateTime = UpdateDateTime; dto.UpdateNumber = UpdateNumber; dto.UpdateProcess = UpdateProcess; dto.UpdateUserId = UpdateUserId; return(dto); }
public EmployerAccountTransactionCustomDto() { employerAccountTransactionCustDto = new EmployerAccountTransactionDto(); }
/// <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); }
/// <summary>Convert from EmployerAccountTransaction 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 EmployerAccountTransaction DTO</returns> public EmployerAccountTransactionDto ToDtoDeep(FACTS.Framework.DAL.DbContext dbContext, EmployerAccountTransactionDto dto = null, Dictionary <BaseEntity, FACTS.Framework.Dto.BaseDto> entityDtos = null) { entityDtos = entityDtos ?? new Dictionary <BaseEntity, FACTS.Framework.Dto.BaseDto>(); if (entityDtos.ContainsKey(this)) { return((EmployerAccountTransactionDto)entityDtos[this]); } dto = ToDto(dto); entityDtos.Add(this, dto); System.Data.Entity.Infrastructure.DbEntityEntry <EmployerAccountTransaction> 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 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); }
public static MakePaymentViewModel GetEmployerDueAmount(int emprAccountID) { MakePaymentViewModel LocalPaymentViewModel = new MakePaymentViewModel(); EmployerAccountTransactionDto localEmployerAccountTransaction = new EmployerAccountTransactionDto(); EmployerDto localEmployerDto = new EmployerDto(); PaymentMainDto localPaymentMainDto = new PaymentMainDto(); PaymentProfileDto localPaymentProfileDto = new PaymentProfileDto(); using (DbContext context = new DbContext()) { localEmployerDto = (from employerDetail in context.Employers where employerDetail.EmployerId == emprAccountID select new EmployerDto { EmployerId = employerDetail.EmployerId, EntityName = employerDetail.EntityName, }).FirstOrDefault(); if (localEmployerDto != null) { localEmployerAccountTransaction = (from emptranDetail in context.EmployerAccountTransactions where emptranDetail.EmployerId == localEmployerDto.EmployerId select new EmployerAccountTransactionDto { OwedAmount = emptranDetail.OwedAmount, UnpaidAmount = emptranDetail.UnpaidAmount }).FirstOrDefault(); localPaymentMainDto = (from pmtMainDetail in context.PaymentMains where pmtMainDetail.EmployerId == localEmployerAccountTransaction.EmployerId select new PaymentMainDto { RoutingTransitNumber = pmtMainDetail.RoutingTransitNumber, BankAccountNumber = pmtMainDetail.BankAccountNumber, BankAccountTypeCode = pmtMainDetail.BankAccountTypeCode, PaymentAmount = pmtMainDetail.PaymentAmount, PaymentTransactionDate = pmtMainDetail.PaymentTransactionDate, PaymentMethodCode = pmtMainDetail.PaymentMethodCode, PaymentStatusCode = pmtMainDetail.PaymentStatusCode, PaymentMainId = pmtMainDetail.PaymentMainId }).FirstOrDefault(); localPaymentProfileDto = (from pmtProfile in context.PaymentProfiles where pmtProfile.EmployerId == localPaymentMainDto.EmployerId && pmtProfile.BankAccountNumber == localPaymentMainDto.BankAccountNumber select new PaymentProfileDto { AgentId = pmtProfile.AgentId, BankAccountNumber = pmtProfile.BankAccountNumber, CreateDateTime = pmtProfile.CreateDateTime, CreateUserId = pmtProfile.CreateUserId, EmployerId = pmtProfile.EmployerId, PaymentAccountTypeCode = pmtProfile.PaymentAccountTypeCode, PaymentProfileId = pmtProfile.PaymentProfileId, PaymentTypeCode = pmtProfile.PaymentTypeCode, RoutingTransitNumber = pmtProfile.RoutingTransitNumber, UpdateDateTime = pmtProfile.UpdateDateTime, UpdateNumber = pmtProfile.UpdateNumber, UpdateUserId = pmtProfile.UpdateUserId, }).FirstOrDefault(); } } LocalPaymentViewModel.EmployerAccountTransactionDto = localEmployerAccountTransaction; LocalPaymentViewModel.EmployerDto = localEmployerDto; LocalPaymentViewModel.PaymentMainDto = localPaymentMainDto; LocalPaymentViewModel.PaymentProfileDto = localPaymentProfileDto; return(LocalPaymentViewModel); }