public void Execute(object parameter) { bool res = false; var window = (Window)parameter; ExpenseDetailsDAL expenseDetailsDAL = new ExpenseDetailsDAL(); ExpenseDetails expense = new ExpenseDetails { UserId = AddExpenseViewModel.UserId, CategoryId = AddExpenseViewModel.CategoryId, Amount = AddExpenseViewModel.Amount, ExpenseDate = AddExpenseViewModel.ExpenseDate.GetValueOrDefault().ToString("yyyy-MM-dd"), Item = AddExpenseViewModel.Item, ExpenseTrackerId = AddExpenseViewModel.ExpenseTrackerId, }; if (expense.ExpenseTrackerId > 0) { res = expenseDetailsDAL.UpdateExpense(expense); } else { res = expenseDetailsDAL.AddExpense(expense); } if (res) { var viewModel = new ExpenseTrackerManagerViewModel(AddExpenseViewModel.UserId); viewModel.UserName = AddExpenseViewModel.UserName; ExpenseTrackerManager expenseTrackerManager = new ExpenseTrackerManager(viewModel); window.Close(); expenseTrackerManager.Show(); } }
public void Execute(object parameter) { var window = (Window)parameter; var viewModel = new ExpenseTrackerManagerViewModel(ExpenseChartViewModel.UserId); viewModel.UserName = ExpenseChartViewModel.UserName; ExpenseTrackerManager expenseTrackerManager = new ExpenseTrackerManager(viewModel); window.Close(); expenseTrackerManager.Show(); }
public void Execute(object parameter) { var window = (Window)parameter; var user = new UserDetails(); user.UserName = UserLoginViewModel.UserName; user.Password = UserLoginViewModel.Password; UserDetailsDAL userDAL = new UserDetailsDAL(); user = userDAL.UserLogin(user); if (user != null && user.UserId > 0) { var viewModel = new ExpenseTrackerManagerViewModel(user.UserId); viewModel.UserName = user.Name; ExpenseTrackerManager expenseTrackerManager = new ExpenseTrackerManager(viewModel); window.Close(); expenseTrackerManager.Show(); } }