Example #1
0
 protected override void DataPortal_Update()
 {
     if (IsDirty)
     {
         try
         {
             DocumentRecord obj = Session().Get <DocumentRecord>(OidDocumento);
             obj.CopyValues(Base.Record);
             Session().Update(obj);
         }
         catch (Exception ex)
         {
             iQExceptionHandler.TreatException(ex);
         }
     }
 }
Example #2
0
        public virtual void CopyValues(DocumentRecord source)
        {
            if (source == null)
            {
                return;
            }

            Oid              = source.Oid;
            _codigo          = source.Codigo;
            _serial          = source.Serial;
            _nombre          = source.Nombre;
            _tipo            = source.Tipo;
            _fecha           = source.Fecha;
            _fecha_alta      = source.FechaAlta;
            _expiration_date = source.ExpirationDate;
            _ruta            = source.Ruta;
            _observaciones   = source.Observaciones;
        }
Example #3
0
        /// <summary>
        /// Actualiza el registro en la base de datos
        /// </summary>
        /// <param name="parent">Lista padre</param>
        /// <remarks>La utiliza la BusinessListBaseEx correspondiente para actualizar elementos<remarks/>
        internal void Update(Documentos parent)
        {
            // if we're not dirty then don't update the database
            if (!this.IsDirty)
            {
                return;
            }

            ValidationRules.CheckRules();

            if (!IsValid)
            {
                throw new iQValidationException(Library.Resources.Messages.GENERIC_VALIDATION_ERROR);
            }

            SessionCode = parent.SessionCode;
            DocumentRecord obj = Session().Get <DocumentRecord>(Oid);

            obj.CopyValues(Base.Record);
            Session().Update(obj);

            MarkOld();
        }
Example #4
0
        private void DataPortal_Delete(CriteriaCs criterio)
        {
            if (this.AgenteDocumentos.Count < 0)
            {
                throw new iQException("Existe al menos un agente asociado con este documento. No se puede borrar.");
            }

            try
            {
                //Iniciamos la conexion y la transaccion
                SessionCode = OpenSession();
                BeginTransaction();

                //Si no hay integridad referencial, aqui se deben borrar las listas hijo
                CriteriaEx criteria = GetCriteria();
                criteria.AddOidSearch(criterio.Oid);

                // Obtenemos el objeto
                DocumentRecord obj = (DocumentRecord)(criteria.UniqueResult());
                Session().Delete(Session().Get <DocumentRecord>(obj.Oid));

                Transaction().Commit();
            }
            catch (Exception ex)
            {
                if (Transaction() != null)
                {
                    Transaction().Rollback();
                }
                iQExceptionHandler.TreatException(ex);
            }
            finally
            {
                CloseSession();
            }
        }