Esempio n. 1
0
        private void btnventas_Click(object sender, EventArgs e)
        {
            Ordenar nuevo = new Ordenar();

            nuevo.Show();
            mlabelrol.Text = "Tu Rol Es: ";
            if (mlabelrol.Text == "Tu Rol Es: ")
            {
                metroTabPage1.Parent = metroTabControl1;
                metroTabPage2.Parent = null;
                metroTabPage4.Parent = null;
                metroTabPage5.Parent = null;
                btnventas.Visible    = false;
            }


            mtxtcontra.Text    = "";
            mtxtusu.Text       = "";
            btncsesion.Visible = false;

            actualizar();
            pictureBox3.SendToBack();
            mtxtusu.Focus();
            FormProvider.MainMenu.Hide();
        }
Esempio n. 2
0
        private void bunifuImageButton1_Click(object sender, EventArgs e)
        {
            try
            {
                SqlConnectionStringBuilder builder = new SqlConnectionStringBuilder();
                builder.DataSource     = "pruebastec.database.windows.net";
                builder.UserID         = "alexis";
                builder.Password       = "******";
                builder.InitialCatalog = "elpollon";

                using (SqlConnection connection = new SqlConnection(builder.ConnectionString))
                {
                    connection.Open();
                    StringBuilder sb = new StringBuilder();
                    sb.Append("select usuario, contraseña,rol from usuarios where usuario = '" + mtxtusu.Text +
                              "'And contraseña = '" + mtxtcontra.Text + "' ");
                    String         sql = sb.ToString();
                    SqlCommand     cmd = new SqlCommand(sql, connection);
                    SqlDataAdapter da  = new SqlDataAdapter(cmd);
                    DataSet        dt  = new DataSet();
                    da.Fill(dt, "usuarios");

                    DataRow DR;
                    DR = dt.Tables["usuarios"].Rows[0];
                    if ((mtxtusu.Text == DR["usuario"].ToString()) || (mtxtcontra.Text == DR["contraseña"].ToString()))
                    {
                        btncsesion.Visible = true;

                        mlabelrol.Text = mlabelrol.Text + DR["rol"].ToString();
                        if (mlabelrol.Text == "Tu Rol Es: administrador")
                        {
                            metroTabPage1.Parent         = null;
                            metroTabPage2.Parent         = metroTabControl1;
                            metroTabPage4.Parent         = metroTabControl1;
                            metroTabPage5.Parent         = metroTabControl1;
                            metroTabControl1.SelectedTab = metroTabPage4;
                            btnventas.Visible            = true;
                        }

                        if (mlabelrol.Text == "Tu Rol Es: vendedor")
                        {
                            Ordenar nuevo = new Ordenar();
                            nuevo.Show();
                            FormProvider.MainMenu.Hide();
                        }
                    }


                    connection.Close();
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Credenciales Incorrectas");
            }
        }