private void MainMenu_Click(object sender, RoutedEventArgs e)
        {
            this.Visibility = Visibility.Hidden;
            var mw = new QSync.MainWindow();

            mw.Show();
        }
示例#2
0
 private void LoginBtn1_Click(object sender, RoutedEventArgs e)
 {
     Analytics.TrackEvent("Login - Login Attempt");
     using (var context = new AbleDBEntity())
     {
         // Load all staff who are current ONLY
         var cudb = context.staffs.Where(a => a.GrantAccess == 1)
                    .ToList();
         var user = cudb.Where(i => i.UserName == this.txtUserName.Text).FirstOrDefault();
         if (user == null)
         {
             Analytics.TrackEvent("Login - Incorrect Username Entry");
             MessageBox.Show("Please check your Username (this is your email address) is correct - Remember usernames are case sensitive", "USERNAME Incorrect");
         }
         else if (this.txtUserName.Text == user.UserName && this.txtPassword.Password == user.Password)
         {
             Analytics.TrackEvent("Login - Successful Login to QSync");
             Properties.Settings.Default.MyUser      = txtUserName.Text;
             Properties.Settings.Default.Name        = user.Name;
             Properties.Settings.Default.Accesslevel = user.QSyncAccess;
             Properties.Settings.Default.Qid         = user.QuoteID;
             Properties.Settings.Default.Save();
             string currentUser     = txtUserName.Text;
             string passAccessLevel = user.QSyncAccess;
             string passName        = user.Name;
             string currentQid      = user.QuoteID;
             var    Home            = new QSync.MainWindow(currentUser, passAccessLevel, passName, currentQid);
             Home.DataContext = this;
             this.Visibility  = Visibility.Hidden;
             Home.Show();
         }
         else
         {
             Analytics.TrackEvent("Login - Incorrect Password Entry");
             MessageBox.Show("Please check your password is correct - Remember passwords are case sensitive", "PASSWORD Incorrect");
         }
     }
 }