Example #1
0
        private void button7_Click(object sender, EventArgs e)
        {
            OdbcConnection conexion = TaquillaDB.getDB();

            try
            {
                string         sql    = string.Format("SELECT * FROM USUARIO WHERE USU_USUARIO = '{0}'", Txt_loginUser.Text);
                OdbcCommand    cmd    = new OdbcCommand(sql, conexion);
                OdbcDataReader reader = cmd.ExecuteReader();
                if (reader.Read())
                {
                    conexion.Close();
                    conexion = TaquillaDB.getDB();
                    sql      = string.Format("SELECT * FROM USUARIO WHERE USU_USUARIO = '{0}' AND PASS_USUARIO = MD5('{1}');", Txt_loginUser.Text, Txt_loginPass.Text);
                    cmd      = new OdbcCommand(sql, conexion);
                    reader   = cmd.ExecuteReader();
                    if (reader.Read())
                    {
                        if (reader.GetInt32(2) == 0)
                        {
                            OdbcConnection cnx = TaquillaDB.getDB();
                            sql = string.Format("INSERT INTO BITACORA VALUES (NULL, 'LOG IN', NOW(), '{0}', USER());", Txt_loginUser.Text);
                            OdbcCommand cm = new OdbcCommand(sql, cnx);
                            cm.ExecuteNonQuery();
                            Txt_loginUser.Text = "";
                            Txt_loginPass.Text = "";
                            frm_main nuevo = new frm_main(this);
                            this.Hide();
                            nuevo.Show();
                        }
                        else
                        {
                            MessageBox.Show("Falta de privilegios!!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            Txt_loginUser.Text = "";
                            Txt_loginUser.Focus();
                        }
                    }
                    else
                    {
                        MessageBox.Show("Password incorrect!!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        Txt_loginPass.Focus();
                    }
                }
                else
                {
                    MessageBox.Show("Usuario no valido!!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    Txt_loginUser.Text = "";
                    Txt_loginUser.Focus();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            Txt_loginPass.Text      = "";
            Chk_gestionPass.Checked = false;
            conexion.Close();
        }
Example #2
0
 private void frm_salas_FormClosing(object sender, FormClosingEventArgs e)
 {
     menu.Show();
 }
Example #3
0
 private void button1_Click(object sender, EventArgs e)
 {
     menu.Show();
     this.Close();
 }