コード例 #1
0
 public RecurringTransactionModel(string userId, string walletId, string name, double amount, int recurringDate, TransactionCategory category, RecurringType type)
 {
     UserId      = userId;
     WalletId    = walletId;
     Name        = name;
     Amount      = amount;
     BillingDate = recurringDate;
     Category    = category;
     Type        = type;
 }
コード例 #2
0
        internal DHXEventsHelper._ParsedEventData _GetOccurrences(object ev, DateTime from_date, DateTime to_date, int max, PropertyDescriptorCollection info)
        {
            if (info.Find("id", true) == null || info.Find("start_date", true) == null || info.Find("end_date", true) == null)
            {
                return((DHXEventsHelper._ParsedEventData)null);
            }
            DHXEventsHelper.RecEvent recEvent = new DHXEventsHelper.RecEvent();
            recEvent.id = (int)info.Find("id", true).GetValue(ev);
            object obj1 = info.Find("start_date", true).GetValue(ev);

            if (obj1 != null)
            {
                recEvent.start_date = (DateTime)obj1;
            }
            object obj2 = info.Find("end_date", true).GetValue(ev);

            if (obj2 != null)
            {
                recEvent.end_date = (DateTime)obj2;
            }
            if (info.Find("rec_type", true) != null && info.Find("event_length", true) != null && info.Find("event_pid", true) != null)
            {
                recEvent.rec_type     = (string)info.Find("rec_type", true).GetValue(ev);
                recEvent.event_length = (long?)info.Find("event_length", true).GetValue(ev);
                recEvent.event_pid    = (int?)info.Find("event_pid", true).GetValue(ev);
            }
            RecurringType recurringType = RecurringType.Parse(recEvent.rec_type);

            if (recurringType.Type != RecTypes.Invalid && recurringType.Type != RecTypes.None && recEvent.event_length.HasValue)
            {
                List <DateTime> dateTimeList = new List <DateTime>();
                recEvent.parsed_type = recurringType;
                DateTime dateTime = recEvent.start_date;
                DateTime endDate  = recEvent.end_date;
                int      result   = -1;
                if (int.TryParse(recurringType.Extra, out result) && result < max)
                {
                    max = result;
                }
                while (dateTime < endDate && dateTime < to_date && dateTimeList.Count < max)
                {
                    if (recurringType.Count2 != -1 && recurringType.Day != -1)
                    {
                        DateTime nthWeekofMonth = this.GetNthWeekofMonth(dateTime, recurringType.Count2, (DayOfWeek)recurringType.Day);
                        if (this.CheckTimeframe(nthWeekofMonth, recEvent.end_date, from_date, to_date))
                        {
                            dateTimeList.Add(nthWeekofMonth);
                        }
                    }
                    else if (recurringType.Days.Count == 0 && this.CheckTimeframe(dateTime, recEvent.end_date, from_date, to_date))
                    {
                        dateTimeList.Add(dateTime);
                    }
                    else if (recurringType.Days.Count > 0)
                    {
                        foreach (int day in recurringType.Days)
                        {
                            int      num     = (int)(7 - dateTime.DayOfWeek + day) % 7;
                            DateTime evStart = dateTime.AddDays((double)num);
                            if (this.CheckTimeframe(evStart, recEvent.end_date, from_date, to_date) && dateTimeList.Count < max)
                            {
                                dateTimeList.Add(evStart);
                            }
                        }
                    }
                    switch (recurringType.Type)
                    {
                    case RecTypes.Day:
                        dateTime = dateTime.AddDays((double)recurringType.Count);
                        continue;

                    case RecTypes.Week:
                        dateTime = dateTime.AddDays((double)(7 * recurringType.Count));
                        continue;

                    case RecTypes.Month:
                        dateTime = dateTime.AddMonths(recurringType.Count);
                        continue;

                    case RecTypes.Year:
                        dateTime = dateTime.AddYears(recurringType.Count);
                        continue;

                    default:
                        continue;
                    }
                }
                return(new DHXEventsHelper._ParsedEventData()
                {
                    EventInfo = recEvent,
                    EventObject = ev,
                    Occurrences = dateTimeList
                });
            }
            if (!(recEvent.start_date < to_date) || !(recEvent.end_date > from_date))
            {
                return((DHXEventsHelper._ParsedEventData)null);
            }
            return(new DHXEventsHelper._ParsedEventData()
            {
                EventInfo = recEvent,
                EventObject = ev,
                Occurrences = new List <DateTime>()
                {
                    recEvent.start_date
                }
            });
        }
コード例 #3
0
 private RecurringTypeItem(RecurringType type)
 {
     Value = type;
     Text  = RecurringTypeText[type];
 }
コード例 #4
0
 public static bool TryGetItem(RecurringType type, out RecurringTypeItem item)
 {
     return(RecurringTypeItems.TryGetValue(type, out item));
 }
コード例 #5
0
 /// <summary>
 /// Sets the Recurring Info for Realex based recurring payments;
 /// where applicable.
 /// </summary>
 /// <param name="type">
 /// The value can be 'fixed' or 'variable' depending on whether
 /// the amount will change for each transaction.
 /// </param>
 /// <param name="sequence">
 /// Indicates where in the recurring sequence the transaction
 /// occurs. Must be 'first' for the first transaction for this
 /// card, 'subsequent' for transactions after that, and 'last'
 /// for the final transaction of the set.
 /// </param>
 /// <returns>AuthorizationBuilder</returns>
 public AuthorizationBuilder WithRecurringInfo(RecurringType type, RecurringSequence sequence)
 {
     RecurringSequence = sequence;
     RecurringType     = type;
     return(this);
 }