Ejemplo n.º 1
0
        public List <Chofer_Auto> getAllDriverFree(DataGridViewRow unAuto)
        {
            List <Chofer_Auto> choferesLibres = new List <Chofer_Auto>();
            DataTable          dt             = db.select_query("SELECT CHOFER.Id AS IdChofer, CONCAT(PERSONAS.Apellido,' ',PERSONAS.Nombre) AS Chofer FROM FSOCIETY.Chofer CHOFER LEFT JOIN FSOCIETY.Personas PERSONAS on CHOFER.Id = PERSONAS.Id WHERE CHOFER.Habilitado = 1 and CHOFER.Id not in (SELECT AUTOS.IdChofer FROM FSOCIETY.Autos AUTOS LEFT JOIN FSOCIETY.AutosTurnos AUTOSTURNOS ON AUTOS.Id = AUTOSTURNOS.IdAuto GROUP BY AUTOS.IdChofer HAVING COUNT(AUTOSTURNOS.IdAuto) = 3)");

            foreach (DataRow row in dt.Rows)
            {
                choferesLibres.Add(new Chofer_Auto(row));
            }

            if (unAuto != null)
            {
                Chofer_Auto unChofer = new Chofer_Auto(unAuto);
                if (!choferesLibres.Contains(unChofer))
                {
                    choferesLibres.Add(unChofer);
                }
            }

            return(choferesLibres);
        }
Ejemplo n.º 2
0
        internal List <Turno> getAllTurnFree(DataGridViewRow unAuto, Chofer_Auto unChofer)
        {
            List <Turno> turnos = new List <Turno>();

            if (unChofer != null)
            {
                DataTable dt = db.select_query("SELECT TURNOS.Id AS IdTurno, TURNOS.Descripcion AS Turno FROM FSOCIETY.Turnos TURNOS WHERE TURNOS.Id NOT IN (SELECT TURNOS.Id FROM FSOCIETY.Turnos TURNOS INNER JOIN FSOCIETY.AutosTurnos AUTOSTURNOS ON TURNOS.Id = AUTOSTURNOS.IdTurno INNER JOIN FSOCIETY.Autos AUTOS ON AUTOSTURNOS.IdAuto = AUTOS.Id WHERE AUTOS.IdChofer = '" + unChofer.getId() + "')");

                foreach (DataRow row in dt.Rows)
                {
                    turnos.Add(new Turno(row));
                }

                if (unAuto != null)
                {
                    Turno unTurno = new Turno(unAuto);
                    if (!turnos.Contains(unTurno))
                    {
                        turnos.Add(unTurno);
                    }
                }
            }
            return(turnos);
        }