protected virtual bool Atualizar(object objeto) { try { Sessao.Update(objeto); return(true); } catch (HibernateException h) { Type aux = typeof(MySqlException); if (h.InnerException.GetType().Equals(aux)) { GepexException.EBancoDados gex = new GepexException.EBancoDados(); gex.Numero = ((MySqlException)h.InnerException).Number; throw gex; } else { throw h; } } catch (Exception e) { throw e; } }
public virtual bool Confirmar() { try { AntesConfirmar(); Validar(); this.BeginTran(); if (Codigo > 0) { Atualizar(this); } else { Inserir(this); } this.Commit(); AposConfirmar(); Sessao.Clear(); return(true); } catch (HibernateException h) { if (this.transacao.WasRolledBack) { this.Rollback(); } Type aux = typeof(MySqlException); if (h.InnerException != null && h.InnerException.GetType().Equals(aux)) { GepexException.EBancoDados gex = new GepexException.EBancoDados(); gex.Numero = ((MySqlException)h.InnerException).Number; throw gex; } else { throw h; } } catch (Model.Base.GepexException.ERegraNegocio ex) { throw ex; } catch (Exception e) { this.Rollback(); throw e; } }
public virtual bool Excluir(object objeto) { try { AntesExcluir(); BeginTran(); Sessao.Delete(objeto); Sessao.Flush(); Commit(); Sessao.Clear(); return(true); } catch (HibernateException h) { if (this.transacao.WasRolledBack) { this.Rollback(); } Type aux = typeof(MySqlException); if (h.InnerException != null && h.InnerException.GetType().Equals(aux)) { GepexException.EBancoDados gex = new GepexException.EBancoDados(); gex.Numero = ((MySqlException)h.InnerException).Number; throw gex; } else { throw h; } } catch (Exception e) { if (this.transacao.WasRolledBack) { this.Rollback(); } throw e; } finally { } }