Beispiel #1
0
        private void Productos_Load(object sender, EventArgs e)
        {
            carga();

            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.Offices oficinas = new Models.Offices();
            using (oficinas)
            {
                List <Models.Offices> result = oficinas.GetOffices();
                foreach (Models.Offices item in result)
                {
                    row          = table.NewRow();
                    row["Text"]  = item.Name;
                    row["Value"] = item.Id;
                    table.Rows.Add(row);
                }
            }

            cbOficina.BindingContext = new BindingContext();
            cbOficina.DataSource     = table;
            cbOficina.DisplayMember  = "Text";
            cbOficina.ValueMember    = "Value";
            cbOficina.BindingContext = new BindingContext();
        }
Beispiel #2
0
 public void carga()
 {
     dtOficinas.Rows.Clear();
     Models.Offices oficinas = new Models.Offices();
     using (oficinas)
     {
         List <Models.Offices> lista = oficinas.GetOffices();
         foreach (Models.Offices item in lista)
         {
             dtOficinas.Rows.Add(item.Id, item.Name, item.Telefono, item.Domicilio);
         }
     }
 }
        private AutoCompleteStringCollection cargadatos2()
        {
            AutoCompleteStringCollection datos = new AutoCompleteStringCollection();

            Models.Offices oficinas = new Models.Offices();
            using (oficinas)
            {
                List <Models.Offices> oficina = oficinas.GetOffices();
                foreach (Models.Offices item in oficina)
                {
                    datos.Add(item.Name);
                }
            }

            return(datos);
        }
        private void form_transfer_Load(object sender, EventArgs e)
        {
            lbFecha.Visible                    = false;
            this.txtFolios.AutoSize            = true;
            txtCodigo.AutoCompleteCustomSource = cargadatos();
            txtCodigo.AutoCompleteMode         = AutoCompleteMode.Suggest;
            txtCodigo.AutoCompleteSource       = AutoCompleteSource.CustomSource;

            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);

            Models.Offices oficinas = new Models.Offices();
            using (oficinas)
            {
                List <Models.Offices> oficina = oficinas.GetOffices();
                foreach (Models.Offices ofi in oficina)
                {
                    row          = table.NewRow();
                    row["Text"]  = ofi.Name;
                    row["Value"] = ofi.Id;
                    table.Rows.Add(row);
                }
            }

            cbOficinas.BindingContext = new BindingContext();
            cbOficinas.DataSource     = table;
            cbOficinas.DisplayMember  = "Text";
            cbOficinas.ValueMember    = "Value";
            cbOficinas.BindingContext = new BindingContext();
            if (id_transfer == 0)
            {
                get_folio();
            }
            else
            {
                recuperado = true;
                Models.Transfers traspasos = new Models.Transfers();
                using (traspasos)
                {
                    List <Models.Transfers> traspaso = traspasos.getTransferbyid(id_transfer);
                    if (traspaso.Count > 0)
                    {
                        lbFecha.Text             = traspaso[0].Fecha.ToString();
                        cbOficinas.SelectedValue = traspaso[0].Sucursal;
                        txtFolios.Text           = traspaso[0].Folio.ToString();
                    }
                }
                Models.Det_transfers det       = new Models.Det_transfers();
                Models.Product       productos = new Models.Product();
                using (det)
                {
                    using (productos)
                    {
                        List <Models.Det_transfers> detallado = det.getDet_trans(Convert.ToInt32(txtFolios.Text));
                        if (detallado.Count > 0)
                        {
                            foreach (Models.Det_transfers item in detallado)
                            {
                                List <Models.Product> producto = productos.getProductById(item.Id_producto);
                                dtProductos.Rows.Insert(0, item.Id_producto, item.Cantidad, producto[0].Code1, producto[0].Description, item.Precio, (item.Precio * item.Cantidad));
                            }
                        }
                    }
                }
            }
        }