public ViewHistory()
        {
            InitializeComponent();
            var sql =
                $"SELECT ao.idOrder, ao.createDate, pr.name, au.fullname, ad.address " +
                "FROM APPORDER ao, ADDRESS ad, PRODUCT pr, APPUSER au " +
                "WHERE ao.idProduct = pr.idProduct " +
                "AND ao.idAddress = ad.idAddress " +
                "AND ad.idUser = au.idUser;";

            var sql2 =
                $"SELECT ao.idOrder, ao.createDate, pr.name, au.fullname, ad.address " +
                "FROM APPORDER ao, ADDRESS ad, PRODUCT pr, APPUSER au " +
                "WHERE ao.idProduct = pr.idProduct " +
                "AND ao.idAddress = ad.idAddress " +
                "AND ad.idUser = au.idUser " +
                "AND au.idUser = 2;";



            var conn = Conection.QueryDB(sql2);

            dataGridView1.DataSource = conn;
        }
Esempio n. 2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            bool usrtype;

            if (chkAdmin.CheckState == (CheckState)1)
            {
                usrtype = true;
            }
            else
            {
                usrtype = false;
            }

            var sql =
                $"INSERT INTO APPUSER (fullname, username, password, userType) VALUES('{txtName.Text}', '{txtUser.Text}', '{txtPassword.Text}', {usrtype})";

            //
            Conection.DoAction(sql);
            MessageBox.Show("Agregado");
            this.Hide();
            new MainMenu().Show();

            //MessageBox.Show(chkAdmin.ToString());
        }