示例#1
0
        private void FillAvailableEmployees()
        {
            AvailableEmployeesLB.Items.Clear();
            StaffEmployeeLogic          employeesLogic         = new StaffEmployeeLogic(manager);
            StaffEmployeePositionsLogic employeePositionsLogic = new StaffEmployeePositionsLogic(manager);

            //List<StaffEmployee> employees = employeesLogic.GetAll().Select(a => new { a.ID, a.LastName + " " + a.FirstName + " " + a.MiddleName});
            AvailableEmployeesLB.ValueMember   = "ID";
            AvailableEmployeesLB.DisplayMember = "Name";

            int structureObjectId = Convert.ToInt32(StructureObjectsCB.SelectedValue);

            //BindingList<Helpers.ItemIntValue> structureObjects = structureObjectsLogic.GetStructureObjectsHierarchy(false, structureObjectId);


            List <StaffEmployee> filteredEmloyees = employeePositionsLogic.GetByPositionID(Convert.ToInt32(PositionsCB.SelectedValue)).Select(a => a.StaffEmployee).ToList();
            var employees = employeesLogic.GetAll().Where(a => filteredEmloyees.Contains(a)).Select(a => new { a.ID, Name = a.LastName + " " + a.FirstName + " " + a.MiddleName });

            foreach (var employee in employees)
            {
                ItemIntValue item = new ItemIntValue();
                item.ID   = employee.ID;
                item.Name = employee.Name;
                AvailableEmployeesLB.Items.Add(item);
            }
        }
示例#2
0
        /// <summary>
        /// Заповнення таблиці працівників для відображення
        /// </summary>
        private void FillGrid()
        {
            manager = new ContextManager();
            DataGV.Rows.Clear();
            StaffEmployeeLogic employees = new StaffEmployeeLogic(manager);

            DataGV.AutoGenerateColumns = false;
            int enterpriseId;
            int?StructureObjectId = null;

            if (StructureObjectsCB.SelectedIndex > 0)
            {
                StructureObjectId = Convert.ToInt32(StructureObjectsCB.SelectedValue);
            }

            BindingSource bs = new BindingSource();
            StaffEmployeePositionsLogic employeePositions = new StaffEmployeePositionsLogic(manager);

            //bs.DataSource = employees.GetAll(enterpriseId);
            if (StructureObjectId != null)
            {
                bs.DataSource = employeePositions.GetAll(StructureObjectId);
            }
            else
            {
                bs.DataSource = employees.GetAll();
            }

            DataGV.DataSource = bs;

            DataGV.Update();
            DataGV.Refresh();
        }
示例#3
0
        /// <summary>
        /// Заповнення таблиці працівників для відображення
        /// </summary>
        private void FillGrid()
        {
            manager = new ContextManager();
            DataGV.Rows.Clear();
            StaffEmployeeLogic employees = new StaffEmployeeLogic(manager);

            DataGV.AutoGenerateColumns = false;
            int enterpriseId;
            int? StructureObjectId = null;

            if(StructureObjectsCB.SelectedIndex > 0)
                StructureObjectId = Convert.ToInt32(StructureObjectsCB.SelectedValue);

            BindingSource bs = new BindingSource();
            StaffEmployeePositionsLogic employeePositions = new StaffEmployeePositionsLogic(manager);
            //bs.DataSource = employees.GetAll(enterpriseId);
            if (StructureObjectId != null)
                bs.DataSource = employeePositions.GetAll(StructureObjectId);
            else
                bs.DataSource = employees.GetAll();

            DataGV.DataSource = bs;

            DataGV.Update();
            DataGV.Refresh();
        }
示例#4
0
        private void FillAvailableEmployees()
        {
            AvailableEmployeesLB.Items.Clear();
            StaffEmployeeLogic employeesLogic = new StaffEmployeeLogic(manager);
            StaffEmployeePositionsLogic employeePositionsLogic = new StaffEmployeePositionsLogic(manager);

            //List<StaffEmployee> employees = employeesLogic.GetAll().Select(a => new { a.ID, a.LastName + " " + a.FirstName + " " + a.MiddleName});
            AvailableEmployeesLB.ValueMember = "ID";
            AvailableEmployeesLB.DisplayMember = "Name";

            int structureObjectId = Convert.ToInt32(StructureObjectsCB.SelectedValue);

            //BindingList<Helpers.ItemIntValue> structureObjects = structureObjectsLogic.GetStructureObjectsHierarchy(false, structureObjectId);

            List<StaffEmployee> filteredEmloyees = employeePositionsLogic.GetByPositionID(Convert.ToInt32(PositionsCB.SelectedValue)).Select(a => a.StaffEmployee).ToList();
            var employees = employeesLogic.GetAll().Where(a => filteredEmloyees.Contains(a)).Select(a => new { a.ID, Name = a.LastName + " " + a.FirstName + " " + a.MiddleName });
            foreach(var employee in employees)
            {
                ItemIntValue item = new ItemIntValue();
                item.ID = employee.ID;
                item.Name = employee.Name;
                AvailableEmployeesLB.Items.Add(item);
            }
        }