コード例 #1
0
        /// <summary>
        /// Вызор окна создания подразделения.
        /// </summary>
        public void CreateDepartment()
        {
            DepartmentWindow departmentWindow;
            DataRow          department = Model.departmentsDt​.NewRow​();

            departmentWindow       = new DepartmentWindow(department);
            departmentWindow.Owner = (Window)this.view;
            departmentWindow.ShowDialog();
            if (departmentWindow.DialogResult.HasValue && departmentWindow.DialogResult.Value)
            {
                Model.DepartmentAdd(department);
            }
        }
コード例 #2
0
        /// <summary>
        /// Вызор окна создания/редактирования подразделения.
        /// </summary>
        /// <param name="DepartmentId">Идентификатор выбранного подразделения.</param>
        public void ViewDepartment(int DepartmentId)
        {
            DepartmentWindow departmentWindow;

            if (DepartmentId > -1)
            {
                departmentWindow = new DepartmentWindow(Model.DepartmentsList[DepartmentId]);
            }
            else
            {
                departmentWindow = new DepartmentWindow(null);
            }
            departmentWindow.Owner = (Window)this.view;
            departmentWindow.ShowDialog();
        }
コード例 #3
0
        /// <summary>
        /// Вызов окна редактирования подразделения.
        /// </summary>
        /// <param name="department">Редактируемое подразделение.</param>
        public void EditDepartment(DataRowView department)
        {
            DepartmentWindow departmentWindow;

            department.BeginEdit();
            departmentWindow       = new DepartmentWindow(department.Row);
            departmentWindow.Owner = (Window)this.view;
            departmentWindow.ShowDialog();
            if (departmentWindow.DialogResult.HasValue && departmentWindow.DialogResult.Value)
            {
                department.EndEdit();
            }
            else
            {
                department.CancelEdit();
            }
            Model.DepartmentUpdate();
        }