Esempio n. 1
0
        public void Reload()
        {
            using (ISession session = UserContext.SessionFactory.OpenSession())
            {
                using (ITransaction tx = session.BeginTransaction())
                {
                    try
                    {
                        using (AppliactionContext.Log.LogTime(this, String.Format("Reload contact person '{0} {1}'.", FirstName, LastName)))
                        {
                            DbContactPerson reloadedContactPerson = session.Load <DbContactPerson>(_dbContactPerson.Id);

                            _dbContactPerson.FirstName   = reloadedContactPerson.FirstName;
                            _dbContactPerson.LastName    = reloadedContactPerson.LastName;
                            _dbContactPerson.PhoneNumber = reloadedContactPerson.PhoneNumber;
                            _dbContactPerson.Email       = reloadedContactPerson.Email;

                            tx.Commit();
                        }
                    }
                    catch (Exception ex)
                    {
                        AppliactionContext.Log.Critical(this, ex.Message);
                        tx.Rollback();
                        throw ex;
                    }
                }
            }
        }
Esempio n. 2
0
 public ContactPerson(DbContactPerson dbContactPerson)
 {
     _dbContactPerson = dbContactPerson;
 }