private void btnUpdateTab_Click(object sender, RoutedEventArgs e) { if (grdClub.SelectedItem != null) { TabItem ti = tabDetails.SelectedItem as TabItem; switch (ti.Name) { case "EQUIPMENT": if (grdEquipment.SelectedItem != null) { /* Create the Equipment edit window in update mode passing the equipment selected & parent window */ EditEquipment editEquipment = new EditEquipment(((Equipment)grdEquipment.SelectedItem).ID.Value, this); editEquipment.Show(); } break; case "MEMBER": if (grdMember.SelectedItem != null) { /* Create the Member edit window in update mode passing the member selected & parent window */ EditMember editMember = new EditMember(((Member)grdMember.SelectedItem).ID.Value, this); editMember.Show(); } break; } } }
private void btnAddTab_Click(object sender, RoutedEventArgs e) { // Ensure that a club has been selected if (grdClub.SelectedItem != null) { TabItem ti = tabDetails.SelectedItem as TabItem; switch (ti.Name) { case "EQUIPMENT": /* Create the Equipment edit window in add mode passing the parent window & club selected */ EditEquipment editEquipment = new EditEquipment(this, ((ClubManager)grdClub.SelectedItem).ID.Value); editEquipment.Show(); break; case "MEMBER": /* Create the Member edit window in add mode passing the parent window & club selected */ EditMember editMember = new EditMember(this, ((ClubManager)grdClub.SelectedItem).ID.Value); editMember.Show(); break; } } }