/// <summary>
 /// Saves the services bought by the clients on to the database
 /// </summary>
 /// <param name="pc">
 /// Instance of the class PedidoClienteServicio
 /// </param>
 /// <returns>
 /// True if the services bought are saved
 /// </returns>
 public bool GuardarPedidoClienteServicio(PedidoClienteServicioE pcs)
 {
     using (FerreteriaEntities db = new FerreteriaEntities())
     {
         return(db.Database.ExecuteSqlCommand("sp_ipedido_cliente_servicio @p0, @p1, @p2, @p3",
                                              pcs.IdPedido, pcs.IdVenta, pcs.Cantidad, pcs.PrecioTotal) > 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)
                    {
                        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);
            }
        }