Example #1
0
        public static CreditCardStatement GetOrCreateStatementFromOperationDueDate(long oidCreditCard, DateTime dueDate, int sessionCode = -1)
        {
            CreditCardInfo credit_card = CreditCardInfo.Get(oidCreditCard, false);

            if (credit_card.ETipoTarjeta != ETipoTarjeta.Credito)
            {
                return(CreditCardStatement.New());
            }

            if (credit_card.Statements == null)
            {
                credit_card.LoadChilds(typeof(CreditCardStatement), false);
            }
            CreditCardStatementInfo statement = credit_card.Statements.GetByDueDateItem(StatementDatesFromOperationDueDate.GetStatementDueDate(credit_card, dueDate));

            if (statement == null)
            {
                CreditCardStatement obj = CreditCardStatement.New(credit_card, dueDate, sessionCode);
                obj.From    = StatementDatesFromOperationDueDate.GetStatementFromDate(credit_card, dueDate);
                obj.Till    = StatementDatesFromOperationDueDate.GetStatementTillDate(credit_card, dueDate);
                obj.DueDate = StatementDatesFromOperationDueDate.GetStatementDueDate(credit_card, dueDate);
                return(obj);
            }
            else
            {
                return(CreditCardStatement.Get(statement.Oid, false, sessionCode));
            }
        }
Example #2
0
        public static CreditCardStatementList GetByPaymentList(long oidPayment, long oidCreditCard, bool childs)
        {
            QueryConditions conditions = new QueryConditions
            {
                OidEntity  = oidPayment,
                EntityType = ETipoEntidad.Pago,
                CreditCard = (oidCreditCard != 0) ? CreditCardInfo.New(oidCreditCard) : null,
            };

            return(GetList(CreditCardStatement.SELECT_BY_PAYMENT(conditions, false), childs));
        }
Example #3
0
        public static CreditCardStatementList GetChildList(CreditCardInfo parent, bool childs)
        {
            CriteriaEx criteria = CreditCardStatement.GetCriteria(CreditCardStatement.OpenSession());

            criteria.Query  = CreditCardStatementList.SELECT(parent);
            criteria.Childs = childs;

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

            CloseSession(criteria.SessionCode);

            return(list);
        }
Example #4
0
        public static CreditCardStatementList GetUnpaidList(long oidCreditCard, DateTime from, DateTime till, bool childs)
        {
            QueryConditions conditions = new QueryConditions
            {
                OidEntity   = -1,
                EntityType  = ETipoEntidad.Pago,
                CreditCard  = (oidCreditCard != 0) ? CreditCardInfo.New(oidCreditCard) : null,
                FechaAuxIni = from,
                FechaAuxFin = till,
            };

            return(GetList(CreditCardStatement.SELECT_UNPAID(conditions, false), childs));
        }
Example #5
0
        internal void CopyValues(CreditCardStatement source)
        {
            if (source == null)
            {
                return;
            }

            _record.CopyValues(source.Base.Record);

            _bank_account = source.BankAccount;
            _credit_card  = source.CreditCard;
            _pending      = source.Base.Pending;
            _deallocated  = source.Base.Deallocated;
            _status       = source.Base.Status;
            _cash_amount  = source.CashAmount;
        }
Example #6
0
        public static CreditCardStatementList GetList(string query, bool childs)
        {
            CriteriaEx criteria = CreditCardStatement.GetCriteria(CreditCardStatement.OpenSession());

            criteria.Childs = childs;

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

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

            CloseSession(criteria.SessionCode);
            return(list);
        }
Example #7
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();
        }
Example #8
0
 public static string SELECT(CreditCardInfo source)
 {
     return(CreditCardStatement.SELECT(new QueryConditions {
         CreditCard = source
     }, false));
 }
Example #9
0
 public static string SELECT(QueryConditions conditions)
 {
     return(CreditCardStatement.SELECT(conditions, false));
 }
 public void CopyFrom(CreditCardStatement source)
 {
     _base.CopyValues(source);
 }