Пример #1
0
 public void EditUserTransaction(UserTransactionDTO transaction)
 {
     UserTransaction utdb = db.UserTransactions.GetById(transaction.Id);
     utdb.Description = transaction.Description;
     utdb.Sum = transaction.Sum;
     db.UserTransactions.Update(utdb);
     db.Save();
 }
Пример #2
0
 public void AddTransaction(string user, UserTransactionDTO ut)
 {
     UserTransaction utdb = new UserTransaction
     {
         Id = db.UserTransactions.GetLastUsedUserTransactionId() + 1,
         Date = ut.Date,
         User = db.Users.GetUserByLogin(user),
         Description = ut.Description,
         Sum = ut.Sum
     };
     db.UserTransactions.Create(utdb);
     db.Save();
 }
Пример #3
0
 void AddUserTransaction(object sender, EventArgs e)
 {
     string login = transactionUser.Text;
     if (!CheckAddUserTransactionTextboxesForMinimumValidData())
         return;
     UserTransactionDTO ut = new UserTransactionDTO
     {
         Date = transactionDate.Value,
         Description = transactionDescription.Text,
         Sum = Convert.ToDecimal(transactionSum.Text)
     };
     new UserTransactionService(Server).AddTransaction(login, ut);
     ClearUserTransactionEditForm();
     transactionUser.Text = login;
 }
Пример #4
0
 void EditUserTransactionClick(object sender, EventArgs e)
 {
     if (!CheckAddUserTransactionTextboxesForMinimumValidData())
         return;
     UserTransactionDTO transaction = new UserTransactionDTO
     {
         Id = Convert.ToInt16(transactionId.Text),
         Description = transactionDescription.Text,
         Sum = Convert.ToDecimal(transactionSum.Text),
     };
     new UserTransactionService(Server).EditUserTransaction(transaction);
     ClearUserTransactionEditForm();
 }
Пример #5
0
 void DeleteUserTransactionClick(object sender, EventArgs e)
 {
     UserTransactionDTO ut = new UserTransactionDTO
     {
         Id = Convert.ToInt16(transactionId.Text),
         Description = transactionDescription.Text,
         Sum = Convert.ToDecimal(transactionSum.Text)
     };
     new UserTransactionService(Server).DeleteUserTransaction(ut);
     ClearUserTransactionEditForm();
 }
Пример #6
0
 public void DeleteUserTransaction(UserTransactionDTO transaction)
 {
     UserTransaction t = db.UserTransactions.GetById(transaction.Id);
     db.UserTransactions.Delete(t);
     db.Save();
 }