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 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
| Imports System
Imports System.Collections.Generic
Imports System.Data.Services
Imports System.Data.Services.Common
Imports System.Linq
<DataServiceKeyAttribute("IdVersion")> _
Public Class ExcelDevi
Public Property IdVersion As Integer
Public Property Dte As Date
Public Property Client As String
Public Property NumChantier As String
Public Property LibChantier As String
Public Property NumDevis As String
Public Property LibDevis As String
Public Property Service As String
Public Property Collaborateur As String
Public Property MntDeboursHT As Decimal
Public Property MntVenteHT As Decimal
Public Property CoefNet As Decimal
Public Property MargeNet As Decimal
Public Property Etat As String
End Class
Partial Public Class DevisItemData
Shared _excels As IList(Of ExcelDevi)
Sub New()
Try
Dim LesDatas As New SOPCZEntities
Dim q = (From d In LesDatas.DevisVersions Where d.Version = d.Devi.DevisVersions.Count Select d)
_excels = (From v In q.ToList Select New ExcelDevi With { _
.IdVersion = v.IdVersion, .Dte = v.Dte, .Client = v.Devi.ClientSiteChantier.ClientSite.Client.Libelle, _
.NumChantier = v.Devi.ClientSiteChantier.CodeChantier, .LibChantier = v.Devi.ClientSiteChantier.LibelleAdresse, _
.NumDevis = IO.Path.GetFileNameWithoutExtension(v.PathFile), .LibDevis = v.Devi.Libelle, _
.Service = v.Devi.Collaborateur.Service.Libelle, .Collaborateur = v.Devi.Collaborateur.Nom & " " & v.Devi.Collaborateur.Prenom, _
.MntDeboursHT = 0, .MntVenteHT = 0, _
.CoefNet = 0, .MargeNet = 0, _
.Etat = "test"}).ToList
Catch ex As Exception
_excels = Nothing
End Try
End Sub
Public ReadOnly Property ExcelDevis() As IQueryable(Of ExcelDevi)
Get
Return _excels.AsQueryable()
End Get
End Property
End Class
Public Class test
' TODO: replace [[class name]] with your data class name
Inherits DataService(Of DevisItemData)
' This method is called only once to initialize service-wide policies.
Public Shared Sub InitializeService(ByVal config As DataServiceConfiguration)
config.SetEntitySetAccessRule("ExcelDevis", EntitySetRights.All)
config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V3
config.UseVerboseErrors = True
End Sub
End Class |
Partager