protected override async void OnAppearing()
        {
            base.OnAppearing();
            if (Application.Current.Properties.ContainsKey("Usuario"))
            {
                Clientes cli = JsonConvert.DeserializeObject <Clientes>(Application.Current.Properties["Usuario"].ToString());
                if (cli.id_Clientes != 0)
                {
                    await((NavigationPage)this.Parent).PushAsync(new MainPage());
                }
            }

            if (Application.Current.Properties.ContainsKey("Usuario_Estacion"))
            {
                Estacion estacion = JsonConvert.DeserializeObject <Estacion>(Application.Current.Properties["Usuario_Estacion"].ToString());
                if (estacion.id_Cliente != 0)
                {
                    await((NavigationPage)this.Parent).PushAsync(new MainPage());
                }
            }

            estado = await API.Login.Comprobar_Estado();

            //await DisplayAlert("Respuesta de la api:", "La respuesta es: "+estado, "Reintentar.");
            if (estado == true)
            {
                Registro.IsVisible = true;
            }
        }
Example #2
0
 public CreateEstacionForm(EstacionesListForm listForm, Estacion estacion, Repositorio repositorio)
 {
     InitializeComponent();
     this.attrs    = new EstacionAttrs(estacion, repositorio);
     this.estacion = estacion;
     this.listForm = listForm;
 }
Example #3
0
        public string mapa(int idedo)
        {
            List <Estacion> lisEstaciones = new List <Estacion>();

            lisEstaciones = Estacion.GetEstaciones(idedo);
            JavaScriptSerializer serializador = new JavaScriptSerializer();
            string serializado = serializador.Serialize(lisEstaciones);
            string mapa        = @"<script type='text/javascript'> var info = " + serializado + "; " +
                                 @"function initMap() {
                var map = new google.maps.Map(document.getElementById('map'), {
                  zoom: 3,
                  center: {lat: 28.4816887, lng: -106.1341949}
                });

                for (i = 0; i < info.length; i++) {
                    var data = info[i]
                    var contenidoLabel ='<div> <h2> </h2>  <a href=''>Información...</a> </div>';
                    var infowindow = new google.maps.InfoWindow({content: contenidoLabel});
                    var latlong = new google.maps.LatLng(data.Latitud, data.Longitud);
                    var marker = new google.maps.Marker({ position: latlong,map: map,title: data.Numero});
                    marker.addListener('click', function() { infowindow.open(map, marker); });
                }
                var markerCluster = new MarkerClusterer(map, markers,{imagePath: 'https://developers.google.com/maps/documentation/javascript/examples/markerclusterer/m'});}
                google.maps.event.addListener(marker, 'click', function() {window.location.href = this.url;});

            </script>
            <script src='https://developers.google.com/maps/documentation/javascript/examples/markerclusterer/markerclusterer.js'> </script>
            <script async defer src='https://maps.googleapis.com/maps/api/js?key=AIzaSyAmZCnSJBCnBrJ2V70CIbX27A0yFl-06A0&callback=initMap'> </script>";

            return(mapa);
            //{"Numero":22,"Idred":1,"Nombre":"Granja Elsa","EstadoId":1,"MunicipioId":1,"Productor":"Teodoro Olivares Ventura","Latitud":21.7853,"Longitud":-102.263885,"Altitud":1913,"Inicio":"2013-09-06T05:00:00Z","InicioParseo":"6/9/2013"}
        }
Example #4
0
        protected void chartTRI(int idEstacion, string fecha, out string pm1T, out string pm2p5T, out string pm10T, out decimal max)
        {
            pm10T = pm2p5T = pm1T = ""; max = 0;
            try
            {
                List <Estacion> lstDatosEstacion = new List <Estacion>();
                lstDatosEstacion = Estacion.GetEstacionesTRI(idEstacion, fecha);

                if (lstDatosEstacion.Count >= 68)
                {
                    foreach (Estacion row in lstDatosEstacion)
                    {
                        if (max < row.PM1_1H)
                        {
                            max = row.PM1_1H;
                        }
                        if (max < row.PM2P5_1H)
                        {
                            max = row.PM2P5_1H;
                        }
                        if (max < row.PM10_1H)
                        {
                            max = row.PM10_1H;
                        }
                        pm1T   += "{x: new Date(" + row.Fecha.Year + "," + (row.Fecha.Month - 1) + "," + row.Fecha.Day + "), y: " + row.PM1_1H + "},";
                        pm2p5T += "{x: new Date(" + row.Fecha.Year + "," + (row.Fecha.Month - 1) + "," + row.Fecha.Day + "), y: " + row.PM2P5_1H + "},";
                        pm10T  += "{x: new Date(" + row.Fecha.Year + "," + (row.Fecha.Month - 1) + "," + row.Fecha.Day + "), y: " + row.PM10_1H + "},";
                    }
                }
            }
            catch (Exception ex) { }
        }
