public override void Initialize() { var connectionString = ConfigurationReader.GetConnectionString(Environment.Production); var databaseName = GetDatabaseName(connectionString); var task = Task.Run(async() => await ApplicationData.Current.LocalFolder.CreateFileAsync(databaseName, CreationCollisionOption.OpenIfExists)).Result; var databasePath = Path.Combine(ApplicationData.Current.LocalFolder.Path, databaseName); var customConnectionString = connectionString.Replace(databaseName, databasePath, StringComparison.CurrentCulture); var connectionFactory = new ConnectionFactory(Environment.Production, customConnectionString); var locationDao = new LocationDao(connectionFactory); var skierDao = new SkierDao(connectionFactory); var countryDao = new CountryDao(connectionFactory); var raceDao = new RaceDao(connectionFactory); var runDao = new RunDao(connectionFactory); var sensorMeasurementDao = new SensorMeasurementDao(connectionFactory); var daoProvider = new DaoProvider(countryDao, locationDao, raceDao, runDao, sensorMeasurementDao, skierDao); var messengerHub = new MvxMessengerHub(); var simulatorRaceClock = new SimulatorRaceClock(); Mvx.IoCProvider.RegisterSingleton <IMvxMessenger>(messengerHub); Mvx.IoCProvider.RegisterSingleton <IDialogService>(new DialogService(messengerHub)); Mvx.IoCProvider.RegisterSingleton <IRaceService>(new RaceService(daoProvider)); Mvx.IoCProvider.RegisterSingleton <ILocationService>(new LocationService(daoProvider)); Mvx.IoCProvider.RegisterSingleton <ISkierService>(new SkierService(daoProvider)); Mvx.IoCProvider.RegisterSingleton <IRunService>(new RunService(daoProvider, simulatorRaceClock)); Mvx.IoCProvider.RegisterSingleton <SimulatorRaceClock>(simulatorRaceClock); RegisterAppStart <ViewModels.NavigationRootViewModel>(); }
protected override List <TurnoModel> ResolveCore(EmpresaBase source) { List <TurnoModel> listaModelTurnos = new List <TurnoModel>(); if (source.TipoEmpresa == TipoEmpresaEnum.ESCUELA_MADRE) { var escuela = new DaoProvider().GetDaoEscuela().GetById(source.Id); if (escuela.TurnosXEscuela != null) { listaModelTurnos.AddRange(escuela.TurnosXEscuela.Select(t => Mapper.Map <Turno, TurnoModel>(t.Turno))); } return(listaModelTurnos); } else if (source.TipoEmpresa == TipoEmpresaEnum.ESCUELA_ANEXO) { var escuelaAnexo = new DaoProvider().GetDaoEscuelaAnexo().GetById(source.Id); if (escuelaAnexo.TurnosXEscuela != null) { listaModelTurnos.AddRange(escuelaAnexo.TurnosXEscuela.Select(t => Mapper.Map <Turno, TurnoModel>(t.Turno))); } return(listaModelTurnos); } else { return(listaModelTurnos); } }
/** * @author Anthony Scheeres */ private string validateRegisterUser(string username, string password, string email) { string failResponse = ResponseR.fail.ToString(); string response = failResponse; bool isValideInput = isValideUsernamePasswordEmail(username, password, email); //validate the input if so register user in the database if (isValideInput) { registerUser(username, password, email); TokenDao tokenDao = DaoProvider.getToken(); string token = tokenDao.getTokenByUsernameExtremelyClassified(username); new Thread(() => { Thread.CurrentThread.IsBackground = true; MailService mailService = new MailService(email); mailService.validateAUsersEmailUsingAValidationEmaill(username, token); }).Start(); response = ResponseR.success.ToString(); } return(response); }
public void DomicilioSave(DomicilioModel modelo, int idEmpresa) { if (modelo == null) { throw new BaseException("Debe asignar un domicilio a la empresa externa."); } var entidad = Mapper.Map <DomicilioModel, Domicilio>(modelo); if (entidad == null) { entidad = new Domicilio(); } if (modelo.IdCalle > 0) { var calle = DaoProvider.GetDaoCalle().GetById(modelo.IdCalle); entidad.Calle = calle; entidad.TipoCalle = calle.TipoCalle; } entidad.Altura = modelo.Altura; entidad.Piso = modelo.Piso; entidad.Departamento = modelo.Departamento; entidad.Torre = modelo.Torre; var localidad = DaoProvider.GetDaoLocalidad().GetById(modelo.IdLocalidad); entidad.Localidad = localidad; entidad.Provincia = localidad.Provincia; entidad.DepartamentoProvincial = localidad.DepartamentoProvincial; entidad.Barrio = DaoProvider.GetDaoBarrio().GetById(modelo.IdBarrio); entidad.Origen = OrigenEnum.T_DO_EMP_EXTERNA; entidad.EntidadId = idEmpresa.ToString(); DaoProvider.GetDaoDomicilio().Save(entidad); }
public EmpresaExternaModel EmpresaExternaUpdateOrSave(EmpresaExternaModel modelo) { ValidarEmpresaExternaSave(modelo); var empresaExEntidad = DaoEmpresaExterna.GetById(modelo.Id); if (modelo.CondicionIva != null) { var condicionIva = DaoProvider.GetDaoCondicionIva().GetById(modelo.CondicionIva); empresaExEntidad.CondicionIva = condicionIva; } else { empresaExEntidad.CondicionIva = null; } empresaExEntidad.Descripcion = modelo.Descripcion; empresaExEntidad.NumeroAnses = modelo.NumeroAnses; empresaExEntidad.NumeroIngBrutos = modelo.NumeroIngBrutos; empresaExEntidad.Sucursal = modelo.Sucursal; empresaExEntidad.Observaciones = modelo.Observaciones; if (modelo.FechaCreacion != null) { empresaExEntidad.FechaCreacion = modelo.FechaCreacion.Value; } CargarComunicaciones(empresaExEntidad, modelo); empresaExEntidad.FechaUltimaActivacion = DateTime.Today; var empresaExternaRecuperada = DaoEmpresaExterna.SaveOrUpdate(empresaExEntidad); var empresaModel = Mapper.Map <EmpresaExterna, EmpresaExternaModel>(empresaExternaRecuperada); return(empresaModel); }
protected override List <AsignacionInspeccionEscuelaModel> ResolveCore(EmpresaBase source) { var daoProvider = new DaoProvider(); var listadoAsignaciones = new List <AsignacionInspeccionEscuela>(); switch (source.TipoEmpresa) { case TipoEmpresaEnum.INSPECCION: listadoAsignaciones = daoProvider.GetDaoAsignacionInspeccionEscuela().GetVigentesByInspeccion(source.Id); break; case TipoEmpresaEnum.ESCUELA_MADRE: case TipoEmpresaEnum.ESCUELA_ANEXO: var asignacionInspeccionEscuela = daoProvider.GetDaoAsignacionInspeccionEscuela().GetVigenteByEscuela(source.Id); if (asignacionInspeccionEscuela != null) { listadoAsignaciones.Add(asignacionInspeccionEscuela); } break; default: throw new ArgumentOutOfRangeException(); } return(Mapper.Map <List <AsignacionInspeccionEscuela>, List <AsignacionInspeccionEscuelaModel> >(listadoAsignaciones)); }
protected override InstrumentoLegal ResolveCore(AsignacionInstrumentoLegalModel source) { if (source.InstrumentoLegal == null || !source.InstrumentoLegal.Id.HasValue) { return(null); } else { var daoProvider = new DaoProvider(); if (source.InstrumentoLegal.Id > 0) { return(daoProvider.GetDaoInstrumentoLegal().GetById(source.InstrumentoLegal.Id.Value)); } else { return new InstrumentoLegal() { FechaAlta = source.InstrumentoLegal.FechaAlta, NroInstrumentoLegal = source.InstrumentoLegal.NroInstrumentoLegal, FechaEmision = source.InstrumentoLegal.FechaEmision.Value, Observaciones = source.InstrumentoLegal.Observaciones, EmisorInstrumentoLegal = source.InstrumentoLegal.EmisorInstrumentoLegal.Value, TipoInstrumentoLegal = source.InstrumentoLegal.IdTipoInstrumentoLegal > 0 ? daoProvider.GetDaoTipoInstrumentoLegal().GetById(source.InstrumentoLegal.IdTipoInstrumentoLegal.Value) : null, Expediente = source.InstrumentoLegal.Expediente != null?daoProvider.GetDaoExpediente().GetById(source.InstrumentoLegal.Expediente.Id.Value) : null } }; } } }
protected override string ResolveCore(EmpresaBase source) { var daoProvider = new DaoProvider(); var asignacionInspeccionEscuela = daoProvider.GetDaoAsignacionInspeccionEscuela().GetVigenteByEscuela(source.Id); return(asignacionInspeccionEscuela != null && asignacionInspeccionEscuela.Inspeccion != null ? asignacionInspeccionEscuela.Inspeccion.CodigoEmpresa : string.Empty); }
public bool ConsultarExistenciaCuit(int id) { var persona = DaoProvider.GetDaoPersonaJuridica().GetById(id); if (string.IsNullOrEmpty(persona.CUIT)) { return(false); } return(true); }
protected override List <DiagramacionCursoRegistrarModel> ResolveCore(EmpresaBase source) { var daoProvider = new DaoProvider(); List <DiagramacionCurso> listadoEstructuraEscolar = new List <DiagramacionCurso>(); if (source.TipoEmpresa == TipoEmpresaEnum.ESCUELA_MADRE || source.TipoEmpresa == TipoEmpresaEnum.ESCUELA_ANEXO) { listadoEstructuraEscolar = daoProvider.GetDaoDiagramacionCurso().GetByEscuela(source.Id); } return(Mapper.Map <List <DiagramacionCurso>, List <DiagramacionCursoRegistrarModel> >(listadoEstructuraEscolar)); }
public List <VinculoEmpresaEdificio> GetVinculosCompletos(int idEmpresa) { var daoProvider = new DaoProvider(); var empresa = GetById(idEmpresa); foreach (var vin in empresa.VinculoEmpresaEdificio) { vin.Edificio = daoProvider.GetDaoEdificio().GetById(vin.Edificio.Id); } return(empresa.VinculoEmpresaEdificio.ToList()); }
protected override EmpresaBase ResolveCore(InspeccionModel source) { var inspeccion = new DaoProvider().GetDaoInspeccion().GetById(source.Id); if (inspeccion != null) { return(inspeccion.EmpresaDeInspeccionSuperior); } else { return(null); } }
/** * @author Anthony Scheeres */ internal string validateMailAgain(string token) { string failResponse = ResponseR.fail.ToString(); string response = failResponse; UserDao userDao = DaoProvider.getUser(); string email = null; email = userDao.getEmailUsingTokenThrowNewException(token); if (email != null) { validateAUsersEmailUsingAValidationEmaill(email, "Gebruiker", token); response = ResponseR.success.ToString(); } return(response); }
public EmpresaExternaModel EmpresaExternaSave(EmpresaExternaModel modelo) { ValidarExistenciaEmpresaExterna(modelo.Nombre); ValidarReferenteEmpresa(modelo); #region Guardar Persona if (modelo.Referente != null) { var reglaPersona = new PersonaFisicaRules(); var persona = reglaPersona.PersonaFisicaSaveOUpdate(modelo.Referente); modelo.Referente = persona; } if (modelo.PersonaJuridica != null) { var reglaPJ = new PersonaJuridicaRules(); var personaJuridica = reglaPJ.PersonaJuridicaSaveOUpdate(modelo.PersonaJuridica); modelo.PersonaJuridica = personaJuridica; if (modelo.ReferenteEmpresa != null) { var reglaPersonaReferente = new PersonaFisicaRules(); var personaReferente = reglaPersonaReferente.PersonaFisicaSaveOUpdate(modelo.ReferenteEmpresa); modelo.ReferenteEmpresa = personaReferente; } else { throw new BaseException("Tiene que ingresar una persona referente a la Empresa"); } } #endregion var condicionIva = modelo.CondicionIva != null?DaoProvider.GetDaoCondicionIva().GetById(modelo.CondicionIva) : null; var empresaEntidad = Mapper.Map <EmpresaExternaModel, EmpresaExterna>(modelo); CargarComunicaciones(empresaEntidad, modelo); empresaEntidad.CondicionIva = condicionIva; empresaEntidad.FechaAlta = DateTime.Now; empresaEntidad.Activo = true; var empresamodelo = DaoEmpresaExterna.Save(empresaEntidad); var modeloDevuelto = Mapper.Map <EmpresaExterna, EmpresaExternaModel>(empresamodelo); return(modeloDevuelto); }
protected override bool ResolveCore(EmpresaBase source) { var daoProvider = new DaoProvider(); if (source.TipoEmpresa == TipoEmpresaEnum.ESCUELA_MADRE) { var escuela = daoProvider.GetDaoEscuela().GetById(source.Id); return(escuela.EscuelaPrivada != null); } else if (source.TipoEmpresa == TipoEmpresaEnum.ESCUELA_ANEXO) { var escuelaAnexo = daoProvider.GetDaoEscuelaAnexo().GetById(source.Id); return(escuelaAnexo.EscuelaPrivada != null); } else { return(false); } }
/// <summary> /// Sérialize, c'est à dire met les informations souhaitées au format XML. /// On utilise les références using System.IO pour l'écriture de fichier (de C# vers Editix) /// et System.Xml.Serialization pour les méthodes relatives à la mise au format XML /// </summary> public void SerializerXML() { DaoProvider daoProvider = new DaoProvider(); //On récupère tous les fournisseurs de la base de données dont au moins un des produits qu'il fournissent ont //leur stock actuel inférieur à leur stock minimal List <Provider> providers = daoProvider.ReadAllWithProductToRestock(); //On crée la liste des Fournisseur que l'on mettra dans le fichier XML. //Elle a comme attributs le nom du fournisseur et les produits à réapprovisionner //qui ont aussi une classe dédiée (Nom du produit et la quantité à commander [stock max - stock actuel]) List <ProviderXML> providersXML = new List <ProviderXML>(); //On parcourt chaque fournisseur de la liste foreach (Provider provider in providers) { //On récupère la liste des produits fournis par ce fournisseur dont leur stock actuel est inférieur à leur //stock minimal //On crée la liste des ProduitXML (classe définie en dessous) List <ProductXML> productsXML = new List <ProductXML>(); //On parcourt chaque produit de la liste de produits à réapprovisionner de chaque fournisseur foreach (Product product in provider.Products) { ProductXML productXML = new ProductXML { Nom = product.Name, Quantite_A_Commander = product.QuantityToOrder }; productsXML.Add(productXML); } ProviderXML providerXML = new ProviderXML(provider); providerXML.Produits = productsXML; providersXML.Add(providerXML); } // Instanciation des outils ( StreamWriter et Serializer ) XmlSerializer xs = new XmlSerializer(typeof(List <ProviderXML>)); // l'outil de sérialisation StreamWriter wr = new StreamWriter("Fournisseurs.xml"); // accès en écriture d'un fichier ( texte ) //On veut récupérer seulement certains attributs de nos classes produits et fournisseurs xs.Serialize(wr, providersXML); // action de sérialiser en XML l'objet Fxml wr.Close(); }
private void AddHuraceServices(IServiceCollection services) { var connectionString = ConfigurationReader.GetConnectionString(Environment.Production); var connectionFactory = new ConnectionFactory(Environment.Production, connectionString); var locationDao = new LocationDao(connectionFactory); var skierDao = new SkierDao(connectionFactory); var countryDao = new CountryDao(connectionFactory); var raceDao = new RaceDao(connectionFactory); var runDao = new RunDao(connectionFactory); var sensorMeasurementDao = new SensorMeasurementDao(connectionFactory); var daoProvider = new DaoProvider(countryDao, locationDao, raceDao, runDao, sensorMeasurementDao, skierDao); services.AddSingleton <IRaceService>(new RaceService(daoProvider)); services.AddSingleton <ISkierService>(new SkierService(daoProvider)); services.AddSingleton <ILocationService>(new LocationService(daoProvider)); services.AddSingleton <IRunService>(new RunService(daoProvider, new SimulatorRaceClock())); services.AddSingleton <ICountryService>(new CountryService(daoProvider)); services.AddCors(options => options.AddPolicy("CORS", builder => builder.WithOrigins("http://localhost:4200").AllowAnyMethod().AllowAnyHeader())); }
/** * @author Anthony Scheeres */ internal string customerAcceptPendingReservationPotential(ReservationModel reservation, string token) { if (reservation == null) { throw new ArgumentNullException(nameof(reservation)); } string successResponse, failResponse, response; successResponse = ResponseR.success.ToString(); failResponse = ResponseR.fail.ToString(); response = failResponse; //default failed response //check if user his email is validated UserDao userDao = DaoProvider.getUser(); bool isEmaillValid = userDao.isEnailValideByModel(token); if (isEmaillValid) { // token to user id here double userId = TokenToUserId(token); reservationDao.customerAcceptPendingReservationPotentialInDatabase(userId, reservation.id); response = successResponse; } return(response); }
public PersonaFisicaModel TomarPersonaFisicaById(int id) { var personaFisica = DaoProvider.GetDaoPersonaFisica().GetById(id); return(Mapper.Map <PersonaFisica, PersonaFisicaModel>(personaFisica)); }
public List <DtoVinculoEmpresaReporte> GetVinculosEmpresaByFilter(string filtroIdentificadorEmpresa, string filtroNombreEmpresa, int?filtroDepartamento, int?filtroLocalidad, int?filtroBarrio, int?filtroCalle) { var lista = DaoProvider.GetDaoVinculoEmpresaEdificio().GetVinculosEmpresaByFilter(filtroIdentificadorEmpresa, filtroNombreEmpresa, filtroDepartamento, filtroLocalidad, filtroBarrio, filtroCalle); return(lista); }
public RaceService(DaoProvider daoProvider) : base(daoProvider) { }
public ServiceProvider() { DaoProvider = new DaoProvider(); }
public CountryService(DaoProvider daoProvider) : base(daoProvider) { }
public RunService(DaoProvider daoProvider, IRaceClock raceClock) : base(daoProvider) { raceClock.TimingTriggered += HandleNewSensorMeasurement; }
public LocationService(DaoProvider daoProvider) : base(daoProvider) { }
protected Service(DaoProvider daoProvider) { DaoProvider = daoProvider; }
public SkierService(DaoProvider daoProvider) : base(daoProvider) { }
public List <CondicionIvaModel> GetCondicionIvaAll() { var listaCondicionIva = DaoProvider.GetDaoCondicionIva().GetAll(); return(Mapper.Map <List <CondicionIva>, List <CondicionIvaModel> >(listaCondicionIva)); }