public void SaveOrUpdate(Area instance) { ISession hisession = null; try { hisession = NHibernateHelper.GetCurrentSession(); hisession.BeginTransaction(); if (instance.Id == 0) { hisession.Save(instance); } else { hisession.Update(instance); } hisession.Transaction.Commit(); hisession.Close(); } catch (Exception ex) { if (hisession != null) { if (hisession.IsOpen) { hisession.Close(); } } } }
private void frmBuscarEmpleado_Load(object sender, EventArgs e) { IList<Area> areas = new AreaBL().GetAll(); Area todos = new Area(); todos.Descripcion = "Todos"; areas.Insert(0, todos); cboArea.DataSource = areas; btnSeleccionar.Visible = !(this.Owner is frmVentanaHome); }
public void Grabar(Area instance) { new AreaDA().SaveOrUpdate(instance); }