Beispiel #1
0
        internal void DeleteSelf(BankAccounts 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 <BankAccountRecord>(Oid));
            }
            catch (Exception ex)
            {
                iQExceptionHandler.TreatException(ex);
            }

            MarkNew();
        }
Beispiel #2
0
        internal void Update(BankAccounts parent)
        {
            // if we're not dirty then don't update the database
            if (!this.IsDirty)
            {
                return;
            }

            try
            {
                ValidationRules.CheckRules();

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

                SessionCode = parent.SessionCode;
                BankAccountRecord obj = Session().Get <BankAccountRecord>(Oid);
                obj.CopyValues(Base.Record);
                Session().Update(obj);
            }
            catch (Exception ex)
            {
                iQExceptionHandler.TreatException(ex);
            }

            MarkOld();
        }
Beispiel #3
0
        internal void Insert(BankAccounts parent)
        {
            // if we're not dirty then don't update the database
            if (!this.IsDirty)
            {
                return;
            }

            try
            {
                ValidationRules.CheckRules();

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

                parent.Session().Save(Base.Record);
            }
            catch (Exception ex)
            {
                iQExceptionHandler.TreatException(ex);
            }

            MarkOld();
        }
Beispiel #4
0
        public static BankAccountList GetList(bool childs)
        {
            CriteriaEx criteria = BankAccount.GetCriteria(BankAccount.OpenSession());

            criteria.Childs = childs;

            if (nHManager.Instance.UseDirectSQL)
            {
                criteria.Query = BankAccounts.SELECT();
            }

            BankAccountList list = DataPortal.Fetch <BankAccountList>(criteria);

            CloseSession(criteria.SessionCode);
            return(list);
        }
Beispiel #5
0
        private void DataPortal_Fetch(CriteriaEx criteria)
        {
            try
            {
                _base.Record.Oid = 0;
                SessionCode      = criteria.SessionCode;
                Childs           = criteria.Childs;

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

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

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

                        BankAccount.DoLOCK(Session());
                        query              = BankAccounts.SELECT(this);
                        reader             = nHMng.SQLNativeSelect(query, Session());
                        _cuentas_asociadas = BankAccounts.GetChildList(SessionCode, reader, false);

                        BankAccount.DoLOCK(Session());
                        query             = BankAccounts.SELECT(this, ETipoCuenta.FondoInversion);
                        reader            = nHMng.SQLNativeSelect(query, Session());
                        _fondos_inversion = BankAccounts.GetChildList(SessionCode, reader, false);
                    }
                }
            }
            catch (Exception ex)
            {
                if (Transaction() != null)
                {
                    Transaction().Rollback();
                }
                iQExceptionHandler.TreatException(ex);
            }
        }
Beispiel #6
0
        public static BankAccountList GetList(DateTime f_fin, bool childs)
        {
            CriteriaEx criteria = BankAccount.GetCriteria(BankAccount.OpenSession());

            criteria.Childs = childs;

            QueryConditions conditions = new QueryConditions
            {
                FechaFin = f_fin
            };

            if (nHManager.Instance.UseDirectSQL)
            {
                criteria.Query = BankAccounts.SELECT(conditions);
            }

            BankAccountList list = DataPortal.Fetch <BankAccountList>(criteria);

            CloseSession(criteria.SessionCode);
            return(list);
        }
Beispiel #7
0
        private void Fetch(IDataReader source)
        {
            _base.CopyValues(source);

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

                BankAccount.DoLOCK(Session());
                query              = BankAccounts.SELECT(this);
                reader             = nHMng.SQLNativeSelect(query, Session());
                _cuentas_asociadas = BankAccounts.GetChildList(SessionCode, reader, false);

                BankAccount.DoLOCK(Session());
                query             = BankAccounts.SELECT(this, ETipoCuenta.FondoInversion);
                reader            = nHMng.SQLNativeSelect(query, Session());
                _fondos_inversion = BankAccounts.GetChildList(SessionCode, reader, false);
            }

            MarkOld();
        }