Example #1
0
 public EditIncomesViewModel(FinancesDBContext dbContext, Income income, int Id)
 {
     this.dbContext   = dbContext;
     IncomeSourceList = dbContext.Source_of_income.Local;
     if (income != null)
     {
         CurrentIncome       = income;
         ApplyChangesCommand = new RelayCommand(UpdateIncome, CanExe);
     }
     else
     {
         CurrentIncome       = new Income();
         CurrentIncome.Date  = DateTime.Now;
         ApplyChangesCommand = new RelayCommand(AddIncome, CanExe);
     }
     dbContext.User.Load();
     //User t = new User();
     //ObservableCollection<User> Users;
     //Users = dbContext.User.Local;
     //foreach (User p in Users)
     //{
     //    if (p.Id == Id) t = p;
     //}
     //CurrentIncome.User = t;
     CurrentIncome.LoginId = Id;
 }
Example #2
0
 public MainWindowViewModel(FinancesDBContext db, int Id)
 {
     //db = new FinancesDBContext();
     this.db           = db;
     IncomesTabItemVM  = new IncomeViewModel(db, Id);
     ExpensesTabItemVM = new ExpensesViewModel(db, Id);
     BugetTabItemVM    = new BudgetViewModel(db, Id);
     PlanTabItemVM     = new PlanViewModel(db, Id);
 }
Example #3
0
 //in repository
 public ExpensesViewModel(FinancesDBContext dbcontext, int Id)
 {
     db      = dbcontext;
     this.Id = Id;
     LoadExpenses();
     AddExpensesCommand    = new RelayCommand(AddExpenses);
     AddCategoryCommand    = new RelayCommand(AddCategory);
     UpdateExpensesCommand = new RelayCommand(UpdateExpenses, CanExecute);
     DeleteExpensesCommand = new RelayCommand(DeleteExpenses, CanExecute);
 }
 //public RelayCommand SPCommand { get; set; }
 //in repository
 public BudgetViewModel(FinancesDBContext dbcontext, int Id)
 {
     db                   = dbcontext;
     this.Id              = Id;
     SPCommand            = new RelayCommand(ExecuteSP);
     ExpensesPeriodSource = new ObservableCollection <ExpensesPeriod>();
     IncomePeriodSource   = new ObservableCollection <IncomePeriod>();
     ExpensesSumSource    = new ObservableCollection <ExpensesSum>();
     IncomeSumSource      = new ObservableCollection <IncomeSum>();
 }
 //in repository
 public IncomeViewModel(FinancesDBContext dbcontext, int Id)
 {
     db      = dbcontext;
     this.Id = Id;
     LoadIncomes();
     AddIncomeCommand    = new RelayCommand(AddIncome);
     UpdateIncomeCommand = new RelayCommand(UpdateIncome, CanExecute);
     DeleteIncomeCommand = new RelayCommand(DeleteIncome, CanExecute);
     AddSourceCommand    = new RelayCommand(AddSource);
 }
        public EditPurchaseViewModel(FinancesDBContext dbContext, Purchase purchase, int Id)
        {
            this.dbContext = dbContext;
            if (purchase != null)
            {
                CurrentPurchase     = purchase;
                ApplyChangesCommand = new RelayCommand(UpdatePurchase, CanExe);
            }
            else
            {
                CurrentPurchase = new Purchase();

                ApplyChangesCommand = new RelayCommand(AddPurchase, CanExe);
            }
            //CurrentPurchase.User = dbContext.User.FirstOrDefault();
            CurrentPurchase.UserId = Id;
        }
