Esempio n. 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));
            }
        }
Esempio n. 2
0
        public static CreditCardStatement New(CreditCardInfo creditCard, DateTime baseDate, decimal amount, int sessionCode = -1)
        {
            if (!CanAddObject())
            {
                throw new System.Security.SecurityException(moleQule.Library.Resources.Messages.USER_NOT_ALLOWED);
            }

            CreditCardStatement obj = DataPortal.Create <CreditCardStatement>(new CriteriaCs(-1));

            obj.SetSharedSession(sessionCode);
            obj.OidCreditCard = creditCard.Oid;
            obj.From          = StatementDatesFromOperationDueDate.GetStatementFromDate(creditCard, baseDate);
            obj.Till          = StatementDatesFromOperationDueDate.GetStatementTillDate(creditCard, baseDate);
            obj.DueDate       = StatementDatesFromOperationDueDate.GetStatementDueDate(creditCard, baseDate);

            return(obj);
        }