public FormEmployeesEdit(DepartmentRepository repositoryOfDepartments) //adding
        {
            InitializeComponent();
            empRepo      = new EmployerRepository();
            se           = new SoloEmployer();
            this.dpmRepo = repositoryOfDepartments;

            comboBoxDep.DataSource    = dpmRepo.getComboBoxSource();
            comboBoxDep.DisplayMember = "Name";
            comboBoxDep.ValueMember   = "IDdpm";
        }
        public FormEmployeesEdit(EmployerRepository employerRepository, DepartmentRepository repositoryOfDepartments, int index) //editing
        {
            se = new SoloEmployer();
            employerRepository = new EmployerRepository();

            InitializeComponent();
            this.SelectedEmpIndex = index;
            this.empRepo          = employerRepository;
            this.dpmRepo          = repositoryOfDepartments;

            se                        = employerRepository.SelectById(SelectedEmpIndex);
            labelID.Text              = String.Format("ID of emloyer: {0}", SelectedEmpIndex);
            textBoxName1.Text         = se.Name1;
            textBoxName2.Text         = se.Name2;
            textBoxName3.Text         = se.Name3;
            textBoxEmail.Text         = se.Email;
            comboBoxDep.DataSource    = dpmRepo.getComboBoxSource();
            comboBoxDep.DisplayMember = "Name";
            comboBoxDep.ValueMember   = "IDdpm";
            //comboBoxDep.SelectedItem
        }
        public void RefreshGui()
        {
            salRepo = new SalaryRepository(); //contains data
            salRepo.GetAll();


            if (empRepo != null && salRepo != null)
            {
                List <SoloSalary> salaries = salRepo.GetAll().ToList();
                var employees = empRepo.GetAll();

                int selectedRowComfortGui; //for user comfort
                try
                {
                    selectedRowComfortGui = salDataGridView.CurrentCell.RowIndex;
                }
                catch
                {
                    selectedRowComfortGui = 0;
                }

                salDataGridView.ClearSelection(); //cleaning previos search
                salDataGridView.Columns.Clear();  //cleaning previous content
                salDataGridView.Rows.Clear();     //cleaning previous content

                //columns headers
                DataGridViewColumn d1 = new DataGridViewTextBoxColumn();
                d1.HeaderText = "ID";
                d1.Visible    = false;
                d1.SortMode   = DataGridViewColumnSortMode.Automatic;
                DataGridViewColumn d2 = new DataGridViewTextBoxColumn();
                d2.HeaderText = "Employee";
                d2.SortMode   = DataGridViewColumnSortMode.Automatic;
                DataGridViewColumn d3 = new DataGridViewTextBoxColumn();
                d3.HeaderText = "Amount €";
                d3.SortMode   = DataGridViewColumnSortMode.Automatic;
                DataGridViewColumn d4 = new DataGridViewTextBoxColumn();
                d4.HeaderText = "Earn from";
                d4.SortMode   = DataGridViewColumnSortMode.Automatic;
                DataGridViewColumn d5 = new DataGridViewTextBoxColumn();
                d5.HeaderText = "Earn to";
                d5.SortMode   = DataGridViewColumnSortMode.Automatic;
                salDataGridView.Columns.AddRange(d1, d2, d3, d4, d5);

                foreach (SoloSalary sal in salaries)
                {
                    var row = new DataGridViewRow();
                    row.Cells.Add(new DataGridViewTextBoxCell {
                        Value = sal.IDsal
                    });
                    SoloEmployer se = empRepo.GetByID(sal.IDemp);
                    row.Cells.Add(new DataGridViewTextBoxCell {
                        Value = se.Name1 + " " + se.Name2 + " " + se.Name3
                    });
                    row.Cells.Add(new DataGridViewTextBoxCell {
                        Value = sal.Amount
                    });
                    row.Cells.Add(new DataGridViewTextBoxCell {
                        Value = sal.validFrom.ToString(dateTimeFormat)
                    });
                    row.Cells.Add(new DataGridViewTextBoxCell {
                        Value = sal.validUntil.ToString(dateTimeFormat)
                    });
                    salDataGridView.Rows.Add(row); //finalize row
                }

                salDataGridView.Rows[selectedRowComfortGui].Selected = true;
            }
        }