Exemplo 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;
                }
            }
        }
Exemplo n.º 2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            this._uow = new UnitOfWork();
            AssignedDriver assignedDriver = new AssignedDriver(this._uow);
            assignedDriver.DriverName = this._employee.DisplayName;
            assignedDriver.Planning = new TIS.Model.Internal.Planning(this._uow).GetPlanning(((ComboBoxItem) this.cboDispatcher.SelectedItem).Value.UsrID).Id;
            assignedDriver.Driver = this._employee.EmpID;
            this._uow.CommitChanges();

            Close();
        }
Exemplo n.º 3
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            this._uow = new UnitOfWork();
            AssignedDriver assignedDriver = new AssignedDriver(this._uow);

            assignedDriver.DriverName = this._employee.DisplayName;
            assignedDriver.Planning   = new TIS.Model.Internal.Planning(this._uow).GetPlanning(((ComboBoxItem)this.cboDispatcher.SelectedItem).Value.UsrID).Id;
            assignedDriver.Driver     = this._employee.EmpID;
            this._uow.CommitChanges();

            Close();
        }
        public IActionResult UpdateAssignedDriver(AssignedDriverVm ab)
        {
            AssignedDriver a = new AssignedDriver()
            {
                DriverId         = ab.DriverId,
                BusId            = ab.BusId,
                AssignedDriverId = ab.AssignedDriverId
            };

            _context.AssignedDrivers.Update(a);
            _context.SaveChanges();

            return(RedirectToAction("AssignBusList"));
        }
        public IActionResult AssignBus(AssignedDriverVm a)
        {
            var sa = _context.AssignedDrivers.AsNoTracking().
                     Where(s => s.BusId == a.BusId && s.DriverId == a.DriverId).FirstOrDefault();

            if (sa != null)
            {
                ViewBag.SMS = "You have Already Asssigned  driver for this bus";
                return(View());
            }

            AssignedDriver ab = new AssignedDriver()
            {
                AssignedDriverId = 0,
                BusId            = a.BusId,
                DriverId         = a.DriverId
            };

            _context.AssignedDrivers.Add(ab);
            _context.SaveChanges();
            return(RedirectToAction("AssignBusList"));
        }
Exemplo n.º 6
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;
                }
            }
        }
Exemplo n.º 7
0
        private void FillGrids()
        {
            gridUnassigned.DataSource = null;
            gridAssigned.DataSource   = null;

            //TODO: Check for refactoring
            EmployeeObjectCollection employees       = new BL.Internal.Employee().GetAll();
            EmployeeObjectCollection employeesTwo    = new BL.Internal.Employee().GetAll();
            List <AssignedDriver>    assignedDrivers = new AssignedDriver(new UnitOfWork()).GetAll();

            foreach (EmployeeObject employeeObject in employees)
            {
                foreach (AssignedDriver assignedDriver in assignedDrivers)
                {
                    if (employeeObject.EmpID == assignedDriver.Driver)
                    {
                        employeesTwo.Remove(employeeObject);
                    }
                }
            }

            gridUnassigned.DataSource = employeesTwo;
            gridAssigned.DataSource   = assignedDrivers;
        }
Exemplo n.º 8
0
        private void FillGrids()
        {
            gridUnassigned.DataSource = null;
            gridAssigned.DataSource = null;

            //TODO: Check for refactoring
            EmployeeObjectCollection employees = new BL.Internal.Employee().GetAll();
            EmployeeObjectCollection employeesTwo = new BL.Internal.Employee().GetAll();
            List<AssignedDriver> assignedDrivers = new AssignedDriver(new UnitOfWork()).GetAll();

            foreach (EmployeeObject employeeObject in employees)
            {
                foreach (AssignedDriver assignedDriver in assignedDrivers)
                {
                    if (employeeObject.EmpID == assignedDriver.Driver)
                    {
                        employeesTwo.Remove(employeeObject);
                    }
                }
            }

            gridUnassigned.DataSource = employeesTwo;
            gridAssigned.DataSource = assignedDrivers;
        }
Exemplo n.º 9
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;
            }
        }
Exemplo n.º 10
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;
            }
        }