public void Update(DtoBase <Founder> command) { FounderDto dto = command as FounderDto; Founder founder = GetById <Founder>(command.Id.Value); UpdateFounderInfo(founder, dto); PerformUpdate(founder); IEnumerable <FounderToCompany> exitingRelations = context .GetDbSet <FounderToCompany>() .Where(r => r.Founder == founder && !r.IsDeleted && !r.Company.IsDeleted) .ToArray(); foreach (FounderToCompany relation in exitingRelations) { if (!dto.RelatedCompaniesIds.Contains(relation.CompanyId)) { PerformDelete(relation); } } foreach (Guid companyId in dto.RelatedCompaniesIds) { if (!exitingRelations.Any(r => r.CompanyId == companyId)) { PerformCreate(new FounderToCompany(GetById <Company>(companyId), founder)); } } context.SaveChanges(); }
/// <summary> /// Adds each property on the deserialized object to the Host Value collection. /// </summary> /// <param name="deserializedObj"></param> /// <param name="jsonObject"></param> private static void PopulateHostValues(DtoBase deserializedObj, JObject jsonObject) { foreach (var prop in jsonObject.Properties()) { deserializedObj.HostValues.ImportHostValues(new JSONHostValue(prop, deserializedObj.HostValueParentNode)); } }
protected async Task NotifyValidationErrors(DtoBase message) { foreach (var error in message.ValidationResult.Errors) { await _mediator.Publish(new ErrorNotification(error.ErrorMessage)); } }
/// <summary> /// adds or updates teamNotification /// </summary> /// <param name="dto"></param> public void Add(DtoBase dto) { var teamNotificationDto = (Dto.TeamNotification)dto; var entity = GetTeamNotificationByKeyAndType(teamNotificationDto); if (entity == null) { entity = MappingConfigurator.Mapper.Map <DataAccess.Models.TeamNotification>(dto); _repository.Insert(entity); _uow.Save(); dto.Id = entity.Id; return; } //data exists, update record. entity.TimeInterval = teamNotificationDto.TimeInterval; entity.Key = teamNotificationDto.Key; entity.LastExecutedAt = teamNotificationDto.LastExecutedAt; _repository.Update(entity); _uow.Save(); }
public void Add(DtoBase dto) { var balanceDto = (Dto.TeamCryptoCurrencyBalance)dto; var entity = GetTeamBalanceByNameAndCurrency(balanceDto); if (entity == null) { entity = MappingConfigurator.Mapper.Map <DataAccess.Models.TeamCryptoCurrencyBalance>(dto); _repository.Insert(entity); _uow.Save(); dto.Id = entity.Id; return; } //data exists, update record. entity.Balance = balanceDto.Balance; _repository.Update(entity); _uow.Save(); }
public override TDomainEntity GetModel <TDomainEntity>(DtoBase dtoModel) { if (TypesEqual <CityPostDto>(dtoModel)) { var cityDto = (CityPostDto)dtoModel; return(new Domain.Entity.EventerEntity.City { CityName = cityDto.CityName, StateId = cityDto.StateId } as TDomainEntity); } if (TypesEqual <CityDto>(dtoModel)) { var cityDto = (CityDto)dtoModel; return(new Domain.Entity.EventerEntity.City { Id = cityDto.Id, CityName = cityDto.CityName, StateId = cityDto.State.Id } as TDomainEntity); } if (TypesEqual <CityPutDto>(dtoModel)) { var cityDto = (CityPutDto)dtoModel; return(new Domain.Entity.EventerEntity.City { Id = cityDto.Id, CityName = cityDto.CityName, StateId = cityDto.StateId } as TDomainEntity); } return(null); }
public void Insertar(DtoBase dtoEntidad) { using (var tran = new TransactionScope()) { try { var dto = (DepositoDto)dtoEntidad; var entidad = new Dominio.Entidades.Deposito { Descripcion = dto.Descripcion, Ubicacion = dto.Ubicacion, EstaEliminado = false }; _unidadDeTrabajo.DepositoRepositorio.Insertar(entidad); _unidadDeTrabajo.Commit(); tran.Complete(); } catch (Exception ex) { tran.Dispose(); throw new Exception(ex.Message); } } }
public void Insertar(DtoBase dtoEntidad) { using (var tran = new TransactionScope()) { try { var dto = (ListaPrecioDto)dtoEntidad; var entidad = new Dominio.Entidades.ListaPrecio { Descripcion = dto.Descripcion, NecesitaAutorizacion = dto.NecesitaAutorizacion, PorcentajeGanancia = dto.PorcentajeGanancia, EstaEliminado = false }; _unidadDeTrabajo.ListaPrecioRepositorio.Insertar(entidad); _unidadDeTrabajo.Commit(); tran.Complete(); } catch (Exception ex) { tran.Dispose(); throw new Exception(ex.Message); } } }
public override TDomainEntity GetModel <TDomainEntity>(DtoBase dtoModel) { if (TypesEqual <StatePostDto>(dtoModel)) { var stateDto = (StatePostDto)dtoModel; return(new Domain.Entity.EventerEntity.State { StateName = stateDto.StateName } as TDomainEntity); } if (TypesEqual <StateDto>(dtoModel)) { var stateDto = (StateDto)dtoModel; return(new Domain.Entity.EventerEntity.State { Id = stateDto.Id, StateName = stateDto.StateName } as TDomainEntity); } if (TypesEqual <StatePutDto>(dtoModel)) { var stateDto = (StatePutDto)dtoModel; return(new Domain.Entity.EventerEntity.State { Id = stateDto.Id, StateName = stateDto.StateName } as TDomainEntity); } return(null); }
public Task <FigureBase> GetFigureAsync(int id, CancellationToken cancellationToken) { using (var connection = new SqliteConnection(DB_NAME)) { connection.Open(); var command = connection.CreateCommand(); command.CommandText = $"SELECT f.Id, ft.Name, f.Data FROM Figures f INNER JOIN FigureTypes ft ON f.Type=ft.Id WHERE f.Id={id}"; using (var reader = command.ExecuteReader()) { DtoBase dto = null; while (reader.Read()) { var figureId = reader.GetInt32(0); var type = reader.GetString(1); var typeInAssembly = Type.GetType(type); if (typeInAssembly == null) { Console.WriteLine($"Не найден тип {type}"); continue; } dto = Activator.CreateInstance(typeInAssembly) as DtoBase; dto.Id = figureId; dto.Data = reader.GetString(2); } return(Task.FromResult(dto?.ToEntity())); } } }
public void Update(DtoBase <Company> command) { CompanyDto dto = command as CompanyDto; Company company = GetById <Company>(command.Id.Value); UpdateCompanyInfo(company, dto); PerformUpdate(company); IEnumerable <FounderToCompany> exitingRelations = context .GetDbSet <FounderToCompany>() .Where(r => r.Company == company && !r.IsDeleted); foreach (FounderToCompany relation in exitingRelations) { if (!dto.FoundersIds.Contains(relation.FounderId)) { PerformDelete(relation); } } foreach (Guid founderId in dto.FoundersIds) { if (!exitingRelations.Any(r => r.FounderId == founderId)) { PerformCreate(new FounderToCompany(company, GetById <Founder>(founderId))); } } context.SaveChanges(); }
public void Modificar(DtoBase dtoEntidad) { var dto = (ArticuloCrudDto)dtoEntidad; var entidad = _unidadDeTrabajo.ArticuloRepositorio.Obtener(dto.Id); if (entidad == null) { throw new Exception("Ocurrio un Error al Obtener el Artículo"); } entidad.MarcaId = dto.MarcaId; entidad.RubroId = dto.RubroId; entidad.UnidadMedidaId = dto.UnidadMedidaId; entidad.IvaId = dto.IvaId; entidad.Codigo = dto.Codigo; entidad.CodigoBarra = dto.CodigoBarra; entidad.Abreviatura = dto.Abreviatura; entidad.Descripcion = dto.Descripcion; entidad.Detalle = dto.Detalle; entidad.Ubicacion = dto.Ubicacion; entidad.ActivarLimiteVenta = dto.ActivarLimiteVenta; entidad.LimiteVenta = dto.LimiteVenta; entidad.ActivarHoraVenta = dto.ActivarHoraVenta; entidad.HoraLimiteVentaDesde = dto.HoraLimiteVentaDesde; entidad.HoraLimiteVentaHasta = dto.HoraLimiteVentaHasta; entidad.PermiteStockNegativo = dto.PermiteStockNegativo; entidad.DescuentaStock = dto.DescuentaStock; entidad.StockMinimo = dto.StockMinimo; entidad.Foto = dto.Foto; _unidadDeTrabajo.ArticuloRepositorio.Modificar(entidad); _unidadDeTrabajo.Commit(); }
public override TDomainEntity GetModel <TDomainEntity>(DtoBase dtoModel) { if (TypesEqual <TDomainEntity, ApiActivityLog>()) { var clientDto = (ApiActivityLogDto)dtoModel; return(new ApiActivityLog { Id = clientDto.Id, RequestContentBody = clientDto.RequestContentBody, RequestContentType = clientDto.RequestContentType, RequestHeaders = clientDto.RequestHeaders, UserHostAddress = clientDto.UserHostAddress, RequestMethod = clientDto.RequestMethod, RequestRouteData = clientDto.RequestRouteData, RequestRouteTemplate = clientDto.RequestRouteTemplate, RequestTimestamp = clientDto.RequestTimestamp, RequestUri = clientDto.RequestUri, ResponseContentBody = clientDto.ResponseContentBody, ResponseContentType = clientDto.ResponseContentType, ResponseHeaders = clientDto.ResponseHeaders, ResponseStatusCode = clientDto.ResponseStatusCode, ResponseTimestamp = clientDto.ResponseTimestamp, User = clientDto.User } as TDomainEntity); } return(null); }
public async Task Modificar(DtoBase dtoBase) { var dto = (PaisDto)dtoBase; var pais = _mapper.Map <Dominio.Entidades.Pais>(dto); await _paisRepositorio.Actualizar(pais); }
public async Task Modificar(DtoBase dtoBase) { var dto = (FormaPagoDto)dtoBase; var formaPago = _mapper.Map <Dominio.Entidades.FormaPago>(dto); await _formaPagoRepositorio.Actualizar(formaPago); }
public async Task Insertar(DtoBase dtoBase) { var dto = (EventoDto)dtoBase; var evento = _mapper.Map <Dominio.Entidades.Evento>(dto); await _eventoRepositorio.Insertar(evento); }
public async Task Modificar(DtoBase dtoBase) { var dto = (ProvinciaDto)dtoBase; var provincia = _mapper.Map <Dominio.Entidades.Provincia>(dto); await _provinciaRepositorio.Actualizar(provincia); }
public async Task Modificar(DtoBase dtoBase) { var dto = (SalaDto)dtoBase; var sala = _mapper.Map <Dominio.Entidades.Sala>(dto); await _salaRespositorio.Actualizar(sala); }
public async Task Modificar(DtoBase dtoBase) { var dto = (DireccionDto)dtoBase; var direccion = _mapper.Map <Dominio.Entidades.Direccion>(dto); await _direccionRepositorio.Actualizar(direccion); }
public async Task Modificar(DtoBase dtoBase) { var dto = (TipoEntradaDto)dtoBase; var tipoEntrada = _mapper.Map <Dominio.Entidades.TipoEntrada>(dto); await _tipoEntradaRepositorio.Actualizar(tipoEntrada); }
public async Task Modificar(DtoBase dtoBase) { var dto = (DisertanteDto)dtoBase; var disertante = _mapper.Map <Dominio.Entidades.Disertante>(dto); await _disertanteRepositorio.Actualizar(disertante); }
public async Task Modificar(DtoBase dtoBase) { var dto = (LocalidadDto)dtoBase; var localidad = _mapper.Map <Dominio.Entidades.Localidad>(dto); await _localidadRepositorio.Actualizar(localidad); }
public async Task Insertar(DtoBase dtoBase) { var dto = (EntradaDto)dtoBase; var entrada = _mapper.Map <Dominio.Entidades.Entrada>(dto); await _entradaRepositorio.Insertar(entrada); }
public async Task Insertar(DtoBase dtoBase) { var dto = (SalaDto)dtoBase; var sala = _mapper.Map <Dominio.Entidades.Sala>(dto); await _salaRespositorio.Insertar(sala); }
public async Task Insertar(DtoBase dtoBase) { var dto = (PaisDto)dtoBase; var pais = _mapper.Map <Dominio.Entidades.Pais>(dto); await _paisRepositorio.Insertar(pais); }
public async Task Modificar(DtoBase dtoBase) { var dto = (EstablecimientoDto)dtoBase; var establecimiento = _mapper.Map <Dominio.Entidades.Establecimiento>(dto); await _establecimientoRepositorio.Actualizar(establecimiento); }
public async Task Modificar(DtoBase dtoBase) { var dto = (ClienteDto)dtoBase; var cliente = _mapper.Map <Dominio.Entidades.Cliente>(dto); await _clienteRepositorio.Actualizar(cliente); }
public async Task Modificar(DtoBase dtoBase) { var dto = (EmpresaDto)dtoBase; var empresa = _mapper.Map <Dominio.Entidades.Empresa>(dto); await _empresaRepositorio.Actualizar(empresa); }
public async Task Modificar(DtoBase dtoBase) { var dto = (FacturaDto)dtoBase; var factura = _mapper.Map <Dominio.Entidades.Factura>(dto); await _facturaRepositorio.Actualizar(factura); }
public async Task Modificar(DtoBase dtoBase) { var dto = (PersonaDto)dtoBase; var persona = _mapper.Map <Dominio.Entidades.Persona>(dto); await _personaRepositorio.Actualizar(persona); }
protected override bool IsAvailableFor(XIAP.FrontendModules.Claims.Model.ClaimModel model, DtoBase parentDto) { if (base.IsAvailableFor(model, parentDto)) { IClaimDetailData claimDetailData = null; claimDetailData = parentDto.Data as ClaimDetailData; if (this.InternalIOType == StaticValues.InternalIOType.Vehicle && (claimDetailData.ClaimDetailTypeCode == AXAClaimConstants.CLAIMDETAILTYPE_AD || claimDetailData.ClaimDetailTypeCode == AXAClaimConstants.CLAIMDETAILTYPE_TPVD)) { return true; } } return false; }
private bool IsChildAllowedForClaimDetail(TreeStructureStore child, DtoBase parent) { IClaimDetailData claimDetailData = null; claimDetailData = parent.Data as ClaimDetailData; switch (child.Node) { case "ClaimDetailMainDetails": if (claimDetailData.ClaimDetailTypeCode == AXAClaimConstants.CLAIMDETAILTYPE_AD || claimDetailData.ClaimDetailTypeCode == AXAClaimConstants.CLAIMDETAILTYPE_TPVD || claimDetailData.ClaimDetailTypeCode == AXAClaimConstants.CLAIMDETAILTYPE_TPPD || claimDetailData.ClaimDetailTypeCode == AXAClaimConstants.CLAIMDETAILTYPE_TPI || claimDetailData.ClaimDetailTypeCode == AXAClaimConstants.CLAIMDETAILTYPE_LIA) { return true; } break ; case "CurrentReserve": if (claimDetailData.ClaimDetailTypeCode == AXAClaimConstants.CLAIMDETAILTYPE_AD || claimDetailData.ClaimDetailTypeCode == AXAClaimConstants.CLAIMDETAILTYPE_TPVD || claimDetailData.ClaimDetailTypeCode == AXAClaimConstants.CLAIMDETAILTYPE_TPPD || claimDetailData.ClaimDetailTypeCode == AXAClaimConstants.CLAIMDETAILTYPE_TPI || claimDetailData.ClaimDetailTypeCode == AXAClaimConstants.CLAIMDETAILTYPE_LIA) { return claimDetailData.HasHistoricalReserves.GetValueOrDefault(false) ? true : false; } break ; case "CurrentRecoveryReserve": if (claimDetailData.ClaimDetailTypeCode == AXAClaimConstants.CLAIMDETAILTYPE_AD || claimDetailData.ClaimDetailTypeCode == AXAClaimConstants.CLAIMDETAILTYPE_TPVD || claimDetailData.ClaimDetailTypeCode == AXAClaimConstants.CLAIMDETAILTYPE_TPPD || claimDetailData.ClaimDetailTypeCode == AXAClaimConstants.CLAIMDETAILTYPE_TPI || claimDetailData.ClaimDetailTypeCode == AXAClaimConstants.CLAIMDETAILTYPE_LIA) { return claimDetailData.HasHistoricalRecoveryReserves.GetValueOrDefault(false) ? true : false; } break; case "ClaimDetailExtendedInfo": if (claimDetailData.ClaimDetailTypeCode == AXAClaimConstants.CLAIMDETAILTYPE_AD || claimDetailData.ClaimDetailTypeCode == AXAClaimConstants.CLAIMDETAILTYPE_TPVD) { child.Label.DefaultValue = "Repair Information"; return true; } else if (claimDetailData.ClaimDetailTypeCode == AXAClaimConstants.CLAIMDETAILTYPE_TPI) { child.Label.DefaultValue = "Medical Reports"; return true; } else if (claimDetailData.ClaimDetailTypeCode == AXAClaimConstants.CLAIMDETAILTYPE_LIA) { child.Label.DefaultValue = "Exposure / Medical"; return true; } break; } return false; }
/// <summary> /// Method to check whether the node will be available on screen or not. /// </summary> /// <param name="transactionController">Object of ITransactionController</param> /// <param name="definition">Tree Structure Store</param> /// <param name="parentDto">Dto base</param> /// <returns>bool value</returns> public bool IsAvailable(ITransactionController transactionController, TreeStructureStore definition, DtoBase parentDto) { bool result = true; if (this._appModel.ShellConfiguration.ConfigurationSettings["NameFinancialAccountMaintenancePermissionToken"] != null && !this._appModel.ShellConfiguration.ConfigurationSettings["NameFinancialAccountMaintenancePermissionToken"].SettingParmeters.IsNullOrEmpty()) { string tokenName = this._appModel.ShellConfiguration.ConfigurationSettings["NameFinancialAccountMaintenancePermissionToken"].SettingParmeters[0].SettingValue; if (!string.IsNullOrEmpty(tokenName) && !this._appModel.UserProfile.HasPermission(tokenName)) { result = false; } } return result; }
protected override bool IsAvailableFor(ClaimModel model, DtoBase parentDto) { if (base.IsAvailableFor(model, parentDto)) { IClaimLitigationData claimlitigationdata = null; claimlitigationdata = parentDto.Data as ClaimLitigationData; if (claimlitigationdata.LitigationType == AXAClaimConstants.LITIGATIONTYPE_LIT && this.LinkableComponentType == StaticValues.LinkableComponentType.NameInvolvement) { return true; } } return false ; }
private ObservableCollection<TreeNodeData<ActionKey>> CreateNodesForDefinition(ITransactionController transactionController, TreeStructureStore definition, DtoBase dto) { AXAClaimModel model = (AXAClaimModel)transactionController.Model; ObservableCollection<TreeNodeData<ActionKey>> nodes = new ObservableCollection<TreeNodeData<ActionKey>>(); INodeAvailabilityBehaviour nodeAvailabilityBehavior = transactionController.Container.Resolve<INodeAvailabilityBehaviour>(definition.AvailabilityBehaviour); if (nodeAvailabilityBehavior.IsAvailable(transactionController, definition, dto)) { var groupDefinition = definition.Clone(); groupDefinition.Parent = definition.Parent; var groupingNode = transactionController.CreateNavigationData(groupDefinition, dto); groupingNode.Context = transactionController.Model; model.RefreshProperty(); nodes.Add(groupingNode); } return nodes; }
protected override bool IsAvailableFor(ClaimModel model, DtoBase parentDto) { if (base.IsAvailableFor(model, parentDto)) { IClaimDetailData claimDetailData = null; claimDetailData = parentDto.Data as ClaimDetailData; if (claimDetailData.ClaimDetailTypeCode == AXAClaimConstants.CLAIMDETAILTYPE_AD && this.LinkableComponentType == StaticValues.LinkableComponentType.Recovery) { return true; } if ((claimDetailData.ClaimDetailTypeCode == AXAClaimConstants.CLAIMDETAILTYPE_TPVD || claimDetailData.ClaimDetailTypeCode == AXAClaimConstants.CLAIMDETAILTYPE_TPPD || claimDetailData.ClaimDetailTypeCode == AXAClaimConstants.CLAIMDETAILTYPE_TPI || claimDetailData.ClaimDetailTypeCode == AXAClaimConstants.CLAIMDETAILTYPE_LIA) && this.LinkableComponentType == StaticValues.LinkableComponentType.Litigation) { return true; } } return false ; }
private void RefreshTotals(DtoBase claimDetail, bool loadScreen) { this.SelectedClaimant = claimDetail as ClaimDetailDto; // If filter is selected as selected claimant then recalcualte Totals only if (this.SelectedClaimTransactionFilter == "2") { this.InvokeEvent(this.ReloadTotals); } }
public IEnumerable<TreeNodeData<ActionKey>> CreateNodes(ITransactionController transactionController, TreeStructureStore definition, DtoBase parentDto) { return this.CreateNodesForDefinition(transactionController, definition, parentDto); }
private void SetLitigationLinkAddMenuOption(DtoBase dataobject) { AXAClaimLitigationLinkModel claimLitigationLinkModel = this.claimModel.ClaimLitigationLinkModel as AXAClaimLitigationLinkModel; if (claimLitigationLinkModel != null) { if (dataobject is ClaimNameInvolvementDto) { claimLitigationLinkModel.AllowAdd = true; } else { claimLitigationLinkModel.AllowAdd = false; } claimLitigationLinkModel.ClaimLitigationLinksMenuItems.ForEach(c => (c.MenuItemCommand as DelegateCommandBase).RaiseCanExecuteChanged()); } }
public virtual bool Equals(DtoBase other) { return (null != other) && (this.GetType() == other.GetType()) && (other.Id == this.Id); }
public bool IsAvailable(XIAP.Frontend.Infrastructure.ITransactionController transactionController, TreeStructureStore definition, DtoBase parentDto) { return this.IsChildAllowedForClaimDetail(definition,parentDto); }