Esempio 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"));
     }
 }
Esempio n. 2
0
 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"));
     }
 }
Esempio n. 3
0
 public void Update(Account model)
 {
     Execute(SqlUpdateCommand, model);
 }
Esempio n. 4
0
 public void Insert(Account model)
 {
     Execute(SqlInsertCommand, model);
 }
Esempio n. 5
0
 private void SavesAccount()
 {
     var acc = new Account
     {
         AccId = Int64.Parse(AccountId.Text),
         AccBalance = Math.Round(_accountBalance,2),
         AccBank = GeBankIdFromName(),
         AccName = AccountName.Text,
         AccNumber = Int64.Parse(AccountNumber.Text),
         AccStatus = GetAccountStatusIdFromName(),
         AccType = GetAccountTypeIdFromName(),
         LastUpdate = StringManipulation.GetStringFromDate(DateTime.Now.Date),
         UserId = NightCore.UserId
     };
     _accountAccess.Insert(acc);
     MessageBox.Show("New account has been added", "Success");
     Reset();
 }
Esempio n. 6
0
 private void SaveIncome()
 {
     var accId = GetAccountId();
     if(accId != null && accId != 0)
     {
         if (_isDateSelected)
         {
             var income = new Data_Models.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);
             MessageBox.Show("New income has been saved", "Success");
             Reset();
         }
         else
         {
             MessageBox.Show("You must select a valid date", "Operation Aborted");
         }
     }
     else
     {
         MessageBox.Show("We could not associate the transaction with any account", "Operation Aborted");
     }
 }