public Dialog_Family() { InitializeComponent(); this.Size = new Size(500, 400); ListViewBasic.Columns.Add("RefFamily"); ListViewBasic.Columns.Add("Name"); ControllerManagement.RefreshListViewFamily(); }
protected override void ListViewBasic_KeyDown(object sender, KeyEventArgs e) { if (e.KeyData == Keys.F5) { ControllerManagement.RefreshListViewFamily(); MessageBox.Show("List view refreshed !"); } base.ListViewBasic_KeyDown(sender, e); }
protected override void Delete() { if (ListViewBasic.SelectedItems.Count != 0) { // Get RefFamily from the ListView int RefFamily = int.Parse(ListViewBasic.SelectedItems[0].Text); if (ControllerManagement.DeleteFamily(RefFamily)) { ControllerManagement.RefreshListViewFamily(); MessageBox.Show("Succesfully deleted the Family !"); } else { MessageBox.Show("Error : Fail to delete the Family ! "); } } else { MessageBox.Show("Error : Choose a Family before trying to delete it !"); } }
private void BtnOK_Click(object sender, EventArgs e) { try { if (Dialog_Basic.ModifyOrAdd == 0) { if (!ControllerManagement.ModifyFamily(int.Parse(TextRefFamily.Text), TextBox.Text)) { MessageBox.Show("Fail to modify the family ! "); } else { if (MessageBox.Show("Successfully modified the family !") == DialogResult.OK) { Close(); } } } else if (Dialog_Basic.ModifyOrAdd == 1) { ControllerManagement.AddFamily(TextBox.Text); if (MessageBox.Show("Successfully added the family !") == DialogResult.OK) { Close(); } } ControllerManagement.RefreshListViewFamily(); ControllerFurniture.RefreshListView(-1); } catch (Exception Exception) { MessageBox.Show("Error during the operation ! " + Exception.Message); } }
protected override void ListViewBasic_ColumnClick(object sender, ColumnClickEventArgs e) { base.ListViewBasic_ColumnClick(sender, e); ControllerManagement.RefreshListViewFamily(); }