//Modifica contraseña (recuperar)
        public async Task updateClave(Conductor conductor)
        {
            using (var db = new MapeoConductor())
            {
                Conductor usuarioAnterior = db.conduc.Where(x => x.IdConductor == conductor.IdConductor).First();
                usuarioAnterior.Contrasena = conductor.Contrasena;

                db.conduc.Attach(usuarioAnterior);

                var entry = db.Entry(usuarioAnterior);
                entry.State = EntityState.Modified;
                await db.SaveChangesAsync();
            }
        }
Exemplo n.º 2
0
        ////Select Pago Conductor List
        //public List<Notificacion> notificacion()
        //{
        //    using (var db = new MapeoConductor())
        //    {
        //        List<Notificacion> lista = (from n in db.notificacion
        //                                    join co in db.conduc on n.IdConductor equals co.IdConductor
        //                                    select new
        //                                    {
        //                                        n,
        //                                        co.Nombre
        //                                    }).ToList().Select(m => new Notificacion
        //                                    {
        //                                        Id = m.n.Id,
        //                                        IdConductor = m.n.IdConductor,
        //                                        NombreCo = m.Nombre
        //                                    }).OrderBy(x => x.IdConductor).ToList();

        //        var conductores = lista.GroupBy(x => x.IdConductor).Select(grp => grp.ToList());

        //        List<Notificacion> listaCo = new List<Notificacion>();

        //        foreach (var item in conductores)
        //        {
        //            Notificacion notificacion = new Notificacion();
        //            notificacion.ListaConductores = item;
        //            notificacion.IdConductor = notificacion.ListaConductores.First().IdConductor;
        //            notificacion.NombreCo = notificacion.ListaConductores.First().NombreCo;
        //            listaCo.Add(notificacion);
        //        }

        //        return listaCo;
        //    }
        //}

        ////Select Comentarios Conductor
        //public List<Notificacion> mostrarCarreraConductor()
        //{
        //    using (var db = new MapeoConductor())
        //    {
        //        return (from n in db.notificacion
        //                join cl in db.client on n.IdCliente equals cl.IdCliente
        //                join co in db.conduc on n.IdConductor equals co.IdConductor
        //                orderby n.FechaCarrera
        //                select new
        //                {
        //                    n,
        //                    cl.Nombrecl,
        //                    co.Sesion
        //                }).ToList().Select(m => new Notificacion
        //                {
        //                    Id = m.n.Id,
        //                    IdCliente = m.n.IdCliente,
        //                    IdDestino = m.n.IdDestino,
        //                    IdUbicacion = m.n.IdUbicacion,
        //                    Tarifa = m.n.Tarifa,
        //                    FechaCarrera = m.n.FechaCarrera,
        //                    Estado = m.n.Estado,
        //                    IdConductor = m.n.IdConductor,
        //                    Conductor = m.n.Conductor,
        //                    ComentarioDeCliente = m.n.ComentarioDeCliente,
        //                    FechaFinCarrera = m.n.FechaFinCarrera,
        //                    NombreCl = m.Nombrecl,
        //                    Sesion = m.Sesion
        //                }).Where(x => x.Estado.Contains("Aceptado") && x.ComentarioDeCliente != null).OrderBy(x => x.FechaCarrera).ToList();
        //    }
        //}

        ////Select Comentarios Cliente
        //public List<Notificacion> mostrarServiciosCliente()
        //{
        //    using (var db = new MapeoCliente())
        //    {
        //        return (from n in db.notificacion
        //                join cl in db.client on n.IdCliente equals cl.IdCliente
        //                orderby n.FechaCarrera
        //                select new
        //                {
        //                    n,
        //                    cl.Nombrecl,
        //                    cl.Sesion
        //                }).ToList().Select(m => new Notificacion
        //                {
        //                    Id = m.n.Id,
        //                    IdCliente = m.n.IdCliente,
        //                    IdDestino = m.n.IdDestino,
        //                    IdUbicacion = m.n.IdUbicacion,
        //                    Tarifa = m.n.Tarifa,
        //                    FechaCarrera = m.n.FechaCarrera,
        //                    Estado = m.n.Estado,
        //                    IdConductor = m.n.IdConductor,
        //                    Conductor = m.n.Conductor,
        //                    ComentarioDeConductor = m.n.ComentarioDeConductor,
        //                    FechaFinCarrera = m.n.FechaFinCarrera,
        //                    NombreCl = m.Nombrecl,
        //                    Sesion = m.Sesion
        //                }).Where(x => x.Estado.Contains("Aceptado") && x.ComentarioDeConductor != null).OrderBy(x => x.FechaCarrera).ToList();
        //    }
        //}

        //Update Estado
        public void sesionConductor(Conductor conductor)
        {
            using (var db = new MapeoConductor())
            {
                Conductor estadoAnterior = db.conduc.Where(x => x.IdConductor == conductor.IdConductor).First();
                estadoAnterior.Sesion = conductor.Sesion;

                db.conduc.Attach(estadoAnterior);

                var entry = db.Entry(estadoAnterior);
                entry.State = EntityState.Modified;
                db.SaveChanges();
            }
        }
