public void OpenDashboard() { if (_main == null) { _main = new Main(); } rootFrame.Navigate(_main); }
public MainController(Views.Main MainForm) { form = MainForm; }
public Login_ViewModel() { IsActive = false; CloseAlert_Command = new RelayCommand <object>(x => { return(true); }, x => { IsActive = false; }); #region login GetPassLogin_Command = new RelayCommand <PasswordBox>(x => { return(true); }, x => { if (!String.IsNullOrEmpty(x.Password)) { Password = x.Password; } }); Login_Command = new RelayCommand <Button>(p => { if (String.IsNullOrEmpty(UserName) || String.IsNullOrEmpty(Password)) { return(false); } return(true); }, p => { var list = new List <Models.User>(Models.DataProvider.Ins.DB.Users); if (list.Where(x => x.acc == UserName && x.pass == MyStaticMethods.MD5Hash(Password)).Count() != 0) { Models.User user = list.Where(x => x.acc == UserName && x.pass == MyStaticMethods.MD5Hash(Password)).SingleOrDefault(); if (user.user_role == 0) { if (chkLoginTime(user) == false) { IsActive = true; Message = "Tài khoản không được phân ca trực"; } else { CurrentUser = user; Views.Main view = new Views.Main(); view.Show(); Window wd = MyStaticMethods.getWindowParent(p) as Window; if (wd != null) { wd.Close(); } resetData(); } } else { CurrentUser = user; Views.Main view = new Views.Main(); view.Show(); Window wd = MyStaticMethods.getWindowParent(p) as Window; if (wd != null) { wd.Close(); } resetData(); } } else { IsActive = true; Message = "Sai tên đăng nhập hoặc mật khẩu"; } }); CloseLoginform_Command = new RelayCommand <object>(p => { return(true); }, p => { Application.Current.Shutdown(); }); #endregion }