Example #5
0
        private void btnGuardarEstacion_Click(object sender, EventArgs e)
        {
            string Faltantes;

            if ((Faltantes = Utileria.Requeridos(this.splitContainer1.Panel2)) != "")
            {
                MessageBox.Show("Se necesita el llenado de los campos:" + Faltantes, "Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                using (DBTallerFEntities db = new DBTallerFEntities())
                {
                    if (id == null)
                    {
                        establa = new Estacion();
                    }


                    establa.EstacionNombre = txtNombreEstacion.Text;
                    establa.ActividadId    = Int32.Parse(txtCodigoActividadEstacion.Text);

                    if (id == null)
                    {
                        establa = new Estacion();
                    }
                    else
                    {
                        db.Entry(establa).State = System.Data.Entity.EntityState.Modified;
                    }
                    db.SaveChanges();
                    this.Close();
                }
            }
        }
        private RenglonDeEstacion renglonDe(Estacion estacion, int indice)
        {
            var renglon = new RenglonDeEstacion(estacion, this.OnestacionEdit, this.onEstacionRemove);

            this.incluirEnLista(indice, renglon);
            return(renglon);
        }
        //Actualizar datos en bd
        private bool ActualizarEstacionBD(Estacion estacion)
        {
            string format = "yyyy-MM-dd HH:mm:ss";    // modify the format depending upon input required in the column in database


            bool resultado = false;

            estacion.FechaHabilitacion = DateTime.Today;
            ConexionBD conexion = new ConexionBD();

            try
            {
                string sql = "UPDATE Estacion SET CUIT = '" + estacion.Cuit + "', razonSocial = ' " + estacion.RazonSocial + "', calle = '" + estacion.Calle +
                             "', numero ='" + estacion.Nro + "',fechaHabilitacion ='" + estacion.FechaHabilitacion.ToString(format) + "' WHERE CUIT like '" + estacion.Cuit + "'";

                conexion.modificar(sql);

                resultado = true;
            }
            catch (Exception)
            {
                MessageBox.Show("Error en cargar datos de persona: Base de datos corrompida");
            }
            return(resultado);
        }
Example #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            List <Estacion>      ls           = Estacion.GetEstaciones(8);
            JavaScriptSerializer serializador = new JavaScriptSerializer();

            estaciones = serializador.Serialize(ls);
        }
