示例#1
0
 //Date - new above old, deposits above withdrawals, then retain the source order
 public static int Compare(Xact l, Xact r)
 {
     if (l.When > r.When || (l.When == r.When && ((l.Amount > 0 && r.Amount < 0) || l.Ordinal < r.Ordinal)))
     {
         return(-1);
     }
     else
     {
         return(1);
     }
 }
示例#2
0
        internal XactDetailsPage(Account Acct, Xact x)
        {
            m_Acct = Acct;
            m_Xact = x;
            InitializeComponent();

            lCreateRec.IsVisible     = !x.IsRecurring;
            gRecHeader.IsVisible     =
                bDeleteRec.IsVisible = x.IsRecurring;

            if (x.IsRecurring)
            {
                m_Recurrence = Acct.FindRecurrence(x.RecurrenceID);

                if (m_Recurrence != null)
                {
                    m_WasRecurring    = true;
                    eRecAmount.Text   = m_Recurrence.Amount.ToString();
                    eRecDesc.Text     = m_Recurrence.XactDesc;
                    eRecNickname.Text = m_Recurrence.Nickname;

                    if (m_Recurrence.Type == RecurrenceType.Weekly)
                    {
                        gWeeklyRecDetails.IsVisible = true;
                        eWeeklyStartDate.Text       = m_Recurrence.StartDate.ToString("MM/dd/yyyy");
                        sWeekCount.Value            = m_Recurrence.Interval;
                        eWeekCount.Text             = m_Recurrence.Interval.ToString();
                    }
                    else if (m_Recurrence.Type == RecurrenceType.Monthly)
                    {
                        gMonthlyRecDetails.IsVisible = true;
                        eMonthlyStartDate.Text       = m_Recurrence.StartDate.ToString("MM/dd/yyyy");
                        sMonthCount.Value            = m_Recurrence.Interval;
                        eMonthCount.Text             = m_Recurrence.Interval.ToString();
                    }
                }
            }

            lHeader.Text = string.Format("{0} {1} of ${2} on {3:ddd, MMM d}",
                                         x.IsProjected ? "Projected" : "Recorded",
                                         x.Amount < 0 ? "withdrawal" : "deposit",
                                         x.Amount < 0 ? -x.Amount : x.Amount,
                                         x.When);
            lDesc.Text = x.Desc;
        }
示例#3
0
        protected override void OnBindingContextChanged()
        {
            base.OnBindingContextChanged();

            if (BindingContext != null)
            {
                Xact x = BindingContext as Xact;
                lWhen.Text                       = x.When.ToString("MMM dd");
                lDesc.Text                       = x.Nickname ?? x.Desc;
                lAmount.Text                     = x.Amount.FormatAmount();
                lBalance.Text                    = x.Balance.FormatBalance();
                bLeft.Color                      = s_BarColors[(x.IsProjected ? 2 : 0) + (x.Amount < 0 ? 1 : 0)];
                lRepeat.IsVisible                = x.IsRecurring;
                lWhen.FontAttributes             =
                    lAmount.FontAttributes       =
                        lBalance.FontAttributes  =
                            lDesc.FontAttributes = x.IsProjected ? FontAttributes.Italic : FontAttributes.Bold;
                lWhen.TextColor                  =
                    lDesc.TextColor              =
                        lAmount.TextColor        = s_BarColors[x.Amount < 0 ? 1 : 0];
                lBalance.TextColor               = s_BalanceColors[x.Balance >= 0 ? 0 : 1];
            }
        }