/// <summary>
 /// Saves the services sold by the builder or the carrier on to the database
 /// </summary>
 /// <param name="pc">
 /// Instance of the class PedidoSoloServicioServicio
 /// </param>
 /// <returns>
 /// True if the services sold are saved
 /// </returns>
 public bool GuardarPedidoSoloServicioServicio(PedidoSoloServicioServicioE psss)
 {
     using (FerreteriaEntities db = new FerreteriaEntities())
     {
         return(db.Database.ExecuteSqlCommand("sp_ipedido_solo_servicio_servicio @p0, @p1, @p2, @p3",
                                              psss.IdPedido, psss.IdVenta, psss.Cantidad, psss.PrecioTotal) > 0);
     }
 }
Beispiel #2
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);
            }
        }