public SingleMarca(SaveAction action)
 {
     InitializeComponent();
     currentAction = action;
     TypeInit();
     currentType = new Models.Marcas();
 }
        public SingleMarca(SaveAction action, Models.Marcas tipo)
        {
            InitializeComponent();
            currentAction = action;
            TypeInit();

            //Codigo de asignación
            textBox1.Text     = tipo.Descripcion;
            checkBox1.Checked = tipo.Estado;
            //

            currentType = tipo;
        }
Exemple #3
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();
        }