Exemplo n.º 3
0
        //Eliminacion de cuenta (S)
        public async Task eliminarConductor(Conductor conductor)
        {
            using (var db = new MapeoConductor())
            {
                Conductor conductorAnterior = db.conduc.Where(x => x.IdConductor == conductor.IdConductor).FirstOrDefault();
                conductorAnterior.Sesion = "inactivo";

                db.conduc.Attach(conductorAnterior);

                var entry = db.Entry(conductorAnterior);
                entry.State = EntityState.Modified;
                await db.SaveChangesAsync();
            }
        }
        //Cierra acceso al cerrar sesion
        public async Task cerrarAcceso(int id_conductor)//S
        {
            using (var db = new MapeoConductor())
            {
                AccesoConductor acceso = db.accesoconductor.Where(x => x.IdConductor == id_conductor && x.FechaFin == null).FirstOrDefault();
                acceso.FechaFin = DateTime.Now;

                db.accesoconductor.Attach(acceso);

                var entry = db.Entry(acceso);
                entry.State = EntityState.Modified;
                await db.SaveChangesAsync();
            }
        }
Exemplo n.º 5
0
        //Conversacion (S)
        public async Task coversar(Notificacion notificacion)
        {
            using (var db = new MapeoConductor())
            {
                Notificacion notificacionAnterior = db.notificacion.Where(x => x.Id == notificacion.Id).FirstOrDefault();
                notificacionAnterior.Conversacion = notificacion.Conversacion;

                db.notificacion.Attach(notificacionAnterior);

                var entry = db.Entry(notificacionAnterior);
                entry.State = EntityState.Modified;
                await db.SaveChangesAsync();
            }
        }
Exemplo n.º 6
0
        //Modificar Estado (S)
        public async Task estadoConductor(Conductor conductor)
        {
            using (var db = new MapeoConductor())
            {
                Conductor estadoAnterior = db.conduc.Where(x => x.IdConductor == conductor.IdConductor).First();
                estadoAnterior.IdEstado = conductor.IdEstado;

                db.conduc.Attach(estadoAnterior);

                var entry = db.Entry(estadoAnterior);
                entry.State = EntityState.Modified;
                await db.SaveChangesAsync();
            }
        }
Exemplo n.º 7
0
        public void sancionConductor(Conductor conductor)
        {
            using (var db = new MapeoConductor())
            {
                Conductor sancion = db.conduc.Where(x => x.IdConductor == conductor.IdConductor).First();
                sancion.Sesion       = conductor.Sesion;
                sancion.FechaSancion = conductor.FechaSancion;

                db.conduc.Attach(sancion);

                var entry = db.Entry(sancion);
                entry.State = EntityState.Modified;
                db.SaveChanges();
            }
        }
Exemplo n.º 8
0
        //Añadir comentario en tabla historial (S)
        public async Task comentar(Notificacion notificacion)
        {
            using (var db = new MapeoConductor())
            {
                Notificacion notificacionAnterior = db.notificacion.Where(x => x.Id == notificacion.Id).FirstOrDefault();
                notificacionAnterior.ComentarioDeConductor = notificacion.ComentarioDeConductor;
                notificacionAnterior.FechaFinCarrera       = DateTime.Now;

                db.notificacion.Attach(notificacionAnterior);

                var entry = db.Entry(notificacionAnterior);
                entry.State = EntityState.Modified;
                await db.SaveChangesAsync();
            }
        }
Exemplo n.º 9
0
        //Aceptar el servicio (S)
        public async Task aceptarServicio(Notificacion notificacion)
        {
            using (var db = new MapeoConductor())
            {
                Notificacion notificacionAnterior = db.notificacion.Where(x => x.Id == notificacion.Id).FirstOrDefault();
                notificacionAnterior.Estado      = notificacion.Estado;
                notificacionAnterior.Conductor   = notificacion.Conductor;
                notificacionAnterior.IdConductor = notificacion.IdConductor;

                db.notificacion.Attach(notificacionAnterior);

                var entry = db.Entry(notificacionAnterior);
                entry.State = EntityState.Modified;
                await db.SaveChangesAsync();
            }
        }
Exemplo n.º 10
0
        //Modifica registro
        public async Task modificarConductor(Conductor conductor)
        {
            using (var db = new MapeoConductor())
            {
                Conductor conductorAnterior = db.conduc.Where(x => x.IdConductor == conductor.IdConductor).FirstOrDefault();
                conductorAnterior.Nombre            = conductor.Nombre;
                conductorAnterior.Apellido          = conductor.Apellido;
                conductorAnterior.FechaDeNacimiento = conductor.FechaDeNacimiento;
                conductorAnterior.Email             = conductor.Email;
                conductorAnterior.Placa             = conductor.Placa;
                conductorAnterior.Usuario           = conductor.Usuario;
                conductorAnterior.Contrasena        = conductor.Contrasena;

                db.conduc.Attach(conductorAnterior);

                var entry = db.Entry(conductorAnterior);
                entry.State = EntityState.Modified;
                await db.SaveChangesAsync();
            }
        }