Ejemplo n.º 1
0
 private void SendMonthUpdate(PaymentsMonthViewModel months)
 {
     if (_collection.SendUpdates)
     {
         SendUpdate(PaymentTransformers.OnUpdate(months, _collection.IndexOf(months)));
     }
 }
Ejemplo n.º 2
0
 public static PaymentsStream OnRemove(PaymentsMonthViewModel arg1, int position) =>
 new PaymentsStream
 {
     Removed = new PaymentViewUpdate
     {
         Position = position
     }
 };
Ejemplo n.º 3
0
 public static PaymentsStream OnUpdate(PaymentsMonthViewModel arg1, int position) =>
 new PaymentsStream
 {
     Updated = new PaymentViewUpdate
     {
         Position = position,
         View     = arg1.ToMonthSummary()
     }
 };
Ejemplo n.º 4
0
        private void AddPayment(PaymentModel paymentModel)
        {
            var key      = PaymentTransformers.GetKey(paymentModel);
            var existing = _collection.FirstOrDefault(v => v.Key == key);

            if (existing == null)
            {
                existing = new PaymentsMonthViewModel(paymentModel.When.Date, key);
                int i;
                for (i = 0; i < _collection.Count; i++)
                {
                    if (String.Compare(_collection[i].Key, key, StringComparison.Ordinal) < 0)
                    {
                        break;
                    }
                }
                _collection.Insert(i, existing);
            }

            existing.AddPayment(paymentModel);

            SendMonthUpdate(existing);
        }