Esempio n. 1
0
 private void Open()
 {
     try
     {
         if (readOnly)
         {
             return;
         }
         DataRow dr = SelectedRow;
         if (dr != null)
         {
             int             id = (int)dr["Id"];
             MedicamentGroup medicamentGroup = null;
             using (GmConnection conn = App.CreateConnection())
             {
                 medicamentGroup = MedicamentGroup.GetMedicamentGroup(conn, id);
             }
             if (medicamentGroup != null)
             {
                 MedicamentGroupForm form = new MedicamentGroupForm(medicamentGroup);
                 if (form.ShowDialog() == DialogResult.OK)
                 {
                     dr["Name"] = medicamentGroup.name;
                 }
             }
         }
     }
     catch (Exception ex)
     {
         Log.Exception(ex);
     }
 }
Esempio n. 2
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     try
     {
         MedicamentGroup     medicamentGroup = new MedicamentGroup();
         MedicamentGroupForm form            = new MedicamentGroupForm(medicamentGroup);
         if (form.ShowDialog() == DialogResult.OK)
         {
             DataRow newRow = dataTable.NewRow();
             newRow["Id"]     = medicamentGroup.Id;
             newRow["Name"]   = medicamentGroup.name;
             newRow["Status"] = medicamentGroup.status;
             dataTable.Rows.Add(newRow);
         }
     }
     catch (Exception ex)
     {
         Log.Exception(ex);
     }
 }