Beispiel #1
0
        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();
            }
        }
Beispiel #2
0
        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();
        }
Beispiel #3
0
        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();
            }
        }
 public EditExpenseCommand(ExpenseTrackerManagerViewModel viewModel)
 {
     ExpenseTrackerManagerViewModel = viewModel;
 }
Beispiel #5
0
 public ExpenseFilterCommand(ExpenseTrackerManagerViewModel viewModel)
 {
     this.ViewModel = viewModel;
 }
 public DeleteExpenseCommand(ExpenseTrackerManagerViewModel expenseTrackerManagerViewModel)
 {
     this.ExpenseTrackerManagerViewModel = expenseTrackerManagerViewModel;
 }
 public ExpenseTrackerManager(ExpenseTrackerManagerViewModel viewModel)
 {
     this.DataContext = viewModel;
     InitializeComponent();
 }