Example #1
0
        private void DeleteUser_Load(object sender, EventArgs e)
        {
            var name      = ConnectionBD.ExecuteQuery("SELECT username FROM APPUSER");
            var nameCombo = new List <string>();

            foreach (DataRow dr in name.Rows)
            {
                nameCombo.Add(dr[0].ToString());
            }

            comboBox1.DataSource = nameCombo;
        }
        private void PoblarControles()
        {
            var users      = ConnectionBD.ExecuteQuery("SELECT username FROM appuser");
            var usersNames = new List <string>();

            foreach (DataRow dr in users.Rows)
            {
                usersNames.Add(dr[0].ToString());
            }

            comboBox1.DataSource = usersNames;
        }
Example #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            // mensaje de prueba
            //MessageBox.Show(user.IdUser.ToString());
            //iduser = Convert.ToInt32(uw.ToString());
            //MessageBox.Show(iduser.ToString());
            var dt2 = ConnectionBD.ExecuteQuery($"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 = '******'; ");

            dataGridView1.DataSource = dt2;

            MessageBox.Show("Datos obtenidos exitosamente");
        }
        public static List <Product> getLista()
        {
            string sql = "select * from PRODUCT";

            DataTable dt = ConnectionBD.ExecuteQuery(sql);

            List <Product> lista = new List <Product>();

            foreach (DataRow fila in dt.Rows)
            {
                Product pr = new Product();
                pr.IdProduct  = Convert.ToInt32(fila[0].ToString());
                pr.IdBusiness = Convert.ToInt32(fila[1].ToString());
                pr.Name       = fila[2].ToString();


                lista.Add(pr);
            }
            return(lista);
        }
        public static List <AddressA> getLista()
        {
            string sql = "select * from ADDRESS";

            DataTable dt = ConnectionBD.ExecuteQuery(sql);

            List <AddressA> lista = new List <AddressA>();

            foreach (DataRow fila in dt.Rows)
            {
                AddressA ad = new AddressA();
                ad.IdAddress = Convert.ToInt32(fila[0].ToString());
                ad.IdUser    = Convert.ToInt32(fila[1].ToString());
                ad.Address   = fila[2].ToString();



                lista.Add(ad);
            }
            return(lista);
        }
Example #6
0
        public static List <Business> getLista()
        {
            string sql = "select * from BUSINESS";

            DataTable dt = ConnectionBD.ExecuteQuery(sql);

            List <Business> lista = new List <Business>();

            foreach (DataRow fila in dt.Rows)
            {
                Business bu = new Business();

                bu.IdBusiness  = Convert.ToInt32(fila[0].ToString());
                bu.Name        = fila[1].ToString();
                bu.Description = fila[2].ToString();


                lista.Add(bu);
            }
            return(lista);
        }
Example #7
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                string query = $"SELECT idUser FROM APPUSER WHERE username = '******'";

                var dt        = ConnectionBD.ExecuteQuery(query);
                var dr        = dt.Rows[0];
                var idUsuario = Convert.ToInt32(dr[0].ToString());

                string nonQuery = $"DELETE FROM APPUSER WHERE idUser = {idUsuario}";

                ConnectionBD.ExecuteNonQuery(nonQuery);


                MessageBox.Show("Se ha eliminado el usuario");
            }
            catch (Exception exception)
            {
                MessageBox.Show("Ha ocurrido un error!");
            }
        }
Example #8
0
        public static List <Pedido> getLista()
        {
            string sql = "select * from APPORDER";

            DataTable dt = ConnectionBD.ExecuteQuery(sql);

            List <Pedido> lista = new List <Pedido>();

            foreach (DataRow fila in dt.Rows)
            {
                Pedido ped = new Pedido();
                User   u   = new User();
                ped.IdOrder    = Convert.ToInt32(fila[0].ToString());
                ped.CreateDate = Convert.ToDateTime(fila[1].ToString());
                ped.IdProduct  = ped.IdOrder = Convert.ToInt32(fila[2].ToString());
                ped.IdAddress  = Convert.ToInt32(fila[3].ToString());


                lista.Add(ped);
            }
            return(lista);
        }