private void backButton_Click_1(object sender, EventArgs e)
        {
            this.Hide();
            menuReserva mR = new menuReserva();

            mR.Show();
        }
Пример #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            BD.cnn.Open();
            string        tipo;
            SqlCommand    command;
            String        sql, Output = "";
            SqlDataReader dataReader;

            sql        = "select tipo,nombre from empleado where usuario = '" + textBox1.Text + "' AND password = '******';";
            command    = new SqlCommand(sql, BD.cnn);
            dataReader = command.ExecuteReader();
            dataReader.Read();
            try
            {
                tipo    = dataReader.GetValue(0).ToString();
                BD.tipo = tipo;
                if (tipo == "chef" || tipo == "bartender")
                {
                    this.Hide();
                    menuChefBartender mCB = new menuChefBartender();
                    BD.nombreUser = dataReader.GetValue(1).ToString();
                    mCB.Show();
                }
                else if (tipo == "mozo")
                {
                    this.Hide();
                    menuChef mCB = new menuChef();
                    BD.nombreUser = dataReader.GetValue(1).ToString();
                    mCB.Show();
                }
                else if (tipo == "maitre")
                {
                    this.Hide();
                    menuReserva mR = new menuReserva();
                    BD.nombreUser = dataReader.GetValue(1).ToString();
                    mR.Show();
                }
                else if (tipo == "cajero")
                {
                    this.Hide();
                    menuCaja mC = new menuCaja();
                    BD.nombreUser = dataReader.GetValue(1).ToString();
                    mC.Show();
                }
            }
            catch
            {
                MessageBox.Show("Usuario o Contraseña incorrectos");
            }
            dataReader.Close();
            BD.cnn.Close();
        }