Example #1
0
        private void BtnIngreso_Click(object sender, EventArgs e)
        {
            txtUsuario.Text.ToUpper();

            if (txtUsuario.Text == "" && txtContra.Text == "")
            {
                MessageBox.Show("Debe ingresar Usuario y ContraseƱa");
                txtUsuario.Focus();
            }
            else
            {
                try
                {
                    cn.Open();
                    SqlCommand cmd = new SqlCommand("SELECT * FROM MAEPASSWORD WITH (NOLOCK) WHERE LOGIN='******' AND CLAVE = '" + txtContra.Text + "';", cn);
                    // SqlCommand cmd = new SqlCommand("select * from med_atencion  where fol_ate ='" + txtCargo.Text + "' and num_suc= '" + txtRut.Text + "';", cn);
                    SqlDataReader dr = cmd.ExecuteReader();

                    if (dr.Read())
                    {
                        Globales.gbUsuario = Convert.ToString(dr["LOGIN"]);


                        MessageBox.Show("Bienvenido(a) " + Convert.ToString(dr["NOMBRE"]));

                        if (txtUsuario.Text.ToUpper() == "18266149-K" || txtUsuario.Text.ToUpper() == "15660194-2" || txtUsuario.Text.ToUpper() == "16260548-8")
                        {
                            MenuAdmin menu = new MenuAdmin();
                            menu.Show();
                            this.Hide();
                        }
                        else
                        {
                            Menu men = new Menu();
                            men.Show();
                            this.Hide();
                        }
                    }
                    else
                    {
                        MessageBox.Show("Usuario MK no encontrado");
                    }

                    cn.Close();
                }
                catch (Exception ex)
                {
                    MessageBox.Show("error" + ex);
                    groupBox1.Enabled = false;
                    cn.Close();
                }
            }



            // SELECT * FROM MAEPASSWORD WITH (NOLOCK) WHERE LOGIN='******' AND CLAVE = '6149'
        }
Example #2
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (Globales.gbUsuario == "18266149-K" || Globales.gbUsuario == "15660194-2" || Globales.gbUsuario == "16260548-8")
     {
         MenuAdmin ad = new MenuAdmin();
         ad.Show();
         this.Hide();
     }
     else
     {
         Menu a = new Menu();
         a.Show();
         this.Hide();
     }
 }