Beispiel #1
0
        /// <summary>
        /// Borra el registro de la base de datos
        /// </summary>
        /// <param name="parent">Lista padre</param>
        /// <remarks>La utiliza la BusinessListBaseEx correspondiente para borrar elementos<remarks/>
        internal void DeleteSelf(CreditCardStatements parent)
        {
            // if we're not dirty then don't update the database
            if (!this.IsDirty)
            {
                return;
            }

            // if we're new then don't update the database
            if (this.IsNew)
            {
                return;
            }

            try
            {
                SessionCode = parent.SessionCode;
                Session().Delete(Session().Get <CreditCardStatementRecord>(Oid));
            }
            catch (Exception ex)
            {
                throw new iQPersistentException(iQExceptionHandler.GetAllMessages(ex));
            }

            MarkNew();
        }
Beispiel #2
0
 public virtual void LoadChilds(Type type, bool childs)
 {
     if (type.Equals(typeof(CreditCardStatement)))
     {
         _statements = CreditCardStatements.GetChildList(this, childs);
     }
 }
Beispiel #3
0
        /// <summary>
        /// Inserta el registro en la base de datos
        /// </summary>
        /// <param name="parent">Lista padre</param>
        /// <remarks>La utiliza la BusinessListBaseEx correspondiente para insertar elementos<remarks/>
        internal void Insert(CreditCardStatements 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);
            }

            parent.Session().Save(Base.Record);

            MarkOld();
        }
Beispiel #4
0
        /// <summary>
        /// Construye el objeto y se encarga de obtener los
        /// hijos si los tiene y se solicitan
        /// </summary>
        /// <param name="source">DataReader fuente</param>
        private void Fetch(IDataReader source)
        {
            try
            {
                _base.CopyValues(source);

                if (Childs)
                {
                    if (nHMng.UseDirectSQL)
                    {
                        CreditCardStatement.DoLOCK(Session());
                        string      query  = CreditCardStatements.SELECT(this);
                        IDataReader reader = nHMng.SQLNativeSelect(query);
                        _statements = CreditCardStatements.GetChildList(SessionCode, reader);
                    }
                }
            }
            catch (Exception ex) { throw ex; }

            MarkOld();
        }
Beispiel #5
0
        /// <summary>
        /// Obtiene un registro de la base de datos
        /// </summary>
        /// <param name="criteria">Criterios de consulta</param>
        /// <remarks>Lo llama el DataPortal tras generar el objeto</remarks>
        private void DataPortal_Fetch(CriteriaEx criteria)
        {
            try
            {
                _base.Record.Oid = 0;
                SessionCode      = criteria.SessionCode;
                Childs           = criteria.Childs;

                if (nHMng.UseDirectSQL)
                {
                    CreditCard.DoLOCK(Session());
                    IDataReader reader = nHMng.SQLNativeSelect(criteria.Query, Session());

                    if (reader.Read())
                    {
                        _base.CopyValues(reader);
                    }

                    if (Childs)
                    {
                        string query = string.Empty;

                        query       = CreditCardStatements.SELECT(this);
                        reader      = nHMng.SQLNativeSelect(query);
                        _statements = CreditCardStatements.GetChildList(SessionCode, reader);
                    }
                }

                MarkOld();
            }
            catch (Exception ex)
            {
                if (Transaction() != null)
                {
                    Transaction().Rollback();
                }
                iQExceptionHandler.TreatException(ex, new object[] { criteria.Query });
            }
        }
Beispiel #6
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(CreditCardStatements 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;
            CreditCardStatementRecord obj = Session().Get <CreditCardStatementRecord>(Oid);

            obj.CopyValues(this._base.Record);
            Session().Update(obj);

            MarkOld();
        }