/// <summary>
 /// Pega os dados que estão na tela e popula o model
 /// </summary>
 /// <returns>Model populado</returns>
 private mSubMenu PegaDadosTela()
 {
     mSubMenu model = new mSubMenu();
     model.IdSubMenu = Convert.ToInt32(txtIdSubMenu.Text);
     model.DscSubMenu = txtDescricaoSubMenu.Text;
     model.EndSubMenu = txtEnderecoSubMenu.Text;
     return model;
 }
 public void CadastraSubMenu(mSubMenu model)
 {
     dSubMenu dalSubMenu = new dSubMenu();
     try
     {
         dalSubMenu.CadastraSubMenu(model);
     }
     catch (Exception ex)
     {
         throw ex;
     }
     finally
     {
         dalSubMenu = null;
     }
 }
 private void btnConfirma_Click(object sender, EventArgs e)
 {
     mSubMenu modelMenu = new mSubMenu();
     BUSINESS.rSubMenu regraMenu = new BUSINESS.rSubMenu();
     try
     {
         modelMenu = this.PegaDadosTela();
         regraMenu.CadastraSubMenu(modelMenu);
         MessageBox.Show("Cadastrado com sucesso!!");
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
     finally
     {
         modelMenu = null;
     }
 }