Beispiel #1
0
        public IActionResult Create(AddEmployeeForm addEmployeeForm)
        {
            var employee = Mediator.Send <AddEmployee, EmployeeDto>(new AddEmployee()
            {
                AddEmployeeForm = addEmployeeForm
            });

            return(Ok(employee));
        }
        private void addemployee_Click(object sender, EventArgs e)
        {
            AddEmployeeForm form = new AddEmployeeForm();
            DialogResult    dr   = form.ShowDialog();

            if (dr == DialogResult.OK)
            {
                refresh();
            }
        }
        public async void EditEmployeeShowDialog(EmployeeCS employee)
        {
            try
            {
                if (AddEmployeeForm == null)
                {
                    AddEmployeeForm = new AddEmployeeForm();
                }
                this.AddEmployeeForm.DepartmentList   = this.GetDepartmentList();
                this.AddEmployeeForm.RepresentedValue = employee;
                this.AddEmployeeForm.Text             = "Редактирование сотрудника";
                if (AddEmployeeForm.ShowDialog() == DialogResult.OK)
                {
                    var t = (EmployeeCS)this.AddEmployeeForm.RepresentedValue;
                    t.ID = employee.ID;
                    await _serviceManager.EditEmployee(t);

                    // обновление интерфейса если нужно
                    var selectedDep = (DepartmentCS)MainForm.DepartmentStructureTreeView.SelectedNode.Tag;
                    if (t.DepartmentID == selectedDep.ID)
                    {
                        UpdateVisibleEmployees(selectedDep);
                    }
                }
            }
            catch (FaultException <DefaultFault> ex) // контролируемая ситуация на сервисе
            {
                // сообщение об ошибке для пользователя
                MessageBox.Show(ex.Detail.Message, ex.Action, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (FaultException) // непредвиденная проблема на сервисе, см лог на сервисе
            {
                // неизвестная ошибка на сервисе
                MessageBox.Show("Неизвестная ошибка сервиса. Операция не выполнена.", null, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (Exception ex) // что-то совсем пошло не так (включая CommunicationException и TimeOutException)
            {
                MessageBox.Show("Возникла ошибка: " + ex.Message, null, MessageBoxButtons.OK, MessageBoxIcon.Error);
                _logger.Error(ex, "Ошибка в редактировании сотрудника");
            }
        }
 public Task <ResultContainer <int> > AddEmployee([FromBody] AddEmployeeForm model)
 {
     return(api.Group("Employee").Action <AddEmployeeForm, int>("AddEmployee").Execute(model));
 }
Beispiel #5
0
        private void AddEmployeeBtn_Click(object sender, EventArgs e)
        {
            var addEmployeeFrm = new AddEmployeeForm(this);

            addEmployeeFrm.ShowDialog();
        }
Beispiel #6
0
        private void addEmployeeToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (UserSecurityController.NurseLoggedIn != null)
            {
                MessageBox.Show("You are not authorized to access this. ", "Access denied");
            }
            else
            {

                if (aef == null)
                {
                    aef = new AddEmployeeForm();
                    aef.MdiParent = this;
                    aef.FormClosed += new FormClosedEventHandler(aef_FormClosed);
                    aef.Show();

                }
                else
                {
                    aef.Activate();
                }
            }
        }
 public Task <int> AddEmployee(AddEmployeeForm model) => Post <int, AddEmployeeForm>("AddEmployee", "", model);
Beispiel #8
0
 /// <summary>
 /// Helper form so that above form only has one instance at a time.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void aef_FormClosed(object sender, FormClosedEventArgs e)
 {
     aef = null;
     //throw new NotImplementedException();
 }
Beispiel #9
0
    public Task <IDictionary <string, object?> > Execute(EmptyRequest model)
    {
        var form = new AddEmployeeForm();

        return(Task.FromResult(form.Export()));
    }
        private void addEmployeeButton_Click(object sender, EventArgs e)
        {
            var AddEmployeeForm = new AddEmployeeForm(service);

            AddEmployeeForm.Show();
        }
Beispiel #11
0
        public void ShowAddEmployee()
        {
            IAddEmployeeView inForm = new AddEmployeeForm(this);

            _employeeController.ShowAddEmployee(inForm);
        }
 public EmployeeManager()
 {
     employeeForm  = new AddEmployeeForm();
     context       = new OrderDbContext();
     bindingSource = new BindingSource();
 }