示例#1
0
        public AbsentDetail(Model.Internal.Planning planning)
        {
            InitializeComponent();

            this._uow = new UnitOfWork();
            this._absence = new Absence(this._uow);
            this._planning = planning;
            this._planningId = this._planning.Id;

            FillCboDrivers();
            this.dteDate.DateTime = DateTime.Today.Date;
        }
示例#2
0
        public AbsentDetail(Model.Internal.Planning planning, Absence absence)
        {
            InitializeComponent();

            this._uow = new UnitOfWork();
            this._absence = new XPQuery<Absence>(this._uow).FirstOrDefault(q => q.Id == absence.Id);
            this._planning = planning;
            this._planningId = this._planning.Id;

            FillDetails();

            FillCboDrivers();
            this.dteDate.DateTime = DateTime.Today.Date;
        }
示例#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;
            }
        }
示例#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;
            }
        }