Exemple #1
0
        private AutoCompleteStringCollection carga_proveedor()
        {
            AutoCompleteStringCollection datos = new AutoCompleteStringCollection();

            Models.Providers proveedores = new Models.Providers();
            using (proveedores)
            {
                List <Models.Providers> result = proveedores.getProviders();
                foreach (Models.Providers item in result)
                {
                    datos.Add(item.Name);
                }
                return(datos);
            }
        }
Exemple #2
0
        private void Inventario_Load(object sender, EventArgs e)
        {
            DataTable table = new DataTable();
            DataRow   row;

            table.Columns.Add("Text", typeof(string));
            table.Columns.Add("Value", typeof(string));
            row          = table.NewRow();
            row["Text"]  = "";
            row["Value"] = "";
            table.Rows.Add(row);
            // cboMarca.Items.Clear();
            Models.Marcas marca = new Models.Marcas();
            using (marca)
            {
                List <Models.Marcas> result = marca.getMarcas();
                foreach (Models.Marcas item in result)
                {
                    row          = table.NewRow();
                    row["Text"]  = item.Marca;
                    row["Value"] = item.Id;
                    table.Rows.Add(row);
                }
            }

            cboMarca.BindingContext = new BindingContext();
            cboMarca.DataSource     = table;
            cboMarca.DisplayMember  = "Text";
            cboMarca.ValueMember    = "Value";
            cboMarca.BindingContext = new BindingContext();



            DataTable table2 = new DataTable();
            DataRow   row2;

            table2.Columns.Add("Text", typeof(string));
            table2.Columns.Add("Value", typeof(string));
            row2          = table2.NewRow();
            row2["Text"]  = "";
            row2["Value"] = "";
            table2.Rows.Add(row2);
            // cboMarca.Items.Clear();
            Models.Providers proveedor = new Models.Providers();
            using (marca)
            {
                List <Models.Providers> result = proveedor.getProviders();
                foreach (Models.Providers item in result)
                {
                    row2          = table2.NewRow();
                    row2["Text"]  = item.Name;
                    row2["Value"] = item.Id;
                    table2.Rows.Add(row2);
                }
            }

            cboProveedor.BindingContext = new BindingContext();
            cboProveedor.DataSource     = table2;
            cboProveedor.DisplayMember  = "Text";
            cboProveedor.ValueMember    = "Value";
            cboProveedor.BindingContext = new BindingContext();
        }