コード例 #1
0
        public void AgregarServicios(Venta v, DetalleVentaServicio item)
        {
            db.cmd.CommandText = "INSERT INTO DetalleVentaServicio(idServicio,idVenta,estado,idProducto) VALUES(@idServicio,@idVenta,@estado,@idProducto)";
            db.cmd.Parameters.AddWithValue("@idServicio", item.IdServicio);
            db.cmd.Parameters.AddWithValue("@idVenta", v.IdVenta);
            db.cmd.Parameters.AddWithValue("@estado", v.Estado);
            db.cmd.Parameters.AddWithValue("@idProducto", item.IdProducto);

            try
            {
                if (tipo) db.conn.Open();
                db.cmd.ExecuteNonQuery();
                if (tipo) db.conn.Close();
                db.cmd.Parameters.Clear();
            }
            catch (SqlException e)
            {
                MessageBox.Show(e.Message);
            }
        }
コード例 #2
0
        public void AgregarDetalleServicio()
        {
            Evaluador ev = new Evaluador();
            int nuevo = 1;

            List<DetalleVentaServicio> aux = new List<DetalleVentaServicio>();
            foreach (DetalleVentaServicio item in LstVentaServicios)
            {
                if (item.IdServicio == serv.IdServicio)
                {
                    nuevo = 0;
                }
                aux.Add(item);
            }

            if (nuevo == 1)
            {
                DetalleVentaServicio dv = new DetalleVentaServicio();
                ServicioxProductoSQL sxpsql = new ServicioxProductoSQL();
                dv.Servicio = sxpsql.ServiciobyId(serv.IdServicio);
                dv.IdProducto = serv.Producto.IdProducto;
                dv.IdServicio = serv.IdServicio;
                dv.Descripcion = dv.Servicio.Descripcion;
                dv.Precio = serv.Precio;

                aux.Add(dv);

                total += Math.Round(dv.Precio, 2);
                TxtTotal = total.ToString();
                subt = Math.Round(total / (1 + IGV), 2);
                TxtSubTotal = subt.ToString();
                igv_total = Math.Round((subt) * IGV, 2);
                TxtIGVTotal = igv_total.ToString();
                TxtPagaCon = txtPagaCon;
            }
            LstVentaServicios = aux;
            TxtServicio = "";
        }
コード例 #3
0
 public void SelectedItemServicioChanged(object sender)
 {
     detalleServicioSeleccionado = ((sender as DataGrid).SelectedItem as DetalleVentaServicio);
 }