コード例 #1
0
 private void Add_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         DatabaseMethods _data    = new DatabaseMethods();
         var             risk     = txtRisk.Text;
         var             actionId = ddlAction.SelectedValue;
         int             i        = _data.AddRisk(risk, Convert.ToInt32(actionId));
         if (i > 0)
         {
             MessageBox.Show("Successfully Added");
             ViewRisks viewRisks = new ViewRisks();
             viewRisks.Show();
             this.Close();
         }
         else
         {
             MessageBox.Show("Error Occured while saving Risk. Please try again");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Error Occured while saving Risk. Please try again");
     }
 }