Beispiel #1
0
 public PatrimDepreciacaoBemDTO salvarAtualizarPatrimDepreciacaoBem(PatrimDepreciacaoBemDTO patrimDepreciacaoBem)
 {
     try
     {
         using (ISession session = NHibernateHelper.getSessionFactory().OpenSession())
         {
             NHibernateDAL <PatrimDepreciacaoBemDTO> DAL = new NHibernateDAL <PatrimDepreciacaoBemDTO>(session);
             DAL.saveOrUpdate(patrimDepreciacaoBem);
             session.Flush();
         }
         return(patrimDepreciacaoBem);
     }
     catch (Exception ex)
     {
         throw new FaultException(ex.Message + (ex.InnerException != null ? " " + ex.InnerException.Message : ""));
     }
 }
Beispiel #2
0
 public IList <PatrimDepreciacaoBemDTO> selectPatrimDepreciacaoBem(PatrimDepreciacaoBemDTO patrimDepreciacaoBem)
 {
     try
     {
         IList <PatrimDepreciacaoBemDTO> resultado = null;
         using (ISession session = NHibernateHelper.getSessionFactory().OpenSession())
         {
             NHibernateDAL <PatrimDepreciacaoBemDTO> DAL = new NHibernateDAL <PatrimDepreciacaoBemDTO>(session);
             resultado = DAL.select(patrimDepreciacaoBem);
         }
         return(resultado);
     }
     catch (Exception ex)
     {
         throw new FaultException(ex.Message + (ex.InnerException != null ? " " + ex.InnerException.Message : ""));
     }
 }
        private void btIncluir_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                PatrimDepreciacaoBemDTO detalheDTO = new PatrimDepreciacaoBemDTO();
                detalheDTO.IdPatrimBem = ((PatrimBemViewModel)DataContext).PatrimBemSelected.Id;

                ((PatrimBemViewModel)DataContext).PatrimDepreciacaoBemSelected = detalheDTO;
                PatrimDepreciacaoBem viewDetalhe = new PatrimDepreciacaoBem();
                viewDetalhe.btSair.Click   += new RoutedEventHandler(btSair_Click);
                viewDetalhe.btGravar.Click += new RoutedEventHandler(btGravar_Click);
                tabDetalhe.Content          = viewDetalhe;
                tabDetalhe.IsSelected       = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Alerta do sistema");
            }
        }
Beispiel #4
0
 public int deletePatrimDepreciacaoBem(PatrimDepreciacaoBemDTO patrimDepreciacaoBem)
 {
     try
     {
         int resultado = -1;
         using (ISession session = NHibernateHelper.getSessionFactory().OpenSession())
         {
             NHibernateDAL <PatrimDepreciacaoBemDTO> DAL = new NHibernateDAL <PatrimDepreciacaoBemDTO>(session);
             DAL.delete(patrimDepreciacaoBem);
             session.Flush();
             resultado = 0;
         }
         return(resultado);
     }
     catch (Exception ex)
     {
         throw new FaultException(ex.Message + (ex.InnerException != null ? " " + ex.InnerException.Message : ""));
     }
 }