Example #9
0
        public EstacionAttrs(Estacion estacion, Repositorio repositorio)
        {
            InitializeComponent();
            pEstacion = estacion;

            validables.Add(new Validator <Estacion>(pEstacion, ReglaConcreta <Estacion> .dePresencia((unaEstacion => unaEstacion.Nombre)), this.errorNombreLbl, this.nombreField));
            validables.Add(new Validator <Estacion>(pEstacion, ReglaCompuesta <Estacion> .minimoMaximoNoNegativos(e => e.PersonasEsperandoMinIda, e => e.PersonasEsperandoMaxIda),
                                                    this.errorSubidaIda, this.esperandoMaxIdaField));
            validables.Add(new Validator <Estacion>(pEstacion, ReglaCompuesta <Estacion> .minimoMaximoNoNegativos(e => e.PersonasEsperandoMinVuelta, e => e.PersonasEsperandoMaxVuelta),
                                                    this.errorSubidaVuelta, this.esperandoMaxVueltaField));
            validables.Add(new Validator <Estacion>(pEstacion, ReglaCompuesta <Estacion> .minimoMaximoNoNegativos(e => e.PersonasDesciendenMinIda, e => e.PersonasDesciendenMaxIda),
                                                    this.errorBajadaIda, this.desciendenMaxIdaField));
            validables.Add(new Validator <Estacion>(pEstacion, ReglaCompuesta <Estacion> .minimoMaximoNoNegativos(e => e.PersonasDesciendenMinVuelta, e => e.PersonasDesciendenMaxVuelta),
                                                    this.errorBajadaVuelta, this.desciendenMaxVueltaField));

            BindingSourceEstacion.DataSource = pEstacion;
            this.pIncidentes = repositorio.Listar <Incidente>();
            BindIncidentes();

            esperandoMinIdaField.IsNumeric     = true;
            esperandoMaxIdaField.IsNumeric     = true;
            esperandoMinVueltaField.IsNumeric  = true;
            esperandoMaxVueltaField.IsNumeric  = true;
            desciendenMinIdaField.IsNumeric    = true;
            desciendenMaxIdaField.IsNumeric    = true;
            desciendenMinVueltaField.IsNumeric = true;
            desciendenMaxVueltaField.IsNumeric = true;
        }
        protected override void OnAppearing()
        {
            if (Application.Current.Properties.ContainsKey("Usuario"))
            {
                Clientes cli = JsonConvert.DeserializeObject <Clientes>(Application.Current.Properties["Usuario"].ToString());
                cli.Oracion = "Bienvenido, " + cli.Nombre_Contacto;
                Inicio.SetBinding(Label.TextProperty, "Oracion");
                Inicio.BindingContext = cli;
            }

            else
            {
                if (Application.Current.Properties.ContainsKey("Usuario_Estacion"))
                {
                    Estacion estacion = JsonConvert.DeserializeObject <Estacion>(Application.Current.Properties["Usuario_Estacion"].ToString());
                    estacion.Oracion = "Bienvenido, " + estacion.Nombre_ContactoEstacion;
                    Inicio.SetBinding(Label.TextProperty, "Oracion");
                    Inicio.BindingContext = estacion;
                }
            }

            base.OnAppearing();

            int x = Navigation.NavigationStack.IndexOf(this) - 1;

            if (x >= 0)
            {
                var previousPage = Navigation.NavigationStack[Navigation.NavigationStack.IndexOf(this) - 1];
                Navigation.RemovePage(previousPage);
            }
        }
Example #11
0
        public void InsertarEstacion(Estacion nuevaEstacion, int posicion)
        {
            if (estacionBase != null)
            {
                Estacion pos = estacionBase;
                if (posicion == 0)
                {
                    //continue
                    while (pos.Siguiente != estacionBase)
                    {
                        pos = pos.Siguiente;
                    }
                }
                else
                {
                    for (int p = 0; p < posicion - 1; p++)
                    {
                        pos = pos.Siguiente;
                    }

                    nuevaEstacion.Siguiente = pos.Siguiente;
                    pos.Siguiente           = nuevaEstacion;
                }
            }
        }
Example #12
0
        public void AgregarFinal(Estacion nuevaEstacion)
        {
            if (estacionBase != null)
            {
                nuevaEstacion.Siguiente = estacionBase;

                if (estacionBase.Siguiente == estacionBase)
                {
                    estacionBase.Siguiente = nuevaEstacion;
                }
                else
                {
                    Estacion pos = estacionBase.Siguiente;
                    while (pos.Siguiente != estacionBase)
                    {
                        pos = pos.Siguiente;
                    }

                    pos.Siguiente = nuevaEstacion;
                }
            }
            else
            {
                estacionBase           = nuevaEstacion;
                estacionBase.Siguiente = estacionBase;
            }
        }
Example #13
0
        public void EliminarEstacion(string nombreEstacion)
        {
            bool encontro = false;

            if (estacionBase != null)
            {
                if (estacionBase.Siguiente == estacionBase && estacionBase.Nombre == nombreEstacion)
                {
                    estacionBase = null;
                }
                else
                {
                    Estacion pos = estacionBase;

                    while (pos.Siguiente != estacionBase && !encontro)
                    {
                        if (pos.Siguiente.Nombre == nombreEstacion)
                        {
                            pos.Siguiente = pos.Siguiente.Siguiente;
                            encontro      = true;
                        }
                        pos = pos.Siguiente;
                    }
                    if (encontro == false && nombreEstacion == estacionBase.Nombre)
                    {
                        pos.Siguiente = pos.Siguiente.Siguiente;
                        estacionBase  = pos.Siguiente;
                    }
                }
            }
        }
Example #14
0
 public EditEstacionForm(EstacionesListForm listForm, Repositorio repositorioEstacion, Estacion estacion)
 {
     InitializeComponent();
     this.listForm = listForm;
     this.attrs    = new EstacionAttrs(estacion, repositorioEstacion);
     this.estacion = estacion;
 }
