Esempio n. 1
0
        private bool ValidateEmployee(EditEmployeeForm form)
        {
            if (string.IsNullOrWhiteSpace(form.FirstName))
            {
                form.ShowError("Введите имя!");
                return false;
            }

            if (string.IsNullOrWhiteSpace(form.LastName))
            {
                form.ShowError("Введите фамилию!");
                return false;
            }

            if (string.IsNullOrWhiteSpace(form.Place))
            {
                form.ShowError("Введите должность!");
                return false;
            }

            DateTime dateTime;
            if (!DateTime.TryParse(form.Birthday, out dateTime))
            {
                form.ShowError("Некорректно задана дата рождения");
                return false;
            }
            return true;
        }
Esempio n. 2
0
 private void addEmployeeButton_Click(object sender, EventArgs e)
 {
     var employeeEditForm = new EditEmployeeForm();
     employeeEditForm.Confirmed += (s, a) => CreateEmployeeConfirmed(s, a);
     employeeEditForm.ShowDialog();
 }
Esempio n. 3
0
 private void changeEmployeeButton_Click(object sender, EventArgs e)
 {
     var currentDepartment = (IDepartment)departmentView.SelectedNode.Tag;
     var currentEmployee = (EmployeeWrapperItem)employeeSource.Current;
     if (currentEmployee != null)
     {
         var employeeEditForm = new EditEmployeeForm();
         employeeEditForm.FirstName = currentEmployee.Item.FirstName;
         employeeEditForm.LastName = currentEmployee.Item.LastName;
         employeeEditForm.Patronym = currentEmployee.Item.Patronym;
         employeeEditForm.Birthday = currentEmployee.Item.BirthDate.ToString();
         employeeEditForm.Place = currentEmployee.Item.Place;
         employeeEditForm.Confirmed += (s, a) => UpdateEmployeeConfirmed(s, a);
         employeeEditForm.ShowDialog();
     }
 }