Example #7
0
        //in repository
        public PlanViewModel(FinancesDBContext dbcontext, int Id)
        {
            db      = dbcontext;
            this.Id = Id;
            LoadPlan();

            AddPlanIncomeCommand    = new RelayCommand(AddPlanIncome);
            UpdatePlanIncomeCommand = new RelayCommand(UpdatePlanIncome, CanExecutePlanIncome);
            DeletePlanIncomeCommand = new RelayCommand(DeletePlanIncome, CanExecutePlanIncome);

            AddPlanExpensesCommand    = new RelayCommand(AddPlanExpenses);
            UpdatePlanExpensesCommand = new RelayCommand(UpdatePlanExpenses, CanExecutePlanExpenses);
            DeletePlanExpensesCommand = new RelayCommand(DeletePlanExpenses, CanExecutePlanExpenses);

            LoadPurchase();
            AddPurchaseCommand    = new RelayCommand(AddPurchase);
            DeletePurchaseCommand = new RelayCommand(DeletePurchase, CanExecutePurchase);
        }
Example #8
0
        public EditPlanExpensesViewModel(FinancesDBContext dbContext, PlanExpenses plan, int Id)
        {
            this.dbContext   = dbContext;
            PlanCategoryList = dbContext.Category.Local;
            if (plan != null)
            {
                CurrentPlanExpenses = plan;
                ApplyChangesCommand = new RelayCommand(UpdatePlanExpenses, CanExe);
            }
            else
            {
                CurrentPlanExpenses = new PlanExpenses();

                ApplyChangesCommand = new RelayCommand(AddPlanExpenses, CanExe);
            }
            //CurrentPlanExpenses.User = dbContext.User.FirstOrDefault();
            CurrentPlanExpenses.UserId = Id;
        }
        public EditPlanIncomeViewModel(FinancesDBContext dbContext, PlanIncome plan, int Id)
        {
            this.dbContext = dbContext;
            PlanSourceList = dbContext.Source_of_income.Local;
            if (plan != null)
            {
                CurrentPlanIncome   = plan;
                ApplyChangesCommand = new RelayCommand(UpdatePlanIncome, CanExe);
            }
            else
            {
                CurrentPlanIncome = new PlanIncome();

                ApplyChangesCommand = new RelayCommand(AddPlanIncome, CanExe);
            }
            //CurrentPlanIncome.User = dbContext.User.FirstOrDefault();
            CurrentPlanIncome.UserId = Id;
        }
Example #10
0
 public EditExpensesViewModel(FinancesDBContext dbContext, Expenses expenses, int Id)
 {
     this.dbContext        = dbContext;
     ExpensesCategoryList  = dbContext.Category.Local;
     ExpensesNecessityList = dbContext.Necessity.Local;
     if (expenses != null)
     {
         CurrentExpenses     = expenses;
         ApplyChangesCommand = new RelayCommand(UpdateExpenses, CanExe);
     }
     else
     {
         CurrentExpenses      = new Expenses();
         CurrentExpenses.Date = DateTime.Now;
         ApplyChangesCommand  = new RelayCommand(AddExpenses, CanExe);
     }
     //CurrentExpenses.User = dbContext.User.FirstOrDefault();
     CurrentExpenses.LoginId = Id;
 }
Example #11
0
 public CategoryRepository(FinancesDBContext context)
 {
     this.db = context;
 }
 public PlanRepository(FinancesDBContext context)
 {
     this.db = context;
 }
 public IncomeRepository(FinancesDBContext context)
 {
     this.db = context;
 }
 public AddSourceViewModel(FinancesDBContext dbContext)
 {
     this.dbContext      = dbContext;
     CurrentSource       = new Source_of_income();
     ApplyChangesCommand = new RelayCommand(AddSource, CanExe);
 }
Example #15
0
 public PurchaseRepository(FinancesDBContext context)
 {
     this.db = context;
 }
Example #16
0
 public AddCategoryViewModel(FinancesDBContext dbContext)
 {
     this.dbContext      = dbContext;
     CurrentCategory     = new Category();
     ApplyChangesCommand = new RelayCommand(AddCategory, CanExe);
 }
 public DBReposSQL()
 {
     db = new FinancesDBContext();
 }
 public ExpensesRepository(FinancesDBContext context)
 {
     this.db = context;
 }