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

            this._uow = new UnitOfWork();
            this._job = new Job(this._uow);
            this._planning = planning;
            this._planningId = this._planning.Id;
            this.dteJobDate.DateTime = DateTime.Now;

            FillComboboxes();
        }
示例#2
0
        public JobDetail(Model.Internal.Planning planning, Job job)
        {
            InitializeComponent();

            this._uow = new UnitOfWork();
            this._job = new XPQuery<Job>(this._uow).FirstOrDefault(q => q.Id == job.Id);
            this._planningId = this._job.Planning;
            this._planning = planning;

            FillComboboxes();
            FillDetails();

            this.dteJobDate.DateTime = DateTime.Now;
        }
示例#3
0
        private void FillCboTrucks()
        {
            if (this._job.Truck != null)
            {
                this.cboTrucks.Items.Add(this._job.Truck);
                this.cboTrucks.SelectedIndex = 0;
            }

            var assignedVehicles = new AssignedVehicle(new UnitOfWork()).GetAll(this._planningId);
            var jobs = new Job(new UnitOfWork()).GetAll(this._planningId, this.dteJobDate.DateTime.Date);

            foreach (Job job in jobs)
            {
                var result = assignedVehicles.Where(x => x.TruckName == job.Truck);
                assignedVehicles.Remove(result.ToList()[0]);
            }

            foreach (AssignedVehicle assignedVehicle in assignedVehicles)
            {
                //TODO: Wat moet getoond worden?
                this.cboTrucks.Items.Add(assignedVehicle.TruckName);
                if (assignedVehicle.TruckName == this._job.Truck)
                    this.cboTrucks.SelectedIndex = this.cboTrucks.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;
            }
        }