private void SaveExpediture(DialogOpenedEventArgs eventargs) { var accId = GetAccountId(); if(accId != null && accId != 0) { if(_isDateSelected && TransDate.SelectedDate != null) { var expense = new Expediture { ExId = Int64.Parse(TransId.Text), AccId = accId, ExTypeId = _transactionTypeId, ExText = TransMemo.Text, ExDetails = TransDetails.Text, ExSubTypeId = _transactionSubTypeId, ExAmount = _transactionAmount, ExDate = StringManipulation.GetStringFromDate(TransDate.SelectedDate.Value.Date), LastUpdate = StringManipulation.GetStringFromDate(DateTime.Now.Date) }; _expeditureAccess.Insert(expense); _focusAccount = expense.Account(); _focusAccount.AccBalance -= Math.Round(_transactionAmount, 2); _focusAccount.LastUpdate = StringManipulation.GetStringFromDate(DateTime.Now.Date); _accountAccess.Update(_focusAccount); eventargs.Session.UpdateContent(new MessageDialog("Alright sparky","A new expense 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(Expediture model) { Execute(SqlInsertCommand, model); }
public void Update(Expediture model) { Execute(SqlUpdateCommand, model); }
public String GetExpeditureLabel(Expediture expediture) { return expediture.ExpeditureSubtype() != null ? expediture.ExpeditureSubtype().ExSubTypeName : expediture.Expedituretype().ExName; }