Exemple #1
0
        private void btnAddNew_Click(object sender, EventArgs e)
        {
            AddEditMain frm = new AddEditMain(db, DBProvider.TableNames[0], null, EditMode.Add);

            frm.ShowDialog();

            btnRefresh.PerformClick();
        }
Exemple #2
0
        private void UpdateItem()
        {
            var sel = DataGrid.SelectedCells;
            if (sel.Count == 0)
            {
                MessageBox.Show(this, "Select item to edit first!", "Edit item", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            var code = DataGrid["Code", sel[0].RowIndex].Value.ToString();

            if (tabControl1.SelectedIndex == (int)TABS.MAIN)
            {
                AddEditMain frm = new AddEditMain(db, DBProvider.TableNames[0], code, EditMode.Update);
                frm.Text = "Edit item";
                if (frm.ShowDialog() == DialogResult.OK)
                    btnToolRefresh.PerformClick();
            }
            else if (tabControl1.SelectedIndex == (int)TABS.SOLD)
            {
                EditSold frm = new EditSold(db, DBProvider.TableNames[(int)TABS.SOLD], code, false);
                if (frm.ShowDialog() == DialogResult.OK)
                    btnToolRefresh.PerformClick();
            }
            else if (tabControl1.SelectedIndex == (int)TABS.EXHIBITIONS)
            {
                EditSold frm = new EditSold(db, DBProvider.TableNames[(int)TABS.EXHIBITIONS], code, true);
                if (frm.ShowDialog() == DialogResult.OK)
                    btnToolRefresh.PerformClick();
            }
        }