1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
| Imports System.Data.Services
Imports System.Data.Services.Common
Imports System.Linq
Imports System.ServiceModel.Web
Public Class WcfDevis
' TODO: replace [[class name]] with your data class name
Inherits DataService(Of SOPCZEntities)
' This method is called only once to initialize service-wide policies.
Public Shared Sub InitializeService(ByVal config As DataServiceConfiguration)
' TODO: set rules to indicate which entity sets and service operations are visible, updatable, etc.
' Examples:
config.SetEntitySetAccessRule("*", EntitySetRights.AllRead)
config.SetServiceOperationAccessRule("GetExtractionDevis", ServiceOperationRights.All)
config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V3
config.UseVerboseErrors = True
End Sub
<WebGet()> _
Public Function GetExtractionDevis() As IQueryable(Of Excel)
Try
Dim LesDatas As New SOPCZEntities
Dim q = (From d In LesDatas.DevisVersions Where d.Version = d.Devi.DevisVersions.Count Select d, r = GetRentabiliteDevis(d))
Return (From v In q.ToList Select New Excel With { _
.Dte = v.d.Dte, .Client = v.d.Devi.ClientSiteChantier.ClientSite.Client.Libelle, _
.NumChantier = v.d.Devi.ClientSiteChantier.CodeChantier, .LibChantier = v.d.Devi.ClientSiteChantier.LibelleAdresse, _
.NumDevis = IO.Path.GetFileNameWithoutExtension(v.d.PathFile), .LibDevis = v.d.Devi.Libelle, _
.Service = v.d.Devi.Collaborateur.Service1.Libelle, .Collaborateur = v.d.Devi.Collaborateur.Nom & " " & v.d.Devi.Collaborateur.Prenom, _
.MntDeboursHT = v.r.CoutReel, .MntVenteHT = v.r.PrixVente, _
.CoefNet = v.r.CoefReel, .MargeNet = v.r.Marge, _
.Etat = GetFullEtatsCmd.Find(Function(p) p.Id = v.d.Devi.Etat).Libelle}).ToList
Catch ex As Exception
HelperJournal.WriteException(ex)
Return New Excel
End Try
End Function
End Class |
Partager