Пример #1
0
        private void Ingreso()
        {
            string consulta;

            consulta = "ValidarEntrada";
            SqlConnection getconexion = Conexion.Cnn();

            scmd = new SqlCommand(consulta, getconexion);
            scmd.Parameters.AddWithValue("@usu", TxtUser.Text);
            scmd.Parameters.AddWithValue("@pass", TxtPass.Text);
            scmd.CommandType = CommandType.StoredProcedure;
            scmd.ExecuteNonQuery();
            sread = scmd.ExecuteReader();
            if (sread.Read())
            {
                if (sread["Usuario"].ToString() == TxtUser.Text && sread["Pass"].ToString() == TxtPass.Text)
                {
                    Usuario.usuario = TxtUser.Text;
                    int valor = p.Preferencia(TxtUser.Text.Trim());

                    if (valor == 1)
                    {
                        MenuDIC m = new MenuDIC();
                        this.Hide();
                        m.ShowDialog();
                    }
                    else
                    {
                        MenuDOC call = new MenuDOC();
                        this.Hide();
                        call.ShowDialog();
                    }
                }
            }
            else
            {
                MessageBox.Show("Datos no coinciden", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                TxtUser.Clear();
                TxtPass.Clear();
            }
            getconexion.Close();
        }
Пример #2
0
        private void menuToolStripMenuItem_Click(object sender, EventArgs e)
        {
            MenuDIC call = new MenuDIC();

            call.Show();
        }