//HandleFormSubmit private void loginButton_Click(object sender, EventArgs e) { List <string> getData = new List <string>(); DataBase.Database data = new DataBase.Database(); List <string> day = new List <string>(); day = data.CommandSelectSQL("select MAX(dia) from dia where cpf = '" + inputLogin.Text + "';"); getData = data.CommandSelectSQL("select cpf,senha,nome from pessoa where cpf = '" + inputLogin.Text + "' and senha ='" + inputSenha.Text + "'"); if (getData.Count != 0) { Class.UserVar.CPF_LOGIN = getData[0]; Class.UserVar.SENHA_LOGIN = getData[1]; Class.UserVar.TODAY = day[0]; Views.Dashboard userView = new Views.Dashboard(); Welcome_View welcome_View = new Welcome_View(); this.Hide(); this.Closed += (s, args) => welcome_View.Close(); userView.Show(); } else { MessageBox.Show("Login ou Senha Incorretos!", "Seu Login foi mal Sucedido!", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void ButtonCadastrar_Click(object sender, EventArgs e) { Class.UserVar user = new Class.UserVar(); DataBase.Database data = new DataBase.Database(); bool queryDb = data.CommandSQL("UPDATE dia SET tipo_atividade = '" + selectTipo.SelectedItem + "', duracao_atv = '" + inputTempo.Text + "'WHERE cpf ='" + user.Cpf + "' and dia = '" + user.Dia + "';"); if (queryDb) { Register_ATV here = new Register_ATV(); Dashboard there = new Dashboard(); this.Hide(); this.Closed += (s, args) => here.Close(); there.Show(); MessageBox.Show("Alteração Efetuada!", "Muito Obrigado!" , MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } else { MessageBox.Show("Alteração Não Efetuada!", "ERRO!" , MessageBoxButtons.OK, MessageBoxIcon.Error); } }