public FormSalariesEdit(SalaryRepository salariesRepo, EmployerRepository employeesRepo, int v) { InitializeComponent(); this.salRepo = salariesRepo; this.empRepo = employeesRepo; this.SelectedSalIndex = v; ss = new SoloSalary(); ss = salRepo.SelectById(SelectedSalIndex); labelID.Text = String.Format("ID of salary record: {0}", SelectedSalIndex); comboBoxEmp.DataSource = empRepo.getComboBoxSource(); comboBoxEmp.DisplayMember = "Name3"; //changing to full name by event comboBoxEmp.ValueMember = "ID"; comboBoxEmp.SelectedValue = empRepo.SelectById(ss.IDemp).ID; //select ID where sal.IDemp = emp.IDemp numericUpDownAm.Value = (decimal)ss.Amount; monthCalendarFrom.SetDate(ss.validFrom); monthCalendarUntil.SetDate(ss.validUntil); }
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 }