public Authorization() { InitializeComponent(); PlannerDataBaseContext aut = PlannerDataBaseContext.GetPlannerBaseContext(); //aut.Database.Delete(); aut.Database.Initialize(false); StaticFrame.Frame = frame; authorization = this; }
public UserViewModel() { StaticUserViewModel = this; dataBase = PlannerDataBaseContext.GetPlannerBaseContext(); user = new User("Name", "Email", "Login", "Password"); staticUser = user; //user.DefaultUser = new User("Name", "Email", "Login", "Password"); //user.PlaceHolder = new User("Name", "Email", "Login", "Password"); //user.PlaceHolder.isPlaceHolder = true; ConfirmPassword = "******"; }
public YearPlansViewModel() { YearPlans = this; ThisUser = UserViewModel.GetUser(); newYearPlans = new ObservableCollection <YearPlans>(); dataBase = PlannerDataBaseContext.GetPlannerBaseContext(); //plansYear = new ObservableCollection<YearPlans>(); foreach (YearPlans dp in dataBase.YearPlans.Where(p => p.User.UserId == ThisUser.UserId).AsEnumerable()) { newYearPlans.Add(dp); } }
public DailyPlansViewModel() { DailyPlans = this; ThisUser = UserViewModel.GetUser(); NewTaskDateTime = DateTime.Now; oneDayPlans = new ObservableCollection <DailyPlans>(); newDayPlans = new ObservableCollection <DailyPlans>(); dataBase = PlannerDataBaseContext.GetPlannerBaseContext(); dayInfos = new ObservableCollection <DayInfo>(); foreach (DayInfo di in dataBase.DayInfo.Where(p => p.User.UserId == ThisUser.UserId).AsEnumerable()) { dayInfos.Add(di); } plans = new ObservableCollection <DailyPlans>(); foreach (DailyPlans dp in dataBase.DailyPlans.Where(p => p.User.UserId == ThisUser.UserId).AsEnumerable()) { plans.Add(dp); } //dayInfos = new ObservableCollection<DayInfo>(); //foreach (DayInfo di in dataBase.DayInfo.Where(p => p.User == null)) //{ // dayInfos.Remove(di); //} //plans = new ObservableCollection<DailyPlans>(); //foreach (DailyPlans dp in dataBase.DailyPlans.Where(p => p.User == null)) //{ // plans.Remove(dp); //} foreach (DailyPlans dp in plans) { if (dp.DateFrom.Value.Date.Equals(DateTime.Today.Date)) { oneDayPlans.Add(dp); newDayPlans.Add(dp); } } }
public LoginPasswordViewModel() { loginpassword = this; ThisUser = UserViewModel.GetUser(); dataBase = PlannerDataBaseContext.GetPlannerBaseContext(); //loginPassword = new LoginPassword("Name", "Email", "Login"); LoginPasswords = new ObservableCollection <LoginPassword>(); foreach (LoginPassword lp in dataBase.LoginPasswords.Where(lp => lp.User.UserId == ThisUser.UserId).AsEnumerable()) { LoginPasswords.Add(lp); } LoginPassword = new LoginPassword(ThisUser); loginPasswords.Add(LoginPassword); dataBase.LoginPasswords.Add(LoginPassword); dataBase.SaveChanges(); }
public WeekViewModel() { dailyPlansViewModel = DailyPlansViewModel.DailyPlans; ThisUser = dailyPlansViewModel.ThisUser; WeekDateTime = DateTime.Now; mondayPlans = new ObservableCollection <DailyPlans>(); tuesdayPlans = new ObservableCollection <DailyPlans>(); wednesdayPlans = new ObservableCollection <DailyPlans>(); thursdayPlans = new ObservableCollection <DailyPlans>(); fridayPlans = new ObservableCollection <DailyPlans>(); weekendPlans = new ObservableCollection <DailyPlans>(); dataBase = PlannerDataBaseContext.GetPlannerBaseContext(); WeekPriorities = new ObservableCollection <WeekPriority>(); foreach (WeekPriority wp in dataBase.WeekPriorities.Where(wp => wp.User.UserId == ThisUser.UserId)) { WeekPriorities.Add(wp); } //WeekDateTime = WeekDateTime; }