public Principal(FuncionarioClass funcLogado) { InitializeComponent(); Principal.funcLogado = funcLogado; objForm = new Form[] { new SubForms.FuncionarioTable(pnlPrincipal), new SubForms.ClienteTable(pnlPrincipal), new SubForms.AnimalTable(pnlPrincipal), new SubForms.ServicoTable(pnlPrincipal), new SubForms.AgendExecTable(pnlPrincipal), new SubForms.Relatorios() }; botoes = new Button[] { btnFuncionario, btnCliente, btnAnimal, btnServico, btnAgendamento, btnRelatorio }; for (int i = 0; i < botoes.Length; i++) { int num = i; botoes[num].Click += (sender, e) => atualizar(sender, e, num); } atualizar(); if (funcLogado.codTipo != 1) { btnFuncionario.Hide(); } }
private void btnEntrar_Click(object sender, EventArgs e) { FuncionarioClass objFunc = new FuncionarioClass(); DataTable tablefuncs = objFunc.retFuncionarios(); for (int i = 0; i < tablefuncs.Rows.Count; i++) { if (txtEmail.Text == tablefuncs.Rows[i]["email"].ToString() && txtSenha.Text == tablefuncs.Rows[i]["senha"].ToString()) { objFunc.codFunc = tablefuncs.Rows[i]["codFuncionario"].ToString(); objFunc.codTipo = int.Parse(tablefuncs.Rows[i]["codTipo"].ToString()); Principal principal = new Principal(objFunc); principal.Show(); principal.Location = Location; principal.WindowState = WindowState; Hide(); } } }
private void button1_Click(object sender, EventArgs e) { FuncionarioClass objFunc = new FuncionarioClass(); DataTable tablefuncs = objFunc.retFuncionarios(); string senha = ""; for (int i = 0; i < tablefuncs.Rows.Count; i++) { if (tablefuncs.Rows[i]["email"].ToString() == txtRecEmail.Text) { senha = tablefuncs.Rows[i]["senha"].ToString(); } } try { var client = new SmtpClient("smtp.gmail.com", 587) { Credentials = new NetworkCredential("*****@*****.**", "adminfabrica"), EnableSsl = true }; object a = true; client.SendAsync("*****@*****.**", txtRecEmail.Text, "Recuperação de senha", "Sua senha é " + senha, a); } catch { throw; } }