示例#1
0
        private BindingSource cargarBindingSourceBusqueda(Stack <FacturaGas> facturaBusqueda)
        {
            Stack <FacturaGas> copy = new Stack <FacturaGas>();
            BindingSource      bindingSource_cargado = new BindingSource();


            if (facturaBusqueda.Count != 0)
            {
                for (int i = 0; i <= facturaBusqueda.Count; i++)
                {
                    FacturaGas elemento = facturaBusqueda.Pop();
                    bindingSource_cargado.Add(elemento);
                    copy.Push(elemento);
                }

                for (int i = 0; i <= copy.Count; i++)
                {
                    FacturaGas elemento = copy.Pop();
                    facturaBusqueda.Push(elemento);
                }
            }

            /*else
             * {
             *  bindingSource_cargado.Add(new PilaGas());
             * }*/


            return(bindingSource_cargado);
        }
示例#2
0
        private void btnEliminar_Click(object sender, EventArgs e)
        {
            pila.eliminarFacturaBusqueda(Convert.ToInt32(txtId.Text));
            bindingSource1 = cargarBindingSource();

            /*gridInfo.DataSource = bindingSource1;
             * gridInfo.Refresh();
             * gridInfo = new DataGridView();*/

            if (bindingSource1.Count != 0)
            {
                gridInfo.DataSource = bindingSource1;
                gridInfo.Refresh();
                labelSaldo.Text = pila.Saldo.ToString();
            }
            else
            {
                /* bindingSource1 = new BindingSource();
                 * gridInfo.DataSource = bindingSource1;
                 * gridInfo.Refresh();*/
                FacturaGas elemento = new FacturaGas();
                bindingSource1.Add(elemento);
                gridInfo.DataSource = bindingSource1;

                gridInfo.Refresh();
                this.gridInfo.CurrentCell     = null;
                this.gridInfo.Rows[0].Visible = false;
                pnlDatosCliente.Visible       = false;
                labelSaldo.Text = pila.Saldo.ToString();
            }
            pnlDatosCliente.Visible = false;
            pnlGrilla.Visible       = true;
        }
示例#3
0
        private BindingSource cargarBindingSource()
        {
            Stack <FacturaGas> copy = new Stack <FacturaGas>();
            BindingSource      bindingSource_cargado = new BindingSource();


            if (pila.StackFacturas.Count != 0)
            {
                for (int i = 0; i <= pila.StackFacturas.Count; i++)
                {
                    FacturaGas elemento = pila.StackFacturas.Pop();
                    bindingSource_cargado.Add(elemento);
                    copy.Push(elemento);
                }

                for (int i = 0; i <= copy.Count; i++)
                {
                    FacturaGas elemento = copy.Pop();
                    pila.StackFacturas.Push(elemento);
                }
            }

            /*else
             * {
             *  bindingSource_cargado.Add(new PilaGas());
             * }*/


            return(bindingSource_cargado);
        }
示例#4
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            int      id         = int.Parse(txtId.Text);
            string   nombre     = txtNombre.Text;
            int      referencia = int.Parse(txtReferencia.Text);
            int      estrato    = cmbEstrato.SelectedIndex;
            float    consumo    = float.Parse(txtConsumo.Text);
            DateTime fecha      = dateTimePicker1.Value;
            int      categoria  = cmbCategoria.SelectedIndex;
            string   direccion  = txtDireccion.Text;
            float    pago       = float.Parse(txtPago.Text);

            FacturaGas factura = new FacturaGas(id, referencia, fecha, consumo, direccion, nombre, estrato, categoria, pago);

            this.pila.insertarFactura(factura);
            //bindingSource1.Add(pila.StackFacturas.Peek());
            bindingSource1      = cargarBindingSource();
            gridInfo.DataSource = new DataGridView();
            gridInfo.DataSource = bindingSource1;
            gridInfo.Refresh();

            labelSaldo.Text         = pila.Saldo.ToString();
            pnlDatosCliente.Visible = false;
            pnlGrilla.Visible       = true;
        }