Example #15
0
 protected void chartDay(int idEstacion, string fecha, out string pm1D, out string pm2p5D, out string pm10D, out decimal max)
 {
     pm1D = pm2p5D = pm10D = ""; max = 0;
     try
     {
         List <Estacion> lstDatosEstacion = new List <Estacion>();
         lstDatosEstacion = Estacion.GetEstacionesDay(idEstacion, fecha);
         foreach (Estacion row in lstDatosEstacion)
         {
             if (max < row.PM1_1H)
             {
                 max = row.PM1_1H;
             }
             if (max < row.PM2P5_1H)
             {
                 max = row.PM2P5_1H;
             }
             if (max < row.PM10_1H)
             {
                 max = row.PM10_1H;
             }
             pm1D   += "{x: new Date(" + row.Fecha.Year + "," + row.Fecha.Month + "," + row.Fecha.Day + "," + row.Fecha.Hour + "," + row.Fecha.Minute + "), y: " + row.PM1_1H + "},";
             pm2p5D += "{x: new Date(" + row.Fecha.Year + "," + row.Fecha.Month + "," + row.Fecha.Day + "," + row.Fecha.Hour + "," + row.Fecha.Minute + "), y: " + row.PM2P5_1H + "},";
             pm10D  += "{x: new Date(" + row.Fecha.Year + "," + row.Fecha.Month + "," + row.Fecha.Day + "," + row.Fecha.Hour + "," + row.Fecha.Minute + "), y: " + row.PM10_1H + "},";
         }
     }
     catch (Exception ex) { }
 }
Example #16
0
        /// <summary>
        /// Método que a partir de una estación, encuentra las rutas optimas hacia todos los demás
        /// </summary>
        /// <param name="origen"></param>
        /// <returns></returns>
        public List<Estacion> CalculaRutasMinimas(Estacion origen)
        {
            List<Estacion> S = new List<Estacion>();
            List<Estacion> minimos = new List<Estacion>();

            S.Add(origen);

            while (S.Count > 0) // Mientras que existan elementos para procesar
            {
                // Sacamos un elemento de la lista
                Estacion temporal = S[0];
                Estacion predecesora = temporal.EstacionPredecesora;
                decimal pesoAnterior = temporal.PesoAcumulado;
                S.RemoveAt(0);
                // Lo agregamos a nuestro arreglo de soluciones
                temporal = grafo.ElementAt(grafo.IndexOfKey(temporal)).Key;
                temporal.EstacionPredecesora = predecesora;
                temporal.PesoAcumulado = pesoAnterior;
                minimos.Add(temporal);
                // Obtenemos el índice
                int indice1 = grafo.IndexOfKey(temporal);
                int indice2 = -1;
                // Por cada conexión con este nodo
                foreach (Conexion conexion in temporal.Conexiones)
                {
                    // Para cada arista que conecta con temporal
                    indice2 = grafo.IndexOfKey(conexion.Destino);
                    // No hay conexion
                    if (MatrizPesos[indice1, indice2] <= 0) continue;
                    // Ya se calculó
                    if (minimos.Contains(conexion.Destino)) continue;

                    // Marcamos con la etiqueta el nodo seleccionado
                    conexion.Destino.EstacionPredecesora = temporal;
                    conexion.Destino.PesoAcumulado = MatrizPesos[indice1, indice2] + temporal.PesoAcumulado;

                    // Si no existe, lo agregamos a la lista para ser procesado por el algoritmo
                    if (!S.Contains(conexion.Destino))
                    {
                        S.Add(conexion.Destino);
                        continue;
                    }
                    // Si llegó aquí es porque ya existía, entonces lo buscamos para comprobar que
                    // siempre esté actualizado con el menor peso
                    for (int ix = 0; ix < S.Count; ix++)
                    {
                        Estacion e = S[ix];
                        if (e.Equals(conexion.Destino) // Si hablamos de las mismas estaciones
                            && e.PesoAcumulado > conexion.Destino.PesoAcumulado) // Y el peso es menor
                        {
                            S.RemoveAt(ix);
                            S.Add(conexion.Destino);
                            break;
                        }
                    }
                }
            }
            return minimos;
        }
