Ejemplo n.º 1
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            string comando = @"select nome from usuarios where login = "******"'{0}'", edtLogin.Text) + " and senha  = " + string.Format("'{0}'", edtSenha.Text);
            var    usuario = DB.Comandos.ConsultaValor(comando);

            if (DateTime.Now.Date > Convert.ToDateTime("2017-11-01"))
            {
                MessageBox.Show("Licença expirada, contate o desenvolvedor!", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Application.Exit();
            }


            if (usuario.Rows.Count > 0)
            {
                loginValido = true;

                this.Hide();
                frmMenu fMenu = new frmMenu(usuario.Rows[0]["NOME"].ToString());
                fMenu.ShowDialog();
                this.Close();
            }
            else
            {
                MessageBox.Show("Senha ou usuário inválidos!", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 2
0
        private void btnEntrar_Click(object sender, EventArgs e)
        {
            using (sistema_ventasEntities db = new sistema_ventasEntities())
            {
                var lista = from usuario in db.tb_usuarios
                            where usuario.Email == txtUsuario.Text &&
                            usuario.Contrasena == txtContraseña.Text
                            select new { ID = usuario.Id };

                if (lista.Count() > 0)
                {
                    foreach (var iterar in lista)
                    {
                        frmMenu.V.txtIdUsuario.Text = iterar.ID.ToString();
                        frmMenu.V.txtUsuario.Text   = txtUsuario.Text;
                    }
                    frmMenu menu = new frmMenu();
                    menu.ShowDialog();
                    this.Close();
                }
                else
                {
                    MessageBox.Show("El usuario no es valido");
                }
            }
        }
Ejemplo n.º 3
0
        private void sairToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.Hide();
            frmMenu menu = new frmMenu();

            menu.ShowDialog();
        }
Ejemplo n.º 4
0
        private void btnMenu_Click(object sender, EventArgs e)
        {
            frmMenu frmm = new frmMenu();

            this.Hide();
            frmm.ShowDialog();
        }
Ejemplo n.º 5
0
        private void cmdAdd_Click(object sender, EventArgs e)
        {
            A        = new Aluno();
            ctrAluno = new ctrAluno();

            A.Nome     = txtNome.Text;
            A.Idade    = Convert.ToInt32(txtIdd.Text);
            A.RA       = Convert.ToInt32(txtRa.Text);
            A.senha    = txtSenha.Text;
            A.Telefone = Convert.ToInt32(txtPhone.Text);
            A.Turma    = txtTurma.Text;
            A.DataNasc = txtDataNasc.Text;
            A.Endereco = txtEndereco.Text;
            A.cpf_resp = Cpf_resp;


            ctrAluno.Adicionar(A);

            MessageBox.Show("Cadastrado com Sucesso", "MIDAYV");

            this.Hide();
            this.Close();

            frmMenu menu = new frmMenu();

            menu.ShowDialog();
        }
Ejemplo n.º 6
0
        private void btn_Entrar_Click(object sender, EventArgs e)
        {
            try
            {
                tblClienteDTO objCliente = new tblClienteDTO();
                objCliente.Login = txt_Login.Text.Trim();
                objCliente.Senha = txt_Senha.Text.Trim();
                this.Visible     = false;

                tblClienteBLL bllCliente = new tblClienteBLL();
                if (bllCliente.Autenticar(objCliente.Login, objCliente.Senha))
                {
                    MessageBox.Show("Usuário Localizado", "Sucesso!", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    frmMenu dados = new frmMenu();
                    dados.ShowDialog();
                    this.Visible = true;
                    this.Hide();
                }
                else
                {
                    MessageBox.Show("Usuário Não Localizado", "Falho!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    this.Visible = true;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Erro: " + ex.Message, "Erro!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void pbHome_Click(object sender, EventArgs e)
        {
            this.Hide();
            frmMenu nextScreen = new frmMenu();

            nextScreen.ShowDialog();
            this.Dispose();
        }
Ejemplo n.º 8
0
 private void textBox1_TextChanged(object sender, EventArgs e)
 {
     if (textBox1.Text == "1")
     {
         frmMenu x = new frmMenu();
         x.ShowDialog();
     }
 }
Ejemplo n.º 9
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            validateLogin();

            if (!IsValidEmail(txtLoginEmail.Text))
            {
                MessageBox.Show("Bạn cần nhập email");
                return;
            }

            if (validateLogin() == true && IsValidEmail(txtLoginEmail.Text) == true)
            {
                //Tạo MD5
                MD5 mh = MD5.Create();
                //Chuyển kiểu chuổi thành kiểu byte
                byte[] inputBytes = System.Text.Encoding.ASCII.GetBytes(txtLoginMK.Text);
                //mã hóa chuỗi đã chuyển
                byte[] hash = mh.ComputeHash(inputBytes);
                //tạo đối tượng StringBuilder (làm việc với kiểu dữ liệu lớn)
                StringBuilder sb = new StringBuilder();

                for (int i = 0; i < hash.Length; i++)
                {
                    sb.Append(hash[i].ToString("X2"));
                }

                DataTable dt = new DataTable();
                dt = dtbase.DataReader("select email, matKhau from TAIKHOAN where" +
                                       " email = '" + txtLoginEmail.Text +
                                       "' and matKhau = '" + sb.ToString() + "'");
                if (dt.Rows.Count > 0)
                {
                    MessageBox.Show("Dang nhap thanh cong");
                    dt = dtbase.DataReader("select * " +
                                           "from taikhoan " +
                                           "inner join nhanvien " +
                                           "on nhanvien.idNV = TAIKHOAN.idNV " +
                                           "where email = '" + txtLoginEmail.Text + "'");
                    username = dt.Rows[0]["hoTenNV"].ToString();

                    role = dt.Rows[0]["chucVu"].ToString();
                    idNV = dt.Rows[0]["idNV"].ToString();

                    txtLoginMK.Text    = "";
                    txtLoginEmail.Text = "";
                    frmMenu1           = new frmMenu(username, role, idNV);

                    this.Hide();
                    frmMenu1.ShowDialog();
                    this.Show();
                }
                else
                {
                    MessageBox.Show("Tên đăng nhập hoặc mật khẩu không đúng");
                    txtLoginEmail.Focus();
                }
            }
        }
Ejemplo n.º 10
0
        private void pictureBox1_Click(object sender, EventArgs e)
        {
            //Form Hidden, New Form opened, Current Resources Disposed of
            this.Dispose();
            this.Hide();
            frmMenu nextScreen = new frmMenu();

            nextScreen.ShowDialog();
        }
Ejemplo n.º 11
0
        private void pictureBox1_Click(object sender, EventArgs e)
        {
            //When the user clicks the home button picture it Hides the current form and opens
            //the Menu form before closing all resources from this form
            this.Hide();
            frmMenu nextScreen = new frmMenu();

            nextScreen.ShowDialog();
            Close();
        }
Ejemplo n.º 12
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (this.VERIFICA_USUARIO_PASSWORD())
     {
         this.Hide();
         frmMenu miVentana = new frmMenu();
         miVentana.ShowDialog();
         miVentana.Dispose();
     }
 }
Ejemplo n.º 13
0
        public Login()
        {
            InitializeComponent();
            UsuarioController uc = new UsuarioController();
            DataTable         dt = uc.existeUsuario();

            if (dt == null || dt.Rows.Count == 0)
            {
                this.Hide();
                frmMenu menu = new frmMenu(dt);
                menu.ShowDialog();
            }
        }
Ejemplo n.º 14
0
        private void btningreso_Click(object sender, EventArgs e)
        {
            if (this.VERIFICA_USUARIO_PASSWORD())
            {
                MessageBox.Show("Ingreso correcto");

                this.Hide();



                frmMenu miVentana = new frmMenu();

                miVentana.ShowDialog();
            }
        }
Ejemplo n.º 15
0
 private void btnEfetuarLogin_Click(object sender, EventArgs e)
 {
     try
     {
         Hide();
         using (frmMenu menu = new frmMenu())
         {
             menu.ShowDialog();
         }
     }
     catch
     {
     }
     finally
     {
     }
 }
Ejemplo n.º 16
0
        private void btnEntrar_Click(object sender, EventArgs e)
        {
            using (sistema_ventasEntities db = new sistema_ventasEntities()) {
                var lista = from usuario in db.tb_usuarios
                            where usuario.Email == txtUsuario.Text &&
                            usuario.Contrasena == txtContra.Text
                            select usuario;

                if (lista.Count() > 0)
                {
                    frmMenu menu = new frmMenu();
                    menu.ShowDialog();
                    this.Hide();
                }
                else
                {
                    MessageBox.Show("El Usuario no existe");
                }
            }
        }
Ejemplo n.º 17
0
        private void cmdLogin_Click(object sender, EventArgs e)
        {
            if (txtLogin.Text == "admin" && txtPass.Text == "admin")
            {
                MessageBox.Show("Bem Vindo Admin", "MIDAYV");

                this.Hide();
                frmMenu menu = new frmMenu();
                menu.ShowDialog();
            }
            else if (txtLogin.Text != "midayv" && txtPass.Text != "tis")
            {
                MessageBox.Show("Erro : Usuário Inválido", "MIDAYV: Erro !!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }


            if (txtLogin.Text == "" && txtPass.Text == "")
            {
                MessageBox.Show("Dados Inválidos", "Erro !!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 18
0
        private void btnEntrar_Click_1(object sender, EventArgs e)
        {
            UsuarioController uc = new UsuarioController();

            DataTable usuarioLogado = uc.realizaLogin(ttbUsuario.Text, ttbSenha.Text);

            if (usuarioLogado != null && usuarioLogado.Rows.Count > 0)
            {
                DataRow dr     = usuarioLogado.Rows[0];
                int     codigo = Convert.ToInt32(dr["codusuario"]);
                uc.usuarioLogado(codigo, codigo);
                this.Hide();
                frmMenu menu = new frmMenu(usuarioLogado);
                menu.ShowDialog();
            }
            else
            {
                MessageBox.Show("Login ou senha incorretos!");
                ttbSenha.Text = "";
            }
        }
Ejemplo n.º 19
0
        private void sairToolStripMenuItem_Click(object sender, EventArgs e)
        {
            R       = new Responsavel();
            ctrResp = new ctrResponsavel();

            Limpar_Obj limpar = new Limpar_Obj();

            limpar.Limpar_Campos(this);

            R.CPF_1 = Cpf_resp;

            DialogResult confirm = MessageBox.Show("Isso ira apagar os dados de responsavel cadastrados anteriormente, deseja sair?", "Deseja Sair?", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button2);

            if (confirm.ToString().ToUpper() == "YES")
            {
                ctrResp.Excluir(R);
            }

            this.Hide();
            frmMenu menu = new frmMenu();

            menu.ShowDialog();
        }
        private void BtnLogin_Click(object sender, EventArgs e)
        {
            //Creates a connection to the sql Database using the connection string and uses the query string
            //to execute the command and retrieve data from the Database.
            //It then uses a Data Reader To retrieve the data and therefore check against user inputed
            //Data
            try {
                string _Connectionstring = @"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\MitchellMusicDB.mdf;Integrated Security=True";

                using (SqlConnection connection = new SqlConnection(_Connectionstring))
                {
                    connection.Open();
                    string     sqlQuery      = string.Format("SELECT * FROM Login where Username = '******' AND Password ='******'", tbUsername.Text, tbPassword.Text);
                    SqlCommand insertCommand = new SqlCommand(sqlQuery, connection);

                    SqlDataReader dr = insertCommand.ExecuteReader();
                    //Retrieves data from database and writes them to Local Variable
                    //Checks whether the user inputted the correct username and password
                    //To Access the program
                    if (dr.Read())
                    {
                        string username = dr[1].ToString();
                        string password = dr[2].ToString();

                        if (tbUsername.Text == username)
                        {
                            if (tbPassword.Text == password)
                            {
                                Hide();
                                AdminPassword = password;
                                frmMenu a = new frmMenu();
                                add.showBalloonTip("Success", "Successfully Logged on");
                                a.ShowDialog();
                                dr.Close();
                            }
                            //If the user used incorrect Details it displays a Balloon Notification but
                            //if clicked multiple times it will only display one balloon tip
                            else
                            {
                                if (count < 1)
                                {
                                    add.showBalloonTip("Unsuccessful", "Could Not Login!");
                                }
                                count++;
                                dr.Close();
                            }
                        }
                        else
                        {
                            if (count1 < 1)
                            {
                                add.showBalloonTip("Unsuccessful", "Could Not Login!");
                            }
                            count1++;
                            dr.Close();
                        }
                        dr.Close();
                    }
                    else
                    {
                        if (count2 < 1)
                        {
                            add.showBalloonTip("Unsuccessful", "Could Not Login!");
                        }
                        count2++;
                        dr.Close();
                    }


                    connection.Dispose();
                    connection.Close();
                }
            }
            //If Try Catch catches any error it will display a balloon notification aslong as it has
            //not already done so in this instance of the form.
            //It then Writes the error on a new line in a Error Log Text File. Before adding 1 to the Counter
            catch (Exception ex)
            {
                if (count < 1)
                {
                    add.showBalloonTip("Error", "Something Went Wrong");
                }
                System.IO.StreamWriter writer = new System.IO.StreamWriter("../../ErrorLog.txt", true);
                writer.WriteLine("- " + DateTime.Now + " " + ex.Message, true);
                writer.Flush();
                writer.Close();
                count++;
            }
        }
Ejemplo n.º 21
0
        public void DrowMenuWindow(IGame game)
        {
            var menu = new frmMenu(game);

            menu.ShowDialog();
        }
Ejemplo n.º 22
0
        private void btnformNhansu_Click(object sender, EventArgs e)
        {
            frmMenu frmMENU = new frmMenu();

            frmMENU.ShowDialog();
        }
Ejemplo n.º 23
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            try
            {
                banco = Db4oFactory.OpenFile(caminhoBanco);
            }
            catch
            {
            }
            finally
            {
            }

            if (validarCampos())
            {
                Usuario usuario = new Usuario();
                usuario.usuario = txtUsuario.Text;

                IObjectSet procurar = banco.QueryByExample(usuario);
                if (procurar.HasNext())
                {
                    usuario = (Usuario)procurar.Next();

                    MD5           md5      = MD5.Create();
                    string        senha    = txtSenha.Text; //oq o usuario digitou
                    byte[]        hasheada = md5.ComputeHash(Encoding.UTF8.GetBytes(senha));
                    StringBuilder stB      = new StringBuilder();
                    for (int i = 0; i < hasheada.Length; i++)
                    {
                        stB.Append(hasheada[i].ToString("x2")); // hexa
                    }

                    senha = stB.ToString();
                    //MessageBox.Show(senha);

                    if (usuario.senha.Equals(senha))
                    {
                        //Abrir o menu aqui

                        banco.Close();
                        this.Hide();
                        frmMenu formMenu = new frmMenu(usuario, DarkTheme);
                        formMenu.ShowDialog();
                        if (formMenu.reiniciarSMTP())
                        {
                            banco = Db4oFactory.OpenFile(caminhoBanco);
                            btnLogin_Click(null, null);
                            reiniciou = true;
                        }
                        cboxDarkTheme.Checked = formMenu.TemaEscuro();
                        this.Show();
                        metodos.abreFechaBanco(banco);
                    }
                    else
                    {
                        /*
                         * MessageBox.Show("Senha incorreta!", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                         */
                        MessageBox.ShowMessageBoxOK("Warning", "Senha incorreta!", "Aviso", DarkTheme);
                    }
                }
                else
                {
                    /*
                     * MessageBox.Show("Usuário não cadastrado!", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                     */
                    MessageBox.ShowMessageBoxOK("Warning", "Usuário não cadastrado!", "Aviso", DarkTheme);
                }
            }
        }