protected static void FromDtoSet(FACTS.Framework.DAL.DbContext dbContext, LookupNameDto dto, LookupName entity, Dictionary <FACTS.Framework.Dto.BaseDto, BaseEntity> dtoEntities) { entity.CreateDateTime = dto.CreateDateTime; entity.CreateUserId = dto.CreateUserId; entity.Description = dto.Description; entity.Name = dto.Name; entity.UpdateDateTime = dto.UpdateDateTime; entity.UpdateNumber = dto.UpdateNumber; entity.UpdateProcess = dto.UpdateProcess; entity.UpdateUserId = dto.UpdateUserId; if (dto.LookupCodes != null) { foreach (LookupCodeDto lookupCode in dto.LookupCodes) { entity.LookupCodes.Add(DbEntities.LookupCode.FromDto(dbContext, lookupCode, dtoEntities)); } } if (dto.LookupProperties != null) { foreach (LookupPropertyDto lookupProperty in dto.LookupProperties) { entity.LookupProperties.Add(DbEntities.LookupProperty.FromDto(dbContext, lookupProperty, dtoEntities)); } } }
/// <summary>Convert from LookupValue 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 LookupValue entity</returns> public static LookupValue FromDto(FACTS.Framework.DAL.DbContext dbContext, LookupValueDto dto, Dictionary <FACTS.Framework.Dto.BaseDto, BaseEntity> dtoEntities = null) { dtoEntities = dtoEntities ?? new Dictionary <FACTS.Framework.Dto.BaseDto, BaseEntity>(); if (dtoEntities.ContainsKey(dto)) { return((LookupValue)dtoEntities[dto]); } LookupValue entity = new LookupValue(); dtoEntities.Add(dto, entity); entity.Code = dto.Code; entity.CreateDateTime = dto.CreateDateTime; entity.CreateUserId = dto.CreateUserId; entity.Description = dto.Description; entity.Name = dto.Name; entity.Property = dto.Property; entity.UpdateDateTime = dto.UpdateDateTime; entity.UpdateUserId = dto.UpdateUserId; entity.Value = dto.Value; entity.LookupCode = (dto.LookupCode == null) ? null : LookupCode.FromDto(dbContext, dto.LookupCode, dtoEntities); entity.LookupProperty = (dto.LookupProperty == null) ? null : LookupProperty.FromDto(dbContext, dto.LookupProperty, dtoEntities); if (dbContext != null) { dbContext.Entry(entity).State = (dto.IsNew ? EntityState.Added : (dto.IsDeleted ? EntityState.Deleted : EntityState.Modified)); } return(entity); }
/// <summary>Convert from SecurityDefinition 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 SecurityDefinition entity</returns> public static SecurityDefinition FromDto(FACTS.Framework.DAL.DbContext dbContext, SecurityDefinitionDto dto, Dictionary <FACTS.Framework.Dto.BaseDto, BaseEntity> dtoEntities = null) { dtoEntities = dtoEntities ?? new Dictionary <FACTS.Framework.Dto.BaseDto, BaseEntity>(); if (dtoEntities.ContainsKey(dto)) { return((SecurityDefinition)dtoEntities[dto]); } SecurityDefinition entity = new SecurityDefinition(); dtoEntities.Add(dto, entity); entity.CreateDateTime = dto.CreateDateTime; entity.CreateUserId = dto.CreateUserId; entity.Description = dto.Description; entity.Name = dto.Name; entity.Type = dto.Type; entity.UpdateDateTime = dto.UpdateDateTime; entity.UpdateUserId = dto.UpdateUserId; if (dbContext != null) { dbContext.Entry(entity).State = (dto.IsNew ? EntityState.Added : (dto.IsDeleted ? EntityState.Deleted : EntityState.Modified)); } return(entity); }
/// <summary>Convert from LookupProperty 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 LookupProperty DTO</returns> public LookupPropertyDto ToDtoDeep(FACTS.Framework.DAL.DbContext dbContext, LookupPropertyDto dto = null, Dictionary <BaseEntity, FACTS.Framework.Dto.BaseDto> entityDtos = null) { entityDtos = entityDtos ?? new Dictionary <BaseEntity, FACTS.Framework.Dto.BaseDto>(); if (entityDtos.ContainsKey(this)) { return((LookupPropertyDto)entityDtos[this]); } dto = ToDto(dto); entityDtos.Add(this, dto); System.Data.Entity.Infrastructure.DbEntityEntry <LookupProperty> entry = dbContext?.Entry(this); dto.IsNew = (entry?.State == EntityState.Added); dto.IsDeleted = (entry?.State == EntityState.Deleted); if (entry?.Reference(x => x.LookupName)?.IsLoaded == true) { dto.LookupName = LookupName?.ToDtoDeep(dbContext, entityDtos: entityDtos); } if (entry?.Collection(x => x.LookupValues)?.IsLoaded == true) { foreach (LookupValue lookupValue in LookupValues) { dto.LookupValues.Add(lookupValue.ToDtoDeep(dbContext, entityDtos: entityDtos)); } } return(dto); }
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)); } } }
/// <summary>Convert from Form 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 Form DTO</returns> public FormDto ToDtoDeep(FACTS.Framework.DAL.DbContext dbContext, FormDto dto = null, Dictionary <BaseEntity, FACTS.Framework.Dto.BaseDto> entityDtos = null) { entityDtos = entityDtos ?? new Dictionary <BaseEntity, FACTS.Framework.Dto.BaseDto>(); if (entityDtos.ContainsKey(this)) { return((FormDto)entityDtos[this]); } dto = ToDto(dto); entityDtos.Add(this, dto); System.Data.Entity.Infrastructure.DbEntityEntry <Form> entry = dbContext?.Entry(this); dto.IsNew = (entry?.State == EntityState.Added); dto.IsDeleted = (entry?.State == EntityState.Deleted); if (entry?.Collection(x => x.FormAttachments)?.IsLoaded == true) { foreach (FormAttachment formAttachment in FormAttachments) { dto.FormAttachments.Add(formAttachment.ToDtoDeep(dbContext, entityDtos: entityDtos)); } } if (entry?.Collection(x => x.VoluntaryPlanWaiverRequests)?.IsLoaded == true) { foreach (VoluntaryPlanWaiverRequest voluntaryPlanWaiverRequest in VoluntaryPlanWaiverRequests) { dto.VoluntaryPlanWaiverRequests.Add(voluntaryPlanWaiverRequest.ToDtoDeep(dbContext, entityDtos: entityDtos)); } } return(dto); }
/// <summary>Convert from VoluntaryPlanWaiverRequest 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 VoluntaryPlanWaiverRequest DTO</returns> public VoluntaryPlanWaiverRequestDto ToDtoDeep(FACTS.Framework.DAL.DbContext dbContext, VoluntaryPlanWaiverRequestDto dto = null, Dictionary <BaseEntity, FACTS.Framework.Dto.BaseDto> entityDtos = null) { entityDtos = entityDtos ?? new Dictionary <BaseEntity, FACTS.Framework.Dto.BaseDto>(); if (entityDtos.ContainsKey(this)) { return((VoluntaryPlanWaiverRequestDto)entityDtos[this]); } dto = ToDto(dto); entityDtos.Add(this, dto); System.Data.Entity.Infrastructure.DbEntityEntry <VoluntaryPlanWaiverRequest> 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); } if (entry?.Reference(x => x.Form)?.IsLoaded == true) { dto.Form = Form?.ToDtoDeep(dbContext, entityDtos: entityDtos); } if (entry?.Collection(x => x.VoluntaryPlanWaiverRequestTypes)?.IsLoaded == true) { foreach (VoluntaryPlanWaiverRequestType voluntaryPlanWaiverRequestType in VoluntaryPlanWaiverRequestTypes) { dto.VoluntaryPlanWaiverRequestTypes.Add(voluntaryPlanWaiverRequestType.ToDtoDeep(dbContext, entityDtos: entityDtos)); } } return(dto); }
/// <summary>Convert from PaymentProfile 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 PaymentProfile entity</returns> public static PaymentProfile FromDto(FACTS.Framework.DAL.DbContext dbContext, PaymentProfileDto dto, Dictionary <FACTS.Framework.Dto.BaseDto, BaseEntity> dtoEntities = null) { dtoEntities = dtoEntities ?? new Dictionary <FACTS.Framework.Dto.BaseDto, BaseEntity>(); if (dtoEntities.ContainsKey(dto)) { return((PaymentProfile)dtoEntities[dto]); } PaymentProfile entity = new PaymentProfile(); dtoEntities.Add(dto, entity); entity.AgentId = dto.AgentId; entity.BankAccountNumber = dto.BankAccountNumber; entity.CreateDateTime = dto.CreateDateTime; entity.CreateUserId = dto.CreateUserId; entity.EmployerId = dto.EmployerId; entity.PaymentAccountTypeCode = dto.PaymentAccountTypeCode; entity.PaymentProfileId = dto.PaymentProfileId; entity.PaymentTypeCode = dto.PaymentTypeCode; entity.RoutingTransitNumber = dto.RoutingTransitNumber; 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 AddressLink 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 AddressLink DTO</returns> public AddressLinkDto ToDtoDeep(FACTS.Framework.DAL.DbContext dbContext, AddressLinkDto dto = null, Dictionary <BaseEntity, FACTS.Framework.Dto.BaseDto> entityDtos = null) { entityDtos = entityDtos ?? new Dictionary <BaseEntity, FACTS.Framework.Dto.BaseDto>(); if (entityDtos.ContainsKey(this)) { return((AddressLinkDto)entityDtos[this]); } dto = ToDto(dto); entityDtos.Add(this, dto); System.Data.Entity.Infrastructure.DbEntityEntry <AddressLink> entry = dbContext?.Entry(this); dto.IsNew = (entry?.State == EntityState.Added); dto.IsDeleted = (entry?.State == EntityState.Deleted); if (entry?.Reference(x => x.Address)?.IsLoaded == true) { dto.Address = Address?.ToDtoDeep(dbContext, entityDtos: entityDtos); } if (entry?.Reference(x => x.Employer)?.IsLoaded == true) { dto.Employer = Employer?.ToDtoDeep(dbContext, entityDtos: entityDtos); } if (entry?.Reference(x => x.EmployerUnit)?.IsLoaded == true) { dto.EmployerUnit = EmployerUnit?.ToDtoDeep(dbContext, entityDtos: entityDtos); } return(dto); }
/// <summary>Convert from EmployerPreference 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 EmployerPreference entity</returns> public static EmployerPreference FromDto(FACTS.Framework.DAL.DbContext dbContext, EmployerPreferenceDto dto, Dictionary <FACTS.Framework.Dto.BaseDto, BaseEntity> dtoEntities = null) { dtoEntities = dtoEntities ?? new Dictionary <FACTS.Framework.Dto.BaseDto, BaseEntity>(); if (dtoEntities.ContainsKey(dto)) { return((EmployerPreference)dtoEntities[dto]); } EmployerPreference entity = new EmployerPreference(); dtoEntities.Add(dto, entity); entity.CorrespondanceTypeCode = dto.CorrespondanceTypeCode; entity.CreateDateTime = dto.CreateDateTime; entity.CreateUserId = dto.CreateUserId; entity.Email = dto.Email; entity.EmployerId = dto.EmployerId; 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 FormAttachment 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 FormAttachment entity</returns> public static FormAttachment FromDto(FACTS.Framework.DAL.DbContext dbContext, FormAttachmentDto dto, Dictionary <FACTS.Framework.Dto.BaseDto, BaseEntity> dtoEntities = null) { dtoEntities = dtoEntities ?? new Dictionary <FACTS.Framework.Dto.BaseDto, BaseEntity>(); if (dtoEntities.ContainsKey(dto)) { return((FormAttachment)dtoEntities[dto]); } FormAttachment entity = new FormAttachment(); dtoEntities.Add(dto, entity); entity.CreateDateTime = dto.CreateDateTime; entity.CreateUserId = dto.CreateUserId; entity.DocumentId = dto.DocumentId; entity.FormAttachmentId = dto.FormAttachmentId; entity.FormId = dto.FormId; entity.UpdateDateTime = dto.UpdateDateTime; entity.UpdateNumber = dto.UpdateNumber; entity.UpdateProcess = dto.UpdateProcess; entity.UpdateUserId = dto.UpdateUserId; entity.Document = (dto.Document == null) ? null : Document.FromDto(dbContext, dto.Document, dtoEntities); entity.Form = (dto.Form == null) ? null : Form.FromDto(dbContext, dto.Form, dtoEntities); if (dbContext != null) { dbContext.Entry(entity).State = (dto.IsNew ? EntityState.Added : (dto.IsDeleted ? EntityState.Deleted : EntityState.Modified)); } return(entity); }
/// <summary>Convert from FormAttachment 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 FormAttachment DTO</returns> public FormAttachmentDto ToDtoDeep(FACTS.Framework.DAL.DbContext dbContext, FormAttachmentDto dto = null, Dictionary <BaseEntity, FACTS.Framework.Dto.BaseDto> entityDtos = null) { entityDtos = entityDtos ?? new Dictionary <BaseEntity, FACTS.Framework.Dto.BaseDto>(); if (entityDtos.ContainsKey(this)) { return((FormAttachmentDto)entityDtos[this]); } dto = ToDto(dto); entityDtos.Add(this, dto); System.Data.Entity.Infrastructure.DbEntityEntry <FormAttachment> entry = dbContext?.Entry(this); dto.IsNew = (entry?.State == EntityState.Added); dto.IsDeleted = (entry?.State == EntityState.Deleted); if (entry?.Reference(x => x.Document)?.IsLoaded == true) { dto.Document = Document?.ToDtoDeep(dbContext, entityDtos: entityDtos); } if (entry?.Reference(x => x.Form)?.IsLoaded == true) { dto.Form = Form?.ToDtoDeep(dbContext, entityDtos: entityDtos); } return(dto); }
/// <summary>Convert from SecurityPermission 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 SecurityPermission entity</returns> public static SecurityPermission FromDto(FACTS.Framework.DAL.DbContext dbContext, SecurityPermissionDto dto, Dictionary <FACTS.Framework.Dto.BaseDto, BaseEntity> dtoEntities = null) { dtoEntities = dtoEntities ?? new Dictionary <FACTS.Framework.Dto.BaseDto, BaseEntity>(); if (dtoEntities.ContainsKey(dto)) { return((SecurityPermission)dtoEntities[dto]); } SecurityPermission entity = new SecurityPermission(); dtoEntities.Add(dto, entity); entity.AccessType = dto.AccessType; entity.CreateDateTime = dto.CreateDateTime; entity.CreateUserId = dto.CreateUserId; entity.SourceName = dto.SourceName; entity.SourceType = dto.SourceType; entity.TargetName = dto.TargetName; entity.TargetType = dto.TargetType; entity.UpdateDateTime = dto.UpdateDateTime; entity.UpdateNumber = dto.UpdateNumber; entity.UpdateProcess = dto.UpdateProcess; entity.UpdateUserId = dto.UpdateUserId; 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, WageUnitDetailDto dto, WageUnitDetail entity, Dictionary <FACTS.Framework.Dto.BaseDto, BaseEntity> dtoEntities) { entity.AdjReasonCode = dto.AdjReasonCode; entity.CreateDateTime = dto.CreateDateTime; entity.CreateUserId = dto.CreateUserId; entity.EmployerId = dto.EmployerId; entity.EmployerUnitId = dto.EmployerUnitId; entity.FilingMethod = dto.FilingMethod; entity.FirstName = dto.FirstName; entity.HoursWorked = dto.HoursWorked; entity.IsEmploymentMonth1 = dto.IsEmploymentMonth1; entity.IsEmploymentMonth2 = dto.IsEmploymentMonth2; entity.IsEmploymentMonth3 = dto.IsEmploymentMonth3; entity.IsOwnerOrOfficer = dto.IsOwnerOrOfficer; entity.LastName = dto.LastName; entity.MiddleInitialName = dto.MiddleInitialName; entity.Occupation = dto.Occupation; entity.ReportingQuarter = dto.ReportingQuarter; entity.ReportingYear = dto.ReportingYear; entity.Ssn = dto.Ssn; entity.UpdateDateTime = dto.UpdateDateTime; entity.UpdateNumber = dto.UpdateNumber; entity.UpdateProcess = dto.UpdateProcess; entity.UpdateUserId = dto.UpdateUserId; entity.WageAmount = dto.WageAmount; entity.Employer = (dto.Employer == null) ? null : Employer.FromDto(dbContext, dto.Employer, dtoEntities); }
/// <summary>Convert from Address 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 Address DTO</returns> public AddressDto ToDtoDeep(FACTS.Framework.DAL.DbContext dbContext, AddressDto dto = null, Dictionary <BaseEntity, FACTS.Framework.Dto.BaseDto> entityDtos = null) { entityDtos = entityDtos ?? new Dictionary <BaseEntity, FACTS.Framework.Dto.BaseDto>(); if (entityDtos.ContainsKey(this)) { return((AddressDto)entityDtos[this]); } dto = ToDto(dto); entityDtos.Add(this, dto); System.Data.Entity.Infrastructure.DbEntityEntry <Address> entry = dbContext?.Entry(this); dto.IsNew = (entry?.State == EntityState.Added); dto.IsDeleted = (entry?.State == EntityState.Deleted); if (entry?.Collection(x => x.AddressLinks)?.IsLoaded == true) { foreach (AddressLink addressLink in AddressLinks) { dto.AddressLinks.Add(addressLink.ToDtoDeep(dbContext, entityDtos: entityDtos)); } } return(dto); }
/// <summary>Convert from TaxRate 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 TaxRate entity</returns> public static TaxRate FromDto(FACTS.Framework.DAL.DbContext dbContext, TaxRateDto dto, Dictionary <FACTS.Framework.Dto.BaseDto, BaseEntity> dtoEntities = null) { dtoEntities = dtoEntities ?? new Dictionary <FACTS.Framework.Dto.BaseDto, BaseEntity>(); if (dtoEntities.ContainsKey(dto)) { return((TaxRate)dtoEntities[dto]); } TaxRate entity = new TaxRate(); dtoEntities.Add(dto, entity); entity._TaxRate = dto._TaxRate; entity.CreateDateTime = dto.CreateDateTime; entity.CreateUserId = dto.CreateUserId; entity.EffectiveBeginDate = dto.EffectiveBeginDate; entity.EffectiveEndDate = dto.EffectiveEndDate; entity.TaxRateId = dto.TaxRateId; entity.UpdateDateTime = dto.UpdateDateTime; entity.UpdateNumber = dto.UpdateNumber; entity.UpdateProcess = dto.UpdateProcess; entity.UpdateUserId = dto.UpdateUserId; if (dbContext != null) { dbContext.Entry(entity).State = (dto.IsNew ? EntityState.Added : (dto.IsDeleted ? EntityState.Deleted : EntityState.Modified)); } return(entity); }
/// <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); }
/// <summary>Convert L2E Form to list of DTOs</summary> /// <param name="entities">L2E Forms</param> /// <param name="dbContext">DB Context to use for setting state of DTO</param> /// <returns>List of DTO Forms</returns> public static List <FormDto> ToDtoListDeep(this IQueryable <Form> entities, FACTS.Framework.DAL.DbContext dbContext) { Dictionary <BaseEntity, FACTS.Framework.Dto.BaseDto> entityDtos = new Dictionary <BaseEntity, FACTS.Framework.Dto.BaseDto>(); List <FormDto> dtos = new List <FormDto>(); foreach (Form entity in entities) { dtos.Add(entity.ToDtoDeep(dbContext, entityDtos: entityDtos)); } return(dtos); }
/// <summary>Convert L2E Address to list of customized DTOs</summary> /// <typeparam name="T">Custom DTO derived from AddressDto</typeparam> /// <param name="entities">L2E Addresses</param> /// <param name="dbContext">DB Context to use for setting state of DTO</param> /// <returns>List of DTO customized Addresses</returns> public static List <T> ToDtoListDeep <T>(this IQueryable <Address> entities, FACTS.Framework.DAL.DbContext dbContext) where T : AddressDto, new() { Dictionary <BaseEntity, FACTS.Framework.Dto.BaseDto> entityDtos = new Dictionary <BaseEntity, FACTS.Framework.Dto.BaseDto>(); List <T> dtos = new List <T>(); foreach (Address entity in entities) { dtos.Add((T)entity.ToDtoDeep(dbContext, new T(), entityDtos)); } return(dtos); }
/// <summary>Convert from Address 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 Address entity</returns> public static Address FromDto(FACTS.Framework.DAL.DbContext dbContext, AddressDto dto, Dictionary <FACTS.Framework.Dto.BaseDto, BaseEntity> dtoEntities = null) { dtoEntities = dtoEntities ?? new Dictionary <FACTS.Framework.Dto.BaseDto, BaseEntity>(); if (dtoEntities.ContainsKey(dto)) { return((Address)dtoEntities[dto]); } Address entity = new Address(); dtoEntities.Add(dto, entity); entity.AddressId = dto.AddressId; entity.AddressLine1 = dto.AddressLine1; entity.AddressLine2 = dto.AddressLine2; entity.AddressVerificationCode = dto.AddressVerificationCode; entity.Attention = dto.Attention; entity.BusinessWebAddress = dto.BusinessWebAddress; entity.City = dto.City; entity.CountryCode = dto.CountryCode; entity.CountyCode = dto.CountyCode; entity.CreateDateTime = dto.CreateDateTime; entity.CreateUserId = dto.CreateUserId; entity.Email = dto.Email; entity.FaxNumber = dto.FaxNumber; entity.IntFaxNumber = dto.IntFaxNumber; entity.IntPhoneNumber = dto.IntPhoneNumber; entity.IntPhoneNumberExtn = dto.IntPhoneNumberExtn; entity.OtherPhoneNumber = dto.OtherPhoneNumber; entity.OtherPhoneNumberExtn = dto.OtherPhoneNumberExtn; entity.PhoneNumber = dto.PhoneNumber; entity.PhoneNumberExtn = dto.PhoneNumberExtn; entity.StateCode = dto.StateCode; entity.UpdateDateTime = dto.UpdateDateTime; entity.UpdateNumber = dto.UpdateNumber; entity.UpdateProcess = dto.UpdateProcess; entity.UpdateUserId = dto.UpdateUserId; entity.Zip = dto.Zip; 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); }
protected static void FromDtoSet(FACTS.Framework.DAL.DbContext dbContext, SecurityDefinitionDto dto, SecurityDefinition entity, Dictionary <FACTS.Framework.Dto.BaseDto, BaseEntity> dtoEntities) { entity.CreateDateTime = dto.CreateDateTime; entity.CreateUserId = dto.CreateUserId; entity.Description = dto.Description; entity.Name = dto.Name; entity.Type = dto.Type; entity.UpdateDateTime = dto.UpdateDateTime; entity.UpdateNumber = dto.UpdateNumber; entity.UpdateProcess = dto.UpdateProcess; entity.UpdateUserId = dto.UpdateUserId; }
protected static void FromDtoSet(FACTS.Framework.DAL.DbContext dbContext, TaxRateDto dto, TaxRate entity, Dictionary <FACTS.Framework.Dto.BaseDto, BaseEntity> dtoEntities) { entity._TaxRate = dto._TaxRate; entity.CreateDateTime = dto.CreateDateTime; entity.CreateUserId = dto.CreateUserId; entity.EffectiveBeginDate = dto.EffectiveBeginDate; entity.EffectiveEndDate = dto.EffectiveEndDate; entity.TaxRateId = dto.TaxRateId; entity.UpdateDateTime = dto.UpdateDateTime; entity.UpdateNumber = dto.UpdateNumber; entity.UpdateProcess = dto.UpdateProcess; entity.UpdateUserId = dto.UpdateUserId; }
protected static void FromDtoSet(FACTS.Framework.DAL.DbContext dbContext, SecurityPermissionDto dto, SecurityPermission entity, Dictionary <FACTS.Framework.Dto.BaseDto, BaseEntity> dtoEntities) { entity.AccessType = dto.AccessType; entity.CreateDateTime = dto.CreateDateTime; entity.CreateUserId = dto.CreateUserId; entity.SourceName = dto.SourceName; entity.SourceType = dto.SourceType; entity.TargetName = dto.TargetName; entity.TargetType = dto.TargetType; entity.UpdateDateTime = dto.UpdateDateTime; entity.UpdateNumber = dto.UpdateNumber; entity.UpdateProcess = dto.UpdateProcess; entity.UpdateUserId = dto.UpdateUserId; }
protected static void FromDtoSet(FACTS.Framework.DAL.DbContext dbContext, EmployerPreferenceDto dto, EmployerPreference entity, Dictionary <FACTS.Framework.Dto.BaseDto, BaseEntity> dtoEntities) { entity.CorrespondanceTypeCode = dto.CorrespondanceTypeCode; entity.CreateDateTime = dto.CreateDateTime; entity.CreateUserId = dto.CreateUserId; entity.Email = dto.Email; entity.EmployerId = dto.EmployerId; 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); }
protected static void FromDtoSet(FACTS.Framework.DAL.DbContext dbContext, FormAttachmentDto dto, FormAttachment entity, Dictionary <FACTS.Framework.Dto.BaseDto, BaseEntity> dtoEntities) { entity.CreateDateTime = dto.CreateDateTime; entity.CreateUserId = dto.CreateUserId; entity.DocumentId = dto.DocumentId; entity.FormAttachmentId = dto.FormAttachmentId; entity.FormId = dto.FormId; entity.UpdateDateTime = dto.UpdateDateTime; entity.UpdateNumber = dto.UpdateNumber; entity.UpdateProcess = dto.UpdateProcess; entity.UpdateUserId = dto.UpdateUserId; entity.Document = (dto.Document == null) ? null : Document.FromDto(dbContext, dto.Document, dtoEntities); entity.Form = (dto.Form == null) ? null : Form.FromDto(dbContext, dto.Form, dtoEntities); }
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); }
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)); } } }
protected static void FromDtoSet(FACTS.Framework.DAL.DbContext dbContext, LookupValueDto dto, LookupValue entity, Dictionary <FACTS.Framework.Dto.BaseDto, BaseEntity> dtoEntities) { entity.Code = dto.Code; entity.CreateDateTime = dto.CreateDateTime; entity.CreateUserId = dto.CreateUserId; entity.Description = dto.Description; entity.Name = dto.Name; entity.Property = dto.Property; entity.UpdateDateTime = dto.UpdateDateTime; entity.UpdateNumber = dto.UpdateNumber; entity.UpdateProcess = dto.UpdateProcess; entity.UpdateUserId = dto.UpdateUserId; entity.Value = dto.Value; entity.LookupCode = (dto.LookupCode == null) ? null : LookupCode.FromDto(dbContext, dto.LookupCode, dtoEntities); entity.LookupProperty = (dto.LookupProperty == null) ? null : LookupProperty.FromDto(dbContext, dto.LookupProperty, dtoEntities); }
/// <summary>Convert from WageUnitDetail 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 WageUnitDetail entity</returns> public static WageUnitDetail FromDto(FACTS.Framework.DAL.DbContext dbContext, WageUnitDetailDto dto, Dictionary <FACTS.Framework.Dto.BaseDto, BaseEntity> dtoEntities = null) { dtoEntities = dtoEntities ?? new Dictionary <FACTS.Framework.Dto.BaseDto, BaseEntity>(); if (dtoEntities.ContainsKey(dto)) { return((WageUnitDetail)dtoEntities[dto]); } WageUnitDetail entity = new WageUnitDetail(); dtoEntities.Add(dto, entity); entity.AdjReasonCode = dto.AdjReasonCode; entity.CreateDateTime = dto.CreateDateTime; entity.CreateUserId = dto.CreateUserId; entity.EmployerId = dto.EmployerId; entity.EmployerUnitId = dto.EmployerUnitId; entity.FilingMethod = dto.FilingMethod; entity.FirstName = dto.FirstName; entity.HoursWorked = dto.HoursWorked; entity.IsEmploymentMonth1 = dto.IsEmploymentMonth1; entity.IsEmploymentMonth2 = dto.IsEmploymentMonth2; entity.IsEmploymentMonth3 = dto.IsEmploymentMonth3; entity.IsOwnerOrOfficer = dto.IsOwnerOrOfficer; entity.LastName = dto.LastName; entity.MiddleInitialName = dto.MiddleInitialName; entity.Occupation = dto.Occupation; entity.ReportingQuarter = dto.ReportingQuarter; entity.ReportingYear = dto.ReportingYear; entity.Ssn = dto.Ssn; entity.UpdateDateTime = dto.UpdateDateTime; entity.UpdateNumber = dto.UpdateNumber; entity.UpdateProcess = dto.UpdateProcess; entity.UpdateUserId = dto.UpdateUserId; entity.WageAmount = dto.WageAmount; 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 SecurityPermission 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 SecurityPermission DTO</returns> public SecurityPermissionDto ToDtoDeep(FACTS.Framework.DAL.DbContext dbContext, SecurityPermissionDto dto = null, Dictionary <BaseEntity, FACTS.Framework.Dto.BaseDto> entityDtos = null) { entityDtos = entityDtos ?? new Dictionary <BaseEntity, FACTS.Framework.Dto.BaseDto>(); if (entityDtos.ContainsKey(this)) { return((SecurityPermissionDto)entityDtos[this]); } dto = ToDto(dto); entityDtos.Add(this, dto); System.Data.Entity.Infrastructure.DbEntityEntry <SecurityPermission> entry = dbContext?.Entry(this); dto.IsNew = (entry?.State == EntityState.Added); dto.IsDeleted = (entry?.State == EntityState.Deleted); return(dto); }