예제 #1
0
        private void ActualizaControles()
        {
            List <Business> listaB = BusinessQuery.getLista();

            dataGridView3.DataSource = null;
            dataGridView3.DataSource = listaB;

            cmbNegocio.DataSource    = null;
            cmbNegocio.ValueMember   = "idBusiness";
            cmbNegocio.DisplayMember = "name";
            cmbNegocio.DataSource    = listaB;

            cmbNegocio2.DataSource    = null;
            cmbNegocio2.ValueMember   = "idBusiness";
            cmbNegocio2.DisplayMember = "name";
            cmbNegocio2.DataSource    = listaB;

            cmbNegocioP.DataSource    = null;
            cmbNegocioP.ValueMember   = "idBusiness";
            cmbNegocioP.DisplayMember = "name";
            cmbNegocioP.DataSource    = listaB;

            cmbNegocioEP.DataSource    = null;
            cmbNegocioEP.ValueMember   = "idBusiness";
            cmbNegocioEP.DisplayMember = "name";
            cmbNegocioEP.DataSource    = listaB;

            cmbProducto.DataSource    = null;
            cmbProducto.ValueMember   = "idProduct";
            cmbProducto.DisplayMember = "name";
            cmbProducto.DataSource    = ProductQuery.getLista();
        }
예제 #2
0
        private void btnAgregarN_Click(object sender, EventArgs e)
        {
            List <Business> lista = BusinessQuery.getLista();
            bool            flag  = true;

            foreach (var bu in lista)
            {
                if (txtNegocio.Text.Equals(bu.name))
                {
                    flag = false;
                    break;
                }
            }

            if (flag)
            {
                try
                {
                    BusinessQuery.newBusiness(txtNegocio.Text, textBox1.Text);
                    MessageBox.Show("Negocio agregado");
                    ActualizaControles();
                    textBox1.Clear();
                    txtNegocio.Clear();
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Ocurrió un error");
                }
            }
            else
            {
                MessageBox.Show("Ya hay un negocio con ese nombre");
            }
        }
예제 #3
0
        private void ActualizaControles()
        {
            List <Business> listaB = BusinessQuery.getLista();

            cmbNegocio.DataSource    = null;
            cmbNegocio.ValueMember   = "idBusiness";
            cmbNegocio.DisplayMember = "name";
            cmbNegocio.DataSource    = listaB;
        }
예제 #4
0
        private bool ComprobarListas()
        {
            List <Business> listaB = BusinessQuery.getLista();
            List <Address>  listaA = AddressQuery.getLista();

            if (listaA.Any() && listaB.Any())
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #5
0
        private void btnEliminarN_Click(object sender, EventArgs e)
        {
            string name;

            try
            {
                name = cmbNegocio.Text;
                BusinessQuery.deleteBusiness(name);
                MessageBox.Show("Negocio eliminado");
                ActualizaControles();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Ocurrió un error");
            }
        }
예제 #6
0
        private void ActualizaControles(int idUser)
        {
            List <Business> listaB = BusinessQuery.getLista();

            cmbNegocio.DataSource    = null;
            cmbNegocio.ValueMember   = "idBusiness";
            cmbNegocio.DisplayMember = "name";
            cmbNegocio.DataSource    = listaB;

            cmbDireccion.DataSource    = null;
            cmbDireccion.ValueMember   = "idAddress";
            cmbDireccion.DisplayMember = "address";
            cmbDireccion.DataSource    = Connection.ExecuteQuery($"SELECT ad.idAddress, ad.address " +
                                                                 $"FROM ADDRESS ad " +
                                                                 $"WHERE idUser = {idUser};");

            Business bu = (Business)cmbNegocio.SelectedItem;

            ActualizarProducto(bu);
        }