internal void DeleteRepayment(Repayment repaymentItem) { this.Repayments.Remove(repaymentItem); AlarmManager.RemoveAlarmByName(repaymentItem.Id.ToString()); this.AccountBookDataContext.Repayments.DeleteOnSubmit(repaymentItem); this.SubmitChanges(); }
public void AddRepayment(Repayment repaymentItem) { repaymentItem.RepaymentRecordType = 0; this.Repayments.Add(repaymentItem); this.AccountBookDataContext.Repayments.InsertOnSubmit(repaymentItem); this.SubmitChanges(); }
internal void CompleteRepayment(Repayment repaymentItem) { repaymentItem.Completed(); ViewModelLocator.MainPageViewModel.IsSummaryListLoaded = false; ViewModelLocator.AccountViewModel.Transfer(repaymentItem.PayFromAccount, repaymentItem.PayToAccount, repaymentItem.Amount, repaymentItem.Amount, true); this.SubmitChanges(); }
public PageActionType InitializeAction(string id) { if (id.Length == 0) { this.Action = PageActionType.Add; } else { this.backCurrent = this.AccountBookDataContext.Repayments.FirstOrDefault<Repayment>(p => p.Id.ToString() == id); this.Current = this.backCurrent.Clone(); this.Action = PageActionType.Edit; } return this.action; }
public void Submit(Repayment repayment, bool useAlarmOrReminder) { AlarmManager.AddRepaymentAlarmNotification(repayment, false); if (this.Action == PageActionType.Add) { this.AddRepayment(this.current); } else { this.backCurrent.RestoreFrom(this.current); this.Update(); this.current = null; } }
public void InitializeCurrent(string id) { if (this.action == PageActionType.Add) { Repayment repayment = new Repayment { Id = System.Guid.NewGuid(), RepayAt = System.DateTime.Now.AddDays(1.0), PayToAccount = this.BankOrCreditAccounts.FirstOrDefault<Account>(), PayFromAccount = this.Accounts.FirstOrDefault<Account>(), Status = RepaymentStatus.OnGoing, DueDate = System.DateTime.Now.AddDays(3.0) }; this.Current = repayment; } }
public static void AddRepaymentAlarmNotification(Repayment repayment, bool useAlarm) { string name = repayment.Id.ToString(); if (ScheduledActionService.GetActions<ScheduledNotification>().FirstOrDefault<ScheduledNotification>(p => (p.Name == name)) != null) { try { ScheduledActionService.Remove(name); } catch (System.Exception) { } } ScheduledNotification action = null; if (useAlarm) { Alarm alarm = new Alarm(name) { Sound = LocalizedStrings.GetLocailizedResourceUriFrom("/Resources/sounds/RepaymentNotification/RepaymentArrive.{0}.mp3", new object[0]) }; action = alarm; } else { Reminder reminder = new Reminder(name) { NavigationUri = new Uri("/Pages/RepaymentManagerViews/RepaymentItemEditor.xaml?action={0}&itemId={1}".FormatWith(new object[] { PageActionType.Edit, repayment.Id }), UriKind.RelativeOrAbsolute), Title = LocalizedStrings.GetLanguageInfoByKey("RepaymentNotificationList") }; action = reminder; } action.RecurrenceType = WarpFrequency(repayment.Frequency); action.BeginTime = repayment.RepayAt; action.ExpirationTime = repayment.DueDate; action.Content = repayment.GetContentUsedForNotification(); try { ScheduledActionService.Add(action); } catch (System.Exception) { } }
private void AddRepayment(Repayment current) { ViewModelLocator.RepaymentManagerViewModel.AddRepayment(current); }
private void InitializeEdit(Repayment leanObject) { this.CurrentObject = leanObject; this.PeopleName.Text = this.currentObject.RepayToOrGetBackFrom.ToPeople.Name; this.TotalMoneyBox.Text = this.currentObject.Amount.ToMoneyF2(); this.AccountName.SelectedItem = ViewModelLocator.AccountViewModel.Accounts.FirstOrDefault<Account>(p => p.Id == this.currentObject.FromAccountId); this.DescriptionTextBox.Text = this.currentObject.Notes; this.ExecuteDate.Value = this.currentObject.ExecuteDate; this.InterestBox.Text = this.currentObject.Interset.GetValueOrDefault().ToString("#.##"); this.SetAmountInfoForRepayOrReceieve(); }
/// <summary> /// Views the specified from page. /// </summary> /// <param name="fromPage">From page.</param> /// <param name="item">The item.</param> public static void View(PhoneApplicationPage fromPage, Repayment item) { if (item != null) { fromPage.NavigateTo("/Pages/BorrowAndLean/BorrowOrLoanRepayReceiveInfoViewerPage.xaml?id={0}", item.Id); } }
public void ViewRepayment(Repayment instance) { if (instance != null) { this.Current = instance; this.oldAmount = instance.Amount; this.RepayOrReceieveHistoryPivot.Header = AppResources.HistoryOf.FormatWith(new object[] { this.current.ReverseRepaymentTypeName }).ToLowerInvariant(); if (((LeanType)this.current.BorrowOrLean) == LeanType.BorrowIn) { this.titalOfAction = AppResources.Repayed.ToLowerInvariant(); } else { this.titalOfAction = AppResources.Receieved.ToLowerInvariant(); } if (this.current.RepayToOrGetBackFromItems != null) { this.current.RepayToOrGetBackFromItems.CollectionChanged += new NotifyCollectionChangedEventHandler(this.RepayToOrGetBackFromItems_CollectionChanged); } this.AlreadyPayPanelTitle.Text = AppResources.AlreadyRepayOrReceieveTitle.FormatWith(new object[] { this.titalOfAction }).ToLowerInvariant(); } }
public void RestoreFrom(Repayment repayment) { this.Id = repayment.Id; this.Amount = repayment.Amount; this.Notes = repayment.Notes; this.RepayAt = repayment.RepayAt; this.Status = repayment.Status; this._payToAccountId = repayment._payToAccountId; this._fromAccountId = repayment.FromAccountId; this.CompletedAt = repayment.CompletedAt; this.PayToAccount = repayment.PayToAccount; this.PayFromAccount = repayment.PayFromAccount; this.Place = repayment._place; this.DueDate = repayment._dueDate; this.UseAlarm = repayment._useAlarm; this._fromPeople = repayment._fromPeople; this.toPeopleId = repayment.toPeopleId; this.ToPeople = repayment.ToPeople; this.Interset = repayment.interest; this.repaymentRecordType = repayment.RepaymentRecordType; this.BorrowOrLean = repayment.borrowOrLean; this.categoryId = repayment.CategoryId; this.AssociatedCategory = repayment.AssociatedCategory; this.createAt = repayment.CreateAt; this.frequency = repayment.Frequency; this.ExecuteDate = repayment.executeDate; this.OnNotifyPropertyChanged("RepaymentInfoLine"); this.OnNotifyPropertyChanged("RemindingInfo"); }
private void GoToEditRepayment(Repayment entry) { System.Func<Repayment> func = null; if (entry.IsRepaymentOrReceieve) { RepayOrReceiveEditorPage.Go(entry, this, PageActionType.Edit); } else { if (func == null) { func = () => entry; } BorrowLeanEditor.GetEditObject = func; this.NavigateTo("/Pages/BorrowAndLean/BorrowLeanEditor.xaml"); } }
public void InitializeAdd(Repayment leanObject) { this.CurrentObject = leanObject; if (this.AccountName != null) { this.AccountName.SelectedIndex = 0; } if (this.BorrowLeanDebtor != null) { this.BorrowLeanDebtor.SelectedIndex = 0; } }
internal void CancelRepayment(Repayment repaymentItem) { repaymentItem.Cancel(); this.SubmitChanges(); }
private void attach_ToDo(Repayment toDo) { this.OnNotifyPropertyChanging("RepayTo"); toDo.RepayToOrGetBackFrom = this; }
public void InitializeEdit(Repayment leanObject) { this.CurrentObject = ViewModelLocator.BorrowLeanViewModel.AccountBookDataContext.Repayments.FirstOrDefault<Repayment>(p => p.Id == leanObject.Id); int num = (int)this.currentObject.BorrowOrLean.Value; if (num == 4) { num = 2; } this.BorrowLeanType.SelectedIndex = num; this.BorrowLeanType.IsEnabled = false; this.BorrowLeanDebtor.SelectedItem = ViewModelLocator.PeopleViewModel.PeopleList.FirstOrDefault<PeopleProfile>(p => p.Id == this.currentObject.ToPeopleId); this.AccountName.SelectedItem = ViewModelLocator.AccountViewModel.Accounts.FirstOrDefault<Account>(p => p.Id == this.currentObject.FromAccountId); this.TotalMoneyBox.Text = this.currentObject.Amount.ToMoneyF2(); this.DescriptionTextBox.Text = this.currentObject.Notes; this.ExecuteDate.Value = this.currentObject.ExecuteDate; this.InterestBox.Text = this.currentObject.Interset.GetValueOrDefault().ToString("#.##"); }
private void goToEditRepay(Repayment item) { RepayOrReceiveEditorPage.Go(item, this.associatedPage, PageActionType.Edit); RepayOrReceiveEditorPage.CallBackIfHasEdit = new System.Action<bool>(this.RepayOrReceiveEditorPage_CallBackIfHasEdit); }
/// <summary> /// Goes the specified repayment. /// </summary> /// <param name="repayment">The repayment.</param> public static void Go(Repayment repayment, PhoneApplicationPage pageFrom, PageActionType action) { var warpped = repayment; if (action == PageActionType.Add) { warpped = ViewModelLocator.BorrowLeanViewModel.CreateRepayOrReceieveEntry(repayment); warpped.RepayToOrGetBackFrom = repayment; } GetEditObject = () => warpped; pageFrom.NavigateTo("/Pages/BorrowAndLean/RepayOrReceiveEditorPage.xaml?action={0}", action); }
/// <summary> /// Loads the viewing object. /// </summary> /// <param name="id">The id.</param> private void loadViewingObject(Guid id) { ThreadPool.QueueUserWorkItem((o) => { var item = ViewModelLocator.BorrowLeanViewModel .QueryBorrowLoan(p => p.Id == id).FirstOrDefault(); Dispatcher.BeginInvoke(() => { Current = item; infoViewerControl.ViewRepayment(Current); if (infoViewerControl.needReloadHistory) { infoViewerControl.LoadHistoryData(); } }); }); }