Example #17
0
        private void BotonAceptar_Click(object sender, System.EventArgs e)
        {
            if (EntradaUsuario.ValueInt == 0)
            {
                MessageBox.Show("Por favor ingrese su número de usuario y su contraseña.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                return;
            }

            if (EntradaUsuario.ValueInt == 1 && Lfx.Workspace.Master.DebugMode == false)
            {
                string[] EstacionesAdministrador = Lfx.Workspace.Master.CurrentConfig.ReadGlobalSetting <string>("Sistema.Ingreso.Administrador.Estaciones", "").Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                bool     Puede = false;
                if (EstacionesAdministrador.Length == 0)
                {
                    Puede = true;
                }
                else
                {
                    foreach (string Estacion in EstacionesAdministrador)
                    {
                        if (Estacion.ToUpperInvariant() == Lfx.Environment.SystemInformation.MachineName)
                        {
                            Puede = true;
                            break;
                        }
                    }
                }

                if (Puede == false)
                {
                    System.Threading.Thread.Sleep(800);
                    Lbl.Sys.Config.ActionLog(Lfx.Workspace.Master.MasterConnection, Lbl.Sys.Log.Acciones.LogOnFail, EntradaUsuario.Elemento, "Equipo no permitido.");
                    MessageBox.Show("No se permite el acceso como Administrador desde este equipo.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }
            }

            Lbl.Personas.Usuario Usu = new Lbl.Personas.Usuario(Lfx.Workspace.Master.MasterConnection, EntradaUsuario.ValueInt);
            if (Usu.ContrasenaValida(EntradaContrasena.Text) == false)
            {
                System.Threading.Thread.Sleep(800);
                Lbl.Sys.Config.ActionLog(Lfx.Workspace.Master.MasterConnection, Lbl.Sys.Log.Acciones.LogOnFail, EntradaUsuario.Elemento, "Usuario o contraseña incorrecto.");
                MessageBox.Show("El nombre de usuario o la contraseña son incorrectos.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                EntradaContrasena.SelectionStart  = 0;
                EntradaContrasena.SelectionLength = EntradaContrasena.Text.Length;
                EntradaContrasena.Focus();
            }
            else
            {
                OkButton.Text = "Ingresando...";
                OkButton.Refresh();
                //Lbl.Personas.Persona Usuario = new Lbl.Personas.Persona(Lfx.Workspace.Master.MasterConnection, Usu.Id);
                Lbl.Sys.Config.Actual.UsuarioConectado = new Lbl.Sys.Configuracion.UsuarioConectado(Usu);
                Lfx.Workspace.Master.CurrentConfig.WriteGlobalSetting("Sistema.Ingreso.UltimoUsuario", Lbl.Sys.Config.Actual.UsuarioConectado.Id.ToString(), Lfx.Environment.SystemInformation.MachineName);
                Lfx.Workspace.Master.CurrentConfig.WriteGlobalSetting("Sistema.Ingreso.UltimoIngreso", Lfx.Types.Formatting.FormatDateTimeSql(System.DateTime.Now), Lfx.Environment.SystemInformation.MachineName);
                Lbl.Sys.Config.ActionLog(Lfx.Workspace.Master.MasterConnection, Lbl.Sys.Log.Acciones.LogOn, Usu, null);
                this.Close();
            }
        }
 //Cargar campos de TEXTO automaticamente.
 private void CargarCampos(Estacion estacion)
 {
     txtBoxCuit.Text        = estacion.Cuit.ToString();
     txtBoxRazonSocial.Text = estacion.RazonSocial;
     txtBoxCalle.Text       = estacion.Calle;
     txtBoxNumero.Text      = estacion.Nro.ToString();
     txtFechaHab.Text       = estacion.FechaHabilitacion.ToString();
 }
Example #19
0
        public Estacion RetrieveEstacionPorNombre(string nombre)
        {
            var estacion = new Estacion {
                Nombre = nombre
            };

            return(_crudFactory.RetrieveByName <Estacion>(estacion.Nombre));
        }
Example #20
0
        public Estacion RetrieveEstacionPorCodigo(string codigo)
        {
            var estacion = new Estacion {
                Codigo = codigo
            };

            return(_crudFactory.Retrieve <Estacion>(estacion.Codigo));
        }
 public void addEstacion(Estacion estacion)
 {
     using (var repositorio = new Repositorio())
     {
         repositorio.Guardar(estacion);
         this.dibujarRenglones(repositorio);
     }
 }
Example #22
0
        public RegisterEstacion(Estacion estacion)
        {
            InitializeComponent();
            Loaded += RegisterEstacion_Loaded;

            Estacion = estacion;
            isEdit   = true;
        }
        public ActionResult DeleteConfirmed(int id)
        {
            Estacion estacion = db.Estacion.Single(e => e.idEstacion == id);

            db.Estacion.DeleteObject(estacion);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Example #24
0
        public Monitoreo(Estacion estacion, Modelo modelo)
        {
            Estacion = estacion;
            Modelo   = modelo;

            InitializeComponent();
            Initialize();
            ;
        }
        private List <ReportHelperValorIdaVuelta> getListByEstacion(double tipoReporte, Servicio servicio)
        {
            List <ReportHelperValorIdaVuelta> listEstaciones = new List <ReportHelperValorIdaVuelta>();
            Tramo ultimoTramo = servicio.Tramos.Last();

            foreach (Tramo tramo in servicio.Tramos)
            {
                Estacion estacionOrigen  = tramo.EstacionOrigen;
                Estacion estacionDestino = null;
                if (tramo.Equals(ultimoTramo))
                {
                    estacionDestino = tramo.EstacionDestino;
                }
                ;
                if (tipoReporte == 1)
                {
                    listEstaciones.Add(new ReportHelperValorIdaVuelta(estacionOrigen.Nombre, estacionOrigen.ResultadoIda.PorcentajeOcupacion, estacionOrigen.ResultadoVuelta.PorcentajeOcupacion));
                    if (estacionDestino != null)
                    {
                        listEstaciones.Add(new ReportHelperValorIdaVuelta(estacionDestino.Nombre, estacionDestino.ResultadoIda.PorcentajeOcupacion, estacionDestino.ResultadoVuelta.PorcentajeOcupacion));
                    }
                }
                else if (tipoReporte == 2)
                {
                    listEstaciones.Add(new ReportHelperValorIdaVuelta(estacionOrigen.Nombre, estacionOrigen.ResultadoIda.PorcentajePersonasParadas, estacionOrigen.ResultadoVuelta.PorcentajePersonasParadas));
                    if (estacionDestino != null)
                    {
                        listEstaciones.Add(new ReportHelperValorIdaVuelta(estacionDestino.Nombre, estacionDestino.ResultadoIda.PorcentajePersonasParadas, estacionDestino.ResultadoVuelta.PorcentajePersonasParadas));
                    }
                }
                else if (tipoReporte == 3)
                {
                    listEstaciones.Add(new ReportHelperValorIdaVuelta(estacionOrigen.Nombre, estacionOrigen.ResultadoIda.PorcentajeSuperaronMaxCantLegal, estacionOrigen.ResultadoVuelta.PorcentajeSuperaronMaxCantLegal));
                    if (estacionDestino != null)
                    {
                        listEstaciones.Add(new ReportHelperValorIdaVuelta(estacionDestino.Nombre, estacionDestino.ResultadoIda.PorcentajeSuperaronMaxCantLegal, estacionDestino.ResultadoVuelta.PorcentajeSuperaronMaxCantLegal));
                    }
                }
                else if (tipoReporte == 4)
                {
                    listEstaciones.Add(new ReportHelperValorIdaVuelta(estacionOrigen.Nombre, estacionOrigen.ResultadoIda.PorcentajeRegularidadAbsoluta, estacionOrigen.ResultadoVuelta.PorcentajeRegularidadAbsoluta));
                    if (estacionDestino != null)
                    {
                        listEstaciones.Add(new ReportHelperValorIdaVuelta(estacionDestino.Nombre, estacionDestino.ResultadoIda.PorcentajeRegularidadAbsoluta, estacionDestino.ResultadoVuelta.PorcentajeRegularidadAbsoluta));
                    }
                }
                else if (tipoReporte == 5)
                {
                    listEstaciones.Add(new ReportHelperValorIdaVuelta(estacionOrigen.Nombre, estacionOrigen.ResultadoIda.PorcentajeDemoraPorIncidentes, estacionOrigen.ResultadoVuelta.PorcentajeDemoraPorIncidentes));
                    if (estacionDestino != null)
                    {
                        listEstaciones.Add(new ReportHelperValorIdaVuelta(estacionDestino.Nombre, estacionDestino.ResultadoIda.PorcentajeDemoraPorIncidentes, estacionDestino.ResultadoVuelta.PorcentajeDemoraPorIncidentes));
                    }
                }
            }
            return(listEstaciones);
        }
Example #26
0
 private void CargarDatos()
 {
     using (DBTallerFEntities db = new DBTallerFEntities())
     {
         establa = db.Estacion.Find(id);
         txtNombreEstacion.Text          = establa.EstacionNombre;
         txtCodigoActividadEstacion.Text = establa.ActividadId.ToString();
     }
 }
        public void OnestacionEdit(int estacionId)
        {
            using (var repositorio = new Repositorio())
            {
                Estacion estacion = repositorio.Obtener <Estacion>(estacionId);
                this.mainForm.EmbedForm(new EditEstacionForm(this, repositorio, estacion), tabPage);
            }

            this.Visible = false;
        }
    // Start is called before the first frame update
    void Start()
    {
        isOver         = false;
        estacionScript = estacionObj.GetComponent <Estacion>();

        if (!isOver)
        {
            generalAudio.Play();
        }
    }
        private void materialRaisedButton1_Click(object sender, EventArgs e)
        {
            using (var repositorio = new Repositorio())
            {
                Estacion estacion = new Estacion();
                this.mainForm.EmbedForm(new CreateEstacionForm(this, estacion, repositorio), tabPage);
            }

            this.Visible = false;
        }
 public ActionResult Edit(Estacion estacion)
 {
     if (ModelState.IsValid)
     {
         db.Estacion.Attach(estacion);
         db.ObjectStateManager.ChangeObjectState(estacion, EntityState.Modified);
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(estacion));
 }
        public ActionResult Create(Estacion estacion)
        {
            if (ModelState.IsValid)
            {
                db.Estacion.AddObject(estacion);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(estacion));
        }
Example #32
0
        public void AñadirConsumo(Estacion estacion, Tarjetum tarjeta, DateTime fecha, DateTime hora)
        {
            using (EntitiesModel dbContext = new EntitiesModel())
            {

                Consumo consumo = new Consumo();

                consumo.Estacion = estacion;
                consumo.Tarjetum = tarjeta;
                consumo.Fecha = fecha;
                consumo.Hora = hora;

                dbContext.Add(consumo);
                dbContext.SaveChanges();

            }
        }
Example #33
0
        public void AñadirRecarga(Estacion estacion, Tarjetum tarjeta, DateTime fecha, DateTime hora)
        {
            using (EntitiesModel dbContext = new EntitiesModel())
            {

                Recarga recarga = new Recarga();

                recarga.Estacion = estacion ;
                recarga.Tarjetum = tarjeta;
                recarga.Fecha = fecha;
                recarga.Hora = hora;

                dbContext.Add(recarga);
                dbContext.SaveChanges();

            }
        }
Example #34
0
        public void EditarRecarga(Estacion estacion, Tarjetum tarjeta, DateTime fecha, DateTime hora)
        {
            using (EntitiesModel dbContext = new EntitiesModel())
            {

                //se supone que debemos hacer el update pidiendo el ID.....falta implementarlo

                Recarga RecargaParaEditar = dbContext.Recargas.First();

                RecargaParaEditar.Estacion = estacion ;
                RecargaParaEditar.Tarjetum = tarjeta ;
                RecargaParaEditar.Fecha = fecha ;
                RecargaParaEditar.Hora = hora;

                dbContext.SaveChanges();

            }
        }
Example #35
0
        public void CargaGrafo()
        {
            Database db = DatabaseFactory.CreateDatabase("RutAppBd");

            // Recuperamos todas las estaciones de la base de datos
            DbCommand cmd = db.GetStoredProcCommand("dbo.ObtieneTodasEstaciones");
            int ix = 0;
            using (IDataReader reader = db.ExecuteReader(cmd))
            {
                while (reader.Read())
                {
                    String idEstacion = reader.GetString(reader.GetOrdinal("id"));
                    Estacion nvaEst = new Estacion(idEstacion);
                    nvaEst.Nombre = reader.GetString(reader.GetOrdinal("nombre"));
                    int i = reader.GetOrdinal("linea");
                    if (!reader.IsDBNull(i))
                        nvaEst.Linea = reader.GetString(i);
                    nvaEst.Latitud = (decimal)reader.GetDouble(reader.GetOrdinal("latitud"));
                    nvaEst.Longitud = (decimal)reader.GetDouble(reader.GetOrdinal("longitud"));
                    nvaEst.Tarifa = reader.GetDecimal(reader.GetOrdinal("tarifa"));
                    nvaEst.TipoEstacion = reader.GetString(reader.GetOrdinal("tipo_estacion"));

                    grafo.Add(nvaEst, ix++);
                }
            }

            // Para cada estacion, obtenemos sus adyacencias
            foreach (Estacion estacion in grafo.Keys)
            {
                DbCommand dbC = db.GetStoredProcCommand("RecuperaTramos");
                db.AddInParameter(dbC, "estacion", DbType.String, estacion.IdEstacion);
                using (IDataReader reader = db.ExecuteReader(dbC))
                {
                    while (reader.Read())
                    {
                        Conexion conexion = new Conexion();
                        conexion.MetrosTramo = reader.GetDecimal(reader.GetOrdinal("distancia"));
                        conexion.VelocidadPromedio = reader.GetDecimal(reader.GetOrdinal("velocidad"));
                        conexion.Destino = new Estacion(reader.GetString(1));
                        estacion.Conexiones.Add(conexion);
                    }
                }
            }

            // Relleno de la matriz de pesos
            MatrizPesos = new decimal[NumeroNodos, NumeroNodos];
            for (int i = 0; i < NumeroNodos; i++)
            {
                for (int j = 0; j < NumeroNodos; j++)
                {
                    Estacion uno = grafo.ElementAt(i).Key;
                    Estacion dos = grafo.ElementAt(j).Key;
                    MatrizPesos[i, j] = uno.PesoConexion(dos);
                }
            }
        }
Example #36
0
        public Estacion EstacionMasCercana(decimal latitud, decimal longitud)
        {
            Estacion e = null;
            Database db = DatabaseFactory.CreateDatabase("RutAppBd");

            // Recuperamos todas las estaciones de la base de datos
            DbCommand cmd = db.GetStoredProcCommand("dbo.ObtieneEstacionesCercanas");
            db.AddInParameter(cmd, "latitud", DbType.Decimal, latitud);
            db.AddInParameter(cmd, "longitud", DbType.Decimal, longitud);
            db.AddInParameter(cmd, "radio", DbType.Int32, 2000);
            using (IDataReader reader = db.ExecuteReader(cmd))
            {
                if (reader.Read())
                {
                    String idEstacion = reader.GetString(reader.GetOrdinal("id"));
                    e = new Estacion(idEstacion);
                    e.Nombre = reader.GetString(reader.GetOrdinal("nombre"));
                    int i = reader.GetOrdinal("linea");
                    if (!reader.IsDBNull(i))
                        e.Linea = reader.GetString(i);
                    e.Latitud = (decimal)reader.GetDouble(reader.GetOrdinal("latitud"));
                    e.Longitud = (decimal)reader.GetDouble(reader.GetOrdinal("longitud"));
                    e.Tarifa = reader.GetDecimal(reader.GetOrdinal("tarifa"));
                    e.TipoEstacion = reader.GetString(reader.GetOrdinal("tipo_estacion"));
                }
            }
            return e;
        }
Example #37
0
        /// <summary>
        /// Método para encontrar la ruta óptima entre dos puntos dadas las estaciones para iniciar
        /// </summary>
        /// <param name="inicio">Estación inicial</param>
        /// <param name="fin">Estación final</param>
        /// <returns>La mejor ruta encontrada</returns>
        public Ruta EncontrarRuta(Estacion inicio, Estacion fin)
        {
            Estacion auxiliar = fin;

            // Encontramos la ruta a partir del inicio
            List<Estacion> minimos = CalculaRutasMinimas(inicio);

            Ruta ruta = new Ruta();
            decimal distancia = 0;

            // Si no existe en nuestra lista es porque no hay conexión entre ellos
            if (!minimos.Contains(auxiliar))
            {
                throw new Exception(String.Format("{0} no alcanzable desde {1}", fin.Nombre, inicio.Nombre));
            }

            auxiliar = minimos[minimos.IndexOf(auxiliar)];
            distancia = auxiliar.PesoAcumulado;
            // Se usa una pila para almacenar la ruta
            Stack<Estacion> pila = new Stack<Estacion>();
            while (auxiliar != null)
            {
                pila.Push(auxiliar);
                auxiliar = auxiliar.EstacionPredecesora;
            }
            // Vaciar la pila para armar la ruta correcta
            while (pila.Count > 0)
            {
                ruta.Estaciones.Add(pila.Pop());
            }
            return ruta;
        }
Example #38
0
 /// <summary>
 /// Obtiene el índice dentro del grafo en el que se
 /// encuentra la estación especificada
 /// </summary>
 /// <param name="e"></param>
 /// <returns></returns>
 public int ObtenerIndiceEstacion(Estacion e)
 {
     return grafo.IndexOfKey(e);
 }