예제 #1
0
 public void Grabar(TipoMoneda instance)
 {
     new TipoMonedaDA().SaveOrUpdate(instance);
 }
예제 #2
0
        public void SaveOrUpdate(TipoMoneda 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();

                    }
                }

            }
        }