コード例 #1
0
        private void Btn_EditAward_Click(object sender, RoutedEventArgs e)
        {
            int            selectedIndex;
            VetAwardDBInfo selectedItem = null;

            // Get the index from the UI
            selectedIndex = ListBox_AwardDetails.SelectedIndex;

            if (selectedIndex >= 0 && selectedIndex < Veteran.AwardDetails.Count)
            {
                selectedItem = Veteran.AwardDetails[selectedIndex];

                AwardDetails awardWin = new AwardDetails(selectedItem);

                awardWin.ShowDialog();

                Veteran.AwardDetails[selectedIndex] = awardWin.AwardInfo;

                ListBox_AwardDetails.Items.Refresh();
            }
            else
            {
                MessageBox.Show(Tools.RecordSelectMessage, Tools.RecordSelectTitle);
            }
        }
コード例 #2
0
        private void Btn_AddAward_Click(object sender, RoutedEventArgs e)
        {
            AwardDetails awardWin = new AwardDetails();

            // If we know the veteran ID, set it
            if (Veteran.Id != 0)
            {
                awardWin.SetId(Veteran.Id);
            }

            awardWin.ShowDialog();

            if (awardWin.IsOk)
            {
                Veteran.AwardDetails.Add(awardWin.AwardInfo);
            }

            ListBox_AwardDetails.Items.Refresh();
        }