private void ListViewMenu_SelectionChanged(object sender, SelectionChangedEventArgs e) { UserControl usc = null; GridMain.Children.Clear(); switch (((ListViewItem)((ListView)sender).SelectedItem).Name) { case "AlugarCarro": Cliente c = new Cliente(); c.Cpf = Parameter; c = ClienteDAO.Get(c); if ((c.CategoriaCnh.Equals("B") || c.CategoriaCnh.Equals("AB")) && c.PossuiReserva.Equals("NAO")) { usc = new usAlugaCarro(Parameter); GridMain.Children.Add(usc); } else { MessageBox.Show("Sua Categoria Só Permite Aluguel De Motos!!" + " ou Você ja possui um veiculo alugado!", "LocadoraWPF", MessageBoxButton.OK, MessageBoxImage.Warning); frmMenuCliente f = new frmMenuCliente(Parameter); f.ShowDialog(); Close(); } break; case "AlugarMoto": c = new Cliente(); c.Cpf = Parameter; c = ClienteDAO.Get(c); if ((c.CategoriaCnh.Equals("A") || c.CategoriaCnh.Equals("AB")) && c.PossuiReserva.Equals("NAO")) { usc = new usAlugarMoto(Parameter); GridMain.Children.Add(usc); } else { MessageBox.Show("Sua Categoria Só Permite Aluguel De Carros!!" + " ou Você ja possui um veiculo alugado!", "LocadoraWPF", MessageBoxButton.OK, MessageBoxImage.Warning); frmMenuCliente f = new frmMenuCliente(Parameter); f.ShowDialog(); Close(); } break; case "Devolucao": usc = new usDevolucao(Parameter); GridMain.Children.Add(usc); break; default: break; } }
private void BtnLogin_Click(object sender, RoutedEventArgs e) { try { Administrador adm = new Administrador(); Cliente cliente = new Cliente(); cliente.Cpf = txtLogin.Text; cliente.Senha = txtSenha.Password; if (ClienteDAO.AutenticarLogin(cliente)) { if (ClienteDAO.ConfereStatus(cliente)) { txtLogin.Clear(); txtSenha.Clear(); frmMenuCliente index = new frmMenuCliente(cliente.Cpf); index.Parameter = cliente.Cpf; index.ShowDialog(); } else { MessageBox.Show("Sua conta foi cancela!! \n Para Ativa-la novamente contate o administrador.", "LocadoraWPF", MessageBoxButton.OK, MessageBoxImage.Information); } } else if (cliente.Cpf.ToUpper().Equals(adm.Login) && cliente.Senha.ToUpper().Equals(adm.Senha)) { txtLogin.Clear(); txtSenha.Clear(); frmMenuAdm index = new frmMenuAdm(); index.ShowDialog(); } else { MessageBox.Show("Login ou Senha Incorretos!!", "LocadoraWPF", MessageBoxButton.OK, MessageBoxImage.Exclamation); } } catch (Exception ex) { MessageBox.Show(ex.ToString(), "LocadoraWPF", MessageBoxButton.OK, MessageBoxImage.Error); } }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.pgLoad = ((LocadoraWpf.Views.Frm.frmMenuCliente)(target)); return; case 2: this.GridMain = ((System.Windows.Controls.Grid)(target)); return; case 3: this.btnAlterarDados = ((System.Windows.Controls.Button)(target)); #line 54 "..\..\..\..\Views\Frm\frmMenuCliente.xaml" this.btnAlterarDados.Click += new System.Windows.RoutedEventHandler(this.BtnAlterarDados_Click); #line default #line hidden return; case 4: this.btnExcluirConta = ((System.Windows.Controls.Button)(target)); #line 55 "..\..\..\..\Views\Frm\frmMenuCliente.xaml" this.btnExcluirConta.Click += new System.Windows.RoutedEventHandler(this.BtnExcluirConta_Click); #line default #line hidden return; case 5: this.btnLogout = ((System.Windows.Controls.Button)(target)); #line 57 "..\..\..\..\Views\Frm\frmMenuCliente.xaml" this.btnLogout.Click += new System.Windows.RoutedEventHandler(this.BtnLogout_Click); #line default #line hidden return; case 6: this.GridMenu = ((System.Windows.Controls.Grid)(target)); return; case 7: this.ButtonOpenMenu = ((System.Windows.Controls.Button)(target)); #line 90 "..\..\..\..\Views\Frm\frmMenuCliente.xaml" this.ButtonOpenMenu.Click += new System.Windows.RoutedEventHandler(this.ButtonOpenMenu_Click); #line default #line hidden return; case 8: this.ButtonCloseMenu = ((System.Windows.Controls.Button)(target)); #line 100 "..\..\..\..\Views\Frm\frmMenuCliente.xaml" this.ButtonCloseMenu.Click += new System.Windows.RoutedEventHandler(this.ButtonCloseMenu_Click); #line default #line hidden return; case 9: this.ListViewMenu = ((System.Windows.Controls.ListView)(target)); #line 106 "..\..\..\..\Views\Frm\frmMenuCliente.xaml" this.ListViewMenu.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.ListViewMenu_SelectionChanged); #line default #line hidden return; case 10: this.AlugarCarro = ((System.Windows.Controls.ListViewItem)(target)); return; case 11: this.AlugarMoto = ((System.Windows.Controls.ListViewItem)(target)); return; case 12: this.Devolucao = ((System.Windows.Controls.ListViewItem)(target)); return; } this._contentLoaded = true; }