Exemple #1
0
        private void btoAgregarCarritoServicio_Click(object sender, EventArgs e)
        {
            try
            {
                for (int i = 0; i < tl.CargarTransportes().Count; i++)
                {
                    if (i == tl.CargarTransportes().Count - 1)
                    {
                        MessageBox.Show("No hay transportes disponibles", "Agregando Servicio",
                                        MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        break;
                    }
                    if (tl.CargarTransportes()[i].Activo == true)
                    {
                        pss = new PedidoSoloServicioServicioE();
                        foreach (ServicioE j in sel.CargarServicio("", ""))
                        {
                            if (j.Id == int.Parse(txtCodigoServicio.Text))
                            {
                                pss.IdVenta     = int.Parse(txtCodigoServicio.Text);
                                pss.Cantidad    = decimal.Parse(txtCantidadServicio.Text);
                                pss.PrecioTotal = j.Precio * pss.Cantidad;

                                servicios.AddLast(pss);

                                txtCodigoServicio.Clear();
                                lblNombreServicioT.Text = "";
                                txtCantidadServicio.Clear();

                                CargarCostos();
                                CargarCarritoServicios();
                                break;
                            }
                        }
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Agregando Servicio", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemple #2
0
        private void btnAgregarInicio_Click(object sender, EventArgs e)
        {
            try
            {
                if (dgvTransportes.CurrentRow.Cells[1].Value.Equals("COMPLETO"))
                {
                    PedidoCompletoE p = (PedidoCompletoE)dgvTransportes.CurrentRow.Cells[0].Value;
                    p.CodigoConductor      = u.Codigo;
                    p.HoraIniciaTransporte = dtpInicia.Value;
                    pl.GuardarPedidoCompletoTransporte(p);
                }
                else if (dgvTransportes.CurrentRow.Cells[1].Value.Equals("SOLO SERVICIO"))
                {
                    PedidoSoloServicioE p = (PedidoSoloServicioE)dgvTransportes.CurrentRow.Cells[0].Value;
                    p.CodigoConductor      = u.Codigo;
                    p.HoraIniciaTransporte = dtpInicia.Value;
                    pl.GuardarPedidoSoloServicioTransporte(p);
                }
                else if (dgvTransportes.CurrentRow.Cells[1].Value.Equals("CLIENTE"))
                {
                    PedidoClienteE p = (PedidoClienteE)dgvTransportes.CurrentRow.Cells[0].Value;
                    p.CodigoConductor      = u.Codigo;
                    p.HoraIniciaTransporte = dtpInicia.Value;
                    pl.GuardarPedidoClienteTransporte(p);
                }
                CargarPedidosTransporte();

                foreach (TransporteE t in tl.CargarTransportes())
                {
                    if (t.CodigoConductor == u.Codigo)
                    {
                        t.Disponible = false;
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Agregando Hora Inicio", MessageBoxButtons.OK, MessageBoxIcon.Error);
                throw;
            }
        }
        private void btoAgregarCarritoServicio_Click(object sender, EventArgs e)
        {
            try
            {
                for (int i = 0; i < tl.CargarTransportes().Count; i++)
                {
                    if (i == tl.CargarTransportes().Count - 1)
                    {
                        MessageBox.Show("No hay transportes disponibles", "Agregando Servicio",
                                        MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        break;
                    }
                    if (tl.CargarTransportes()[i].Activo == true)
                    {
                        pcs = new PedidoClienteServicioE();
                        ServicioE s = sel.CargarServicio(cboNombreServicio.Text, cboCategoriaServicio.Text)[0];
                        pcs.IdVenta     = s.Id;
                        pcs.Cantidad    = int.Parse(txtCantidadServicio.Text);
                        pcs.PrecioTotal = s.Precio * pcp.Cantidad;

                        servicios.AddLast(pcs);

                        cboCategoriaServicio.SelectedIndex = 0;
                        txtCantidadServicio.Clear();
                        lblPrecioUnidadServicioT.Text = "0.00";
                        lblTotalServicioT.Text        = "0.00";

                        CargarCostosTotales();
                        CargarCarritoServicios();
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Agregando Servicio", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        /*
         * This method connect the logic layer with presentation layer. Call one data grid view
         * and save objects that brings a logic method
         */

        public void CargarTransportes()
        {
            dtgvTransportes.DataSource = null;
            dtgvTransportes.DataSource = transporte.CargarTransportes();
        }