Exemplo n.º 1
0
        private void EditToolStripDepMenuItem_Click(object sender, EventArgs e)
        {
            var node = treeViewDeps.SelectedNode;

            if (node == null)
            {
                return;
            }
            Data.department      = (Department)treeViewDeps.SelectedNode.Tag;
            Data.departmentsList = departmentController.GetDepartmentsWC(Data.department.ID);
            DepartmentForm depForm = new DepartmentForm();

            if (depForm.ShowDialog() == DialogResult.OK)
            {
                if (Data.department.ID == Guid.Empty)
                {
                    departmentController.Create(Data.department);
                }
                else if (Data.department.Name != null)
                {
                    departmentController.Update(Data.department);
                }
                else
                {
                    DeleteDepartment(Data.department.ID);
                }
            }
            Data.department = null;
            FillMainDepNodes();
        }
Exemplo n.º 2
0
        private void buttonAddDep_Click(object sender, EventArgs e)
        {
            Data.department      = null;
            Data.departmentsList = departmentController.GetDepartments();
            DepartmentForm depForm = new DepartmentForm();

            if (depForm.ShowDialog() == DialogResult.OK)
            {
                departmentController.Create(Data.department);
            }
            Data.department = null;
            FillMainDepNodes();
        }