Exemplo n.º 1
0
 private void SaveIncome(DialogOpenedEventArgs eventargs)
 {
     var accId = GetAccountId();
     if(accId != null && accId != 0)
     {
         if(_isDateSelected && TransDate.SelectedDate != null)
         {
             var income = new Income
             {
                 InId = Int64.Parse(TransId.Text),
                 AccId = accId,
                 InTypeId = _transactionTypeId,
                 InText = TransMemo.Text,
                 InDetails = TransDetails.Text,
                 InSubTypeId = _transactionSubTypeId,
                 InAmount = _transactionAmount,
                 InDate = StringManipulation.GetStringFromDate(TransDate.SelectedDate.Value.Date),
                 LastUpdate = StringManipulation.GetStringFromDate(DateTime.Now.Date)
             };
             _incomeAccess.Insert(income);
             _focusAccount = income.Account();
             _focusAccount.AccBalance += Math.Round(_transactionAmount, 2);
             _focusAccount.LastUpdate = StringManipulation.GetStringFromDate(DateTime.Now.Date);
             _accountAccess.Update(_focusAccount);
             eventargs.Session.UpdateContent(new MessageDialog("Awesome dude!","A new income has been saved"));
             Reset();
         }
         else
         {
             eventargs.Session.UpdateContent(new MessageDialog("No date, No save","You must select a valid date"));
         }
     }
     else
     {
         eventargs.Session.UpdateContent(new MessageDialog("Missing Accounts","We could not associate the transaction with any account"));
     }
 }
Exemplo n.º 2
0
 public void Insert(Income model)
 {
     Execute(SqlInsertCommand, model);
 }
Exemplo n.º 3
0
 public void Update(Income model)
 {
     Execute(SqlUpdateCommand, model);
 }
Exemplo n.º 4
0
 public String GetIncomeLabel(Income income)
 {
     return income.IncomeSubType() != null ? income.IncomeSubType().InSubTypeName : income.Incometype().InName;
 }