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")); } }
public void Insert(Income model) { Execute(SqlInsertCommand, model); }
public void Update(Income model) { Execute(SqlUpdateCommand, model); }
public String GetIncomeLabel(Income income) { return income.IncomeSubType() != null ? income.IncomeSubType().InSubTypeName : income.Incometype().InName; }