public static DialogResult CreateInsertDialog()
        {
            var form = new CategoryDetailsForm();
            form.isForUpdate = false;

            return form.ShowDialog();
        }
        public static DialogResult CreateUpdateDialog(DataRow selectedRow)
        {
            var form = new CategoryDetailsForm();
            form.isForUpdate = true;
            form.TransferDataRowDetailToForm(selectedRow);

            return form.ShowDialog();
        }
Esempio n. 3
0
        public static DialogResult CreateInsertDialog()
        {
            var form = new CategoryDetailsForm();

            form.isForUpdate = false;

            return(form.ShowDialog());
        }
Esempio n. 4
0
        public static DialogResult CreateUpdateDialog(DataRow selectedRow)
        {
            var form = new CategoryDetailsForm();

            form.isForUpdate = true;
            form.TransferDataRowDetailToForm(selectedRow);

            return(form.ShowDialog());
        }
        private void insertButton_Click(object sender, EventArgs e)
        {
            var  result   = CategoryDetailsForm.CreateInsertDialog();
            bool inserted = result == DialogResult.OK;

            if (inserted)
            {
                LoadDataToGrid();
            }
        }
        private void ShowUpdateForm()
        {
            Debug.Assert(gridView.FocusedRowHandle != -1);

            DataRow selected = gridView.GetFocusedDataRow();

            var  result   = CategoryDetailsForm.CreateUpdateDialog(selected);
            bool inserted = result == DialogResult.OK;

            if (inserted)
            {
                LoadDataToGrid();
            }
        }