Пример #1
0
        /// <summary>
        /// This method loads all the ingredients from the server
        /// and dynamically generates the corresponding checkboxes with their information.
        /// </summary>
        private void cargarCheckBoxesIngredientes()
        {
            List <Ingrediente> listaIngredientes = cp.listarIngredientes();
            int j  = 0;
            int x  = 14;
            int y  = 34;
            int x1 = 0;

            for (int i = 0; i < listaIngredientes.Count; i++)
            {
                CheckBox cb = new CheckBox();
                cb.Text   = (listaIngredientes[i].getNombre().ToString());
                cb.Height = 21;
                cb.Width  = 130;

                if (i % 4 == 0 && i != 0)
                {
                    y += 27;
                    j  = 0;
                }

                x1 = x + (135 * j);

                cb.Location = new Point(x1, y);

                listCheckbox.Add(cb);
                groupBoxIngredientes.Controls.Add(cb);
                j++;
            }
        }
Пример #2
0
        /// <summary>
        /// This method load all ingredients in listview
        /// </summary>
        private void loadIngredientes()
        {
            listViewIngredientes.Clear();
            List <Ingrediente> listaIngredientes = cp.listarIngredientes();

            foreach (Ingrediente i in listaIngredientes)
            {
                listViewIngredientes.Items.Add(i.getNombre());
            }
        }
Пример #3
0
        /// <summary>
        /// Este metodo carga los ingredientes de la bbdd en el listviewingredientes
        /// </summary>
        private void loadIngredientes()
        {
            List <Ingrediente> listaIngredientes = cp.listarIngredientes();

            if (listaIngredientes != null)
            {
                foreach (Ingrediente i in listaIngredientes)
                {
                    listViewIngredientes.Items.Add(i.getNombre());
                }
            }
            else
            {
                MessageBox.Show("Se perdió la conexion con el servicio");
            }
        }