Ejemplo n.º 1
0
 private void Open()
 {
     try
     {
         int id = SelectedId;
         if (id != 0)
         {
             Role role = null;
             using (GmConnection conn = App.CreateConnection())
             {
                 role = Role.GetRole(conn, id);
             }
             if (role != null)
             {
                 RoleForm form = new RoleForm(role);
                 if (form.ShowDialog() == DialogResult.OK)
                 {
                     DataRow dr = SelectedRow;
                     if (dr != null)
                     {
                         dr["Name"] = role.name;
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         Log.Exception(ex);
     }
 }
Ejemplo n.º 2
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     try
     {
         Role     role = new Role();
         RoleForm form = new RoleForm(role);
         if (form.ShowDialog() == DialogResult.OK)
         {
             DataRow newRow = dataTable.NewRow();
             dataTable.Rows.Add(newRow);
             newRow["Id"]   = role.Id;
             newRow["Name"] = role.name;
         }
     }
     catch (Exception ex)
     {
         Log.Exception(ex);
     }
 }