コード例 #1
0
 private void Open()
 {
     try
     {
         using (WaitCursor wc = new WaitCursor())
         {
             int id = SelectedId;
             if (id != 0)
             {
                 Diagnosis diagnosis = null;
                 using (GmConnection conn = App.CreateConnection())
                 {
                     diagnosis = Diagnosis.GetDiagnosis(conn, id);
                 }
                 if (diagnosis != null)
                 {
                     DiagnosisForm form = new DiagnosisForm(diagnosis);
                     if (form.ShowDialog() == DialogResult.OK)
                     {
                         DataRow dr = SelectedRow;
                         if (dr != null)
                         {
                             dr["Name"] = diagnosis.name;
                         }
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         Log.Exception(ex);
     }
 }
コード例 #2
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     try
     {
         using (WaitCursor wc = new WaitCursor())
         {
             Diagnosis     diagnosis = new Diagnosis();
             DiagnosisForm form      = new DiagnosisForm(diagnosis);
             if (form.ShowDialog() == DialogResult.OK)
             {
                 DataRow newRow = dataTable.NewRow();
                 dataTable.Rows.Add(newRow);
                 newRow["Id"]   = diagnosis.Id;
                 newRow["Name"] = diagnosis.name;
             }
         }
     }
     catch (Exception ex)
     {
         Log.Exception(ex);
     }
 }