private void btnLogin_Click(object sender, RoutedEventArgs e) { try { string username = txtUserName.Text; User user = UserBLL.GetUserByUName(username); if (user != null && user.Password.Equals(txtPassword.Text)) { if (!user.Role) { CurUser = user; StaffForm sf = new StaffForm(user); sf.Show(); this.Close(); // Application.Current. } else if (user.Role) { CurUser = user; AdminForm af = new AdminForm(user); af.Show(); this.Close(); } } else { lblMessage.Visibility = Visibility.Visible; lblMessage.IsEnabled = true; lblMessage.Content = "Username/Password is wrong"; } } catch(Exception g) { System.Windows.Forms.MessageBox.Show(g.Message); } }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.frmAdmin = ((FastDeliveryGroup.Presentation.AdminForm.AdminForm)(target)); return; case 2: #line 11 "..\..\..\..\Presentation\AdminForm\AdminForm.xaml" ((System.Windows.Controls.Grid)(target)).Loaded += new System.Windows.RoutedEventHandler(this.Grid_Loaded); #line default #line hidden return; case 3: this.lbxTab = ((System.Windows.Controls.ListBox)(target)); #line 12 "..\..\..\..\Presentation\AdminForm\AdminForm.xaml" this.lbxTab.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.lbxTab_SelectionChanged); #line default #line hidden return; case 4: this.pnlUserControl = ((System.Windows.Controls.StackPanel)(target)); return; } this._contentLoaded = true; }
private void ShowAdminForm() { AdminForm af = new AdminForm(CurUser); af.Show(); }