コード例 #1
0
 private void CreatePlan_Click(object sender, EventArgs e)
 {
     if (listBox1.Items.Count == 0)        //if there are no benefits, don't allow plan creation
     {
         MessageBox.Show("Please create a Benefit first", "Error");
     }
     else     //create plans
     {
         if (listBox1.SelectedIndex != -1)
         {
             FormCreatePlan popUpForm = new FormCreatePlan(listBox1.SelectedIndex);
             popUpForm.ShowDialog();
         }
         else
         {
             FormCreatePlan popUpForm = new FormCreatePlan();
             popUpForm.ShowDialog();
         }
         UpdatePlans();
     }
 }
コード例 #2
0
 private void CreateBenefit_Click(object sender, EventArgs e)   //Creates NEW Benefit
 {
     if (comboBox1.SelectedIndex == 0)
     {
         FormCreateBenefit popUpForm = new FormCreateBenefit();
         popUpForm.ShowDialog();
         UpdateBenefits();
     }
     else if (comboBox1.SelectedIndex == 1)
     {
         if (listBox1.SelectedIndex != -1)
         {
             FormCreatePlan popUpForm = new FormCreatePlan(listBox1.SelectedIndex);
             popUpForm.ShowDialog();
         }
         else
         {
             FormCreatePlan popUpForm = new FormCreatePlan();
             popUpForm.ShowDialog();
         }
         UpdateBenefits();
     }
 }