Ejemplo n.º 1
0
        private void FillCboDrivers()
        {
            cboDrivers.Items.Clear();

            List <Absence>        absences        = new Absence(new UnitOfWork()).GetAll(this._planningId, dteDate.DateTime.Date);
            List <AssignedDriver> assignedDrivers = new AssignedDriver(new UnitOfWork()).GetAll(this._planningId);

            foreach (var absence in absences)
            {
                var result = assignedDrivers.Where(x => x.DriverName.Equals(absence.DriverName));

                if (result.ToList()[0] != null)
                {
                    assignedDrivers.Remove(result.ToList()[0]);
                }
            }

            foreach (AssignedDriver assignedDriver in assignedDrivers)
            {
                this.cboDrivers.Items.Add(assignedDriver.DriverName);

                if (assignedDriver.DriverName.Equals(this._absence.DriverName))
                {
                    this.cboDrivers.SelectedIndex = this.cboDrivers.Items.Count - 1;
                }
            }
        }
Ejemplo n.º 2
0
        private void FillCboDrivers()
        {
            var absences = new Absence(new UnitOfWork()).GetAll(this._planningId, this.dteJobDate.DateTime.Date);
            var jobs     = new Job(new UnitOfWork()).GetAll(this._planningId, this.dteJobDate.DateTime.Date);
            List <AssignedDriver> assignedDrivers = new AssignedDriver(new UnitOfWork()).GetAll(this._planningId);

            if (this._job.Driver != null)
            {
                this.cboDriver.Items.Add(this._job.Driver);
                this.cboDriver.SelectedIndex = 0;
            }

            foreach (Absence absence in absences)
            {
                var result = assignedDrivers.Where(x => x.DriverName.Equals(absence.DriverName));

                if (result.ToList()[0] != null)
                {
                    assignedDrivers.Remove(result.ToList()[0]);
                }
            }

            foreach (Job job in jobs)
            {
                var result = assignedDrivers.Where(x => x.DriverName == job.Driver);
                assignedDrivers.Remove(result.ToList()[0]);
            }

            foreach (AssignedDriver assignedDriver in assignedDrivers)
            {
                this.cboDriver.Items.Add(assignedDriver.DriverName);
                if (assignedDriver.DriverName == this._job.Driver)
                {
                    this.cboDriver.SelectedIndex = this.cboDriver.Items.Count - 1;
                }
            }
        }
Ejemplo n.º 3
0
        private void FillCboDrivers()
        {
            cboDrivers.Items.Clear();

            List<Absence> absences = new Absence(new UnitOfWork()).GetAll(this._planningId, dteDate.DateTime.Date);
            List<AssignedDriver> assignedDrivers = new AssignedDriver(new UnitOfWork()).GetAll(this._planningId);

            foreach (var absence in absences)
            {
                var result = assignedDrivers.Where(x => x.DriverName.Equals(absence.DriverName));

                if (result.ToList()[0] != null)
                    assignedDrivers.Remove(result.ToList()[0]);
            }

            foreach (AssignedDriver assignedDriver in assignedDrivers)
            {
                this.cboDrivers.Items.Add(assignedDriver.DriverName);

                if (assignedDriver.DriverName.Equals(this._absence.DriverName))
                    this.cboDrivers.SelectedIndex = this.cboDrivers.Items.Count - 1;
            }
        }
Ejemplo n.º 4
0
        private void FillCboDrivers()
        {
            var absences = new Absence(new UnitOfWork()).GetAll(this._planningId, this.dteJobDate.DateTime.Date);
            var jobs = new Job(new UnitOfWork()).GetAll(this._planningId, this.dteJobDate.DateTime.Date);
            List<AssignedDriver> assignedDrivers = new AssignedDriver(new UnitOfWork()).GetAll(this._planningId);

            if (this._job.Driver != null)
            {
                this.cboDriver.Items.Add(this._job.Driver);
                this.cboDriver.SelectedIndex = 0;
            }

            foreach (Absence absence in absences)
            {
                var result = assignedDrivers.Where(x => x.DriverName.Equals(absence.DriverName));

                if (result.ToList()[0] != null)
                    assignedDrivers.Remove(result.ToList()[0]);
            }

            foreach (Job job in jobs)
            {
                var result = assignedDrivers.Where(x => x.DriverName == job.Driver);
                assignedDrivers.Remove(result.ToList()[0]);
            }

            foreach (AssignedDriver assignedDriver in assignedDrivers)
            {
                this.cboDriver.Items.Add(assignedDriver.DriverName);
                if (assignedDriver.DriverName == this._job.Driver)
                    this.cboDriver.SelectedIndex = this.cboDriver.Items.Count - 1;
            }
        }