private void btn_login_Click(object sender, RoutedEventArgs e) { //doing validation //if textboxes are not empty if (tb_username.Text.Length != 0 && tb_username.Text.Length != 0) { //validate user with a boolean method and open the appropriate window with the status of my user if (atm.Authentication(tb_username.Text, Passwrdbox_password.Password)) { switch (ATM.U.Status) { case "Admin": WindowAdmin wa = new WindowAdmin(); wa.Show(); Hide(); break; case "Customer": WindowUsers wc = new WindowUsers(); wc.Show(); Hide(); break; default: MessageBox.Show("A problem just happened. Please try to log in again..."); break; } } else { MessageBox.Show("Your username and your password don't match. Please try again..."); ClearMethod(); tries++; if (tries == 3) { MessageBox.Show("You have tried 3 times already, please try again later!"); } } } else { MessageBox.Show("Your username and your password cannot be empty. Please try again..."); if (tb_username.Text.Length == 0) { tb_username.Focus(); } else { Passwrdbox_password.Focus(); } } }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.Win_Users = ((ATM_Simulator.WindowUsers)(target)); #line 8 "..\..\WindowUsers.xaml" this.Win_Users.Loaded += new System.Windows.RoutedEventHandler(this.Window_Loaded); #line default #line hidden #line 8 "..\..\WindowUsers.xaml" this.Win_Users.Closing += new System.ComponentModel.CancelEventHandler(this.Win_Users_Closing); #line default #line hidden return; case 2: this.grid_main = ((System.Windows.Controls.Grid)(target)); return; case 3: this.image_atm = ((System.Windows.Controls.Image)(target)); return; case 4: this.grbx_key_pad = ((System.Windows.Controls.GroupBox)(target)); return; case 5: this.grid_keypad = ((System.Windows.Controls.Grid)(target)); return; case 6: this.btn_1 = ((System.Windows.Controls.Button)(target)); #line 24 "..\..\WindowUsers.xaml" this.btn_1.Click += new System.Windows.RoutedEventHandler(this.NumberClick); #line default #line hidden return; case 7: this.btn_2 = ((System.Windows.Controls.Button)(target)); #line 25 "..\..\WindowUsers.xaml" this.btn_2.Click += new System.Windows.RoutedEventHandler(this.NumberClick); #line default #line hidden return; case 8: this.btn_3 = ((System.Windows.Controls.Button)(target)); #line 26 "..\..\WindowUsers.xaml" this.btn_3.Click += new System.Windows.RoutedEventHandler(this.NumberClick); #line default #line hidden return; case 9: this.btn_4 = ((System.Windows.Controls.Button)(target)); #line 27 "..\..\WindowUsers.xaml" this.btn_4.Click += new System.Windows.RoutedEventHandler(this.NumberClick); #line default #line hidden return; case 10: this.btn_5 = ((System.Windows.Controls.Button)(target)); #line 28 "..\..\WindowUsers.xaml" this.btn_5.Click += new System.Windows.RoutedEventHandler(this.NumberClick); #line default #line hidden return; case 11: this.btn_6 = ((System.Windows.Controls.Button)(target)); #line 29 "..\..\WindowUsers.xaml" this.btn_6.Click += new System.Windows.RoutedEventHandler(this.NumberClick); #line default #line hidden return; case 12: this.btn_7 = ((System.Windows.Controls.Button)(target)); #line 30 "..\..\WindowUsers.xaml" this.btn_7.Click += new System.Windows.RoutedEventHandler(this.NumberClick); #line default #line hidden return; case 13: this.btn_8 = ((System.Windows.Controls.Button)(target)); #line 31 "..\..\WindowUsers.xaml" this.btn_8.Click += new System.Windows.RoutedEventHandler(this.NumberClick); #line default #line hidden return; case 14: this.btn_9 = ((System.Windows.Controls.Button)(target)); #line 32 "..\..\WindowUsers.xaml" this.btn_9.Click += new System.Windows.RoutedEventHandler(this.NumberClick); #line default #line hidden return; case 15: this.btn_0 = ((System.Windows.Controls.Button)(target)); #line 33 "..\..\WindowUsers.xaml" this.btn_0.Click += new System.Windows.RoutedEventHandler(this.NumberClick); #line default #line hidden return; case 16: this.btn_dot = ((System.Windows.Controls.Button)(target)); #line 34 "..\..\WindowUsers.xaml" this.btn_dot.Click += new System.Windows.RoutedEventHandler(this.NumberClick); #line default #line hidden return; case 17: this.grbx_select_transaction = ((System.Windows.Controls.GroupBox)(target)); return; case 18: this.rdbtn_deposit = ((System.Windows.Controls.RadioButton)(target)); return; case 19: this.rdbtn_withdrawal = ((System.Windows.Controls.RadioButton)(target)); return; case 20: this.rdbtn_pay_bill = ((System.Windows.Controls.RadioButton)(target)); return; case 21: this.rdbtn_transfer_funds = ((System.Windows.Controls.RadioButton)(target)); return; case 22: this.grbx_select_account = ((System.Windows.Controls.GroupBox)(target)); return; case 23: this.rdbtn_checking = ((System.Windows.Controls.RadioButton)(target)); return; case 24: this.rdbtn_savings = ((System.Windows.Controls.RadioButton)(target)); return; case 25: this.btn_submit = ((System.Windows.Controls.Button)(target)); #line 58 "..\..\WindowUsers.xaml" this.btn_submit.Click += new System.Windows.RoutedEventHandler(this.btn_submit_Click); #line default #line hidden return; case 26: this.btn_close = ((System.Windows.Controls.Button)(target)); #line 59 "..\..\WindowUsers.xaml" this.btn_close.Click += new System.Windows.RoutedEventHandler(this.btn_close_Click); #line default #line hidden return; case 27: this.btn_clear = ((System.Windows.Controls.Button)(target)); #line 60 "..\..\WindowUsers.xaml" this.btn_clear.Click += new System.Windows.RoutedEventHandler(this.btn_clear_Click); #line default #line hidden return; case 28: this.tb_amount_keypad = ((System.Windows.Controls.TextBox)(target)); return; case 29: this.lbl_welcome = ((System.Windows.Controls.Label)(target)); return; case 30: this.lbl_check_display = ((System.Windows.Controls.Label)(target)); return; case 31: this.tb_check_display = ((System.Windows.Controls.TextBox)(target)); return; case 32: this.lbl_sav_display = ((System.Windows.Controls.Label)(target)); return; case 33: this.tb_sav_display = ((System.Windows.Controls.TextBox)(target)); return; case 34: this.atm_icon_800x600_png = ((System.Windows.Controls.Image)(target)); return; } this._contentLoaded = true; }