예제 #1
0
        public EmployeeV(decimal id = -1M)
        {
            InitializeComponent();
            if (id == -1M)
            {
                EmployeePObj = new Presenter.EmployeeP(this);
                btnSaveNChangeEmployee.Text = "Добавить";
            }
            else
            {
                EmployeePObj = new Presenter.EmployeeP(this, id);
            }
            tbFname.DataBindings.Add("Text", EmployeePObj.SelectedEmployee, "FirstName", false);
            tbLname.DataBindings.Add("Text", EmployeePObj.SelectedEmployee, "SurName", false);
            tbPatronymic.DataBindings.Add("Text", EmployeePObj.SelectedEmployee, "Patronymic", false);
            dtpYearOld.DataBindings.Add("Value", EmployeePObj.SelectedEmployee, "DateOfBirth", false);
            DateTime zeroTime = new DateTime(1, 1, 1);

            tbYears.Text = ((zeroTime + (DateTime.Today - EmployeePObj.SelectedEmployee.DateOfBirth)).Year - 1).ToString();
            tbDocSeries.DataBindings.Add("Text", EmployeePObj.SelectedEmployee, "DocSeries", false);
            tbDocNumber.DataBindings.Add("Text", EmployeePObj.SelectedEmployee, "DocNumber", false);
            tbPosition.DataBindings.Add("Text", EmployeePObj.SelectedEmployee, "Position", false);
            cbDepartment.DataBindings.Add("SelectedValue", EmployeePObj.SelectedEmployee, "DepartmentID", false);
            cbDepartment.DataSource    = new BindingSource(EmployeePObj.ListDepartments, null);
            cbDepartment.DisplayMember = "Value";
            cbDepartment.ValueMember   = "Key";
        }
예제 #2
0
 public EmployeeM(Presenter.EmployeeP employeeP)
 {
     EmployeeP = employeeP;
     GetDepartments();
 }
예제 #3
0
 public EmployeeM(Presenter.EmployeeP employeeP, decimal idEmployee)
 {
     EmployeeP = employeeP;
     employeeP.SelectedEmployee = GetSelectedEEmployee(idEmployee);
 }