Beispiel #1
0
        /// <summary>Добавление записи</summary>
        ///  <param name="sender"></param>
        /// <param name="e"></param>
        private void InsertClick(object sender, EventArgs e)
        {
            var groupEditorForm = new GroupEditor();

            groupEditorForm.ShowDialog();
            if (groupEditorForm.DialogResult != DialogResult.OK)
            {
                return;
            }
            _database.Insert(groupEditorForm.Group);
            gridView1.FocusedRowHandle = gridView1.RowCount - 1;
            SelectClick(sender, EventArgs.Empty);
        }
Beispiel #2
0
        /// <summary>Изменение записи</summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void UpdateClick(object sender, EventArgs e)
        {
            var f = gridView1.GetFocusedRow() as Group;

            _focusIndex = gridView1.GetFocusedDataSourceRowIndex();
            if (f == null)
            {
                return;
            }
            var groupEditorForm = new GroupEditor {
                Group = f
            };

            groupEditorForm.ShowDialog();
            if (groupEditorForm.DialogResult != DialogResult.OK)
            {
                return;
            }
            _database.Update(groupEditorForm.Group);
            gridView1.FocusedRowHandle = _focusIndex;
        }