private void AddBtn_Click(object sender, System.EventArgs e) { BaseForm r = (BaseForm)MyContainer.Create <IAddForm>(); r.done = Done; r.ShowDialog(); }
public ReadForm() { InitializeComponent(); role = MyContainer.Create <Role>(); if (table != null) { this.dataGridView.DataSource = table.dataTable; this.table.RegisterObserver(this.dataGridView); } }
public BaseForm() { InitializeComponent(); SetUpUi(); try { this.table = MyContainer.Create <Table>(); } catch (Exception) { } }
private void ReadBtn_Click(object sender, EventArgs e) { Table t = this.database.GetTableByName(this.tableList.SelectedItem.ToString()); MyContainer.RegisterInstance <Table>(t); BaseForm r = (BaseForm)MyContainer.Create <IReadForm>(); this.Hide(); r.FormClosed += (s, args) => this.Show(); r.Show(); }
private void DataGridView_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex >= table.Rows.Count) { return; } MyContainer.RegisterInstance <int>(e.RowIndex); BaseForm r = (BaseForm)MyContainer.Create <IUpdateForm>(); r.done = this.Done; r.ShowDialog(); }
private void UpdateBtn_Click(object sender, System.EventArgs e) { if (currentRow < 0) { return; } MyContainer.RegisterInstance <int>(currentRow); BaseForm r = (BaseForm)MyContainer.Create <IUpdateForm>(); r.done = this.Done; r.ShowDialog(); }
public ReadForm(Table table) : base(table) { InitializeComponent(); role = MyContainer.Create <Role>(); dataGridView.DataSource = table.dataTable; this.table.RegisterObserver(this.dataGridView); addBtn.Enabled = role.isAllowedAdd; dataGridView.Size = new Size(this.Width - 70, this.Height - 200); addBtn.Location = new Point(40, dataGridView.Location.Y + dataGridView.Size.Height + 20); updateBtn.Location = new Point(addBtn.Location.X + addBtn.Size.Width + 10, dataGridView.Location.Y + dataGridView.Size.Height + 20); deleteBtn.Location = new Point(updateBtn.Location.X + updateBtn.Size.Width + 10, dataGridView.Location.Y + dataGridView.Size.Height + 20); if (table.Rows.Count > 0) { SetFocusRow(0); } }
public MainForm() { InitializeComponent(); this.database = MyContainer.Create <Database>(); this.database.Connection.Connect(); this.database.LoadData(); List <string> list = this.database.GetTableNames(); this.tableList.Items.Clear(); for (int i = 0; i < list.Count; i++) { this.tableList.Items.Add(list[i]); } tableList.SelectedIndex = 0; Role role = MyContainer.Create <Role>(); button2.Enabled = role.isAllowedRead; }