Imports BVSoftware.BVC.Core Imports System.Web.Services _ Public Class WebDiscountingServices Inherits System.Web.Services.WebService #Region " Web Services Designer Generated Code " Public Sub New() MyBase.New() 'This call is required by the Web Services Designer. InitializeComponent() 'Add your own initialization code after the InitializeComponent() call End Sub 'Required by the Web Services Designer Private components As System.ComponentModel.IContainer 'NOTE: The following procedure is required by the Web Services Designer 'It can be modified using the Web Services Designer. 'Do not modify it using the code editor. Private Sub InitializeComponent() components = New System.ComponentModel.Container End Sub Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) 'CODEGEN: This procedure is required by the Web Services Designer 'Do not modify it using the code editor. If disposing Then If Not (components Is Nothing) Then components.Dispose() End If End If MyBase.Dispose(disposing) End Sub #End Region _ Public Function PricingLevels_GetAll(ByRef token As Membership.AuthenticationToken) As Discounting.PricingLevel() If SecurityServices.WebServiceTokens.IsWebServiceTokenValidForPermission(token.TokenID, Security.RolePermission.AccessProductArea) = True Then Return BVSoftware.BVC.Core.DiscountingServices.PricingLevels.GetAll() Else token.TokenRejected = True Return Nothing End If End Function _ Public Function PricingLevels_Update(ByRef token As Membership.AuthenticationToken, ByRef levels As Discounting.PricingLevel()) As Boolean If SecurityServices.WebServiceTokens.IsWebServiceTokenValidForPermission(token.TokenID, Security.RolePermission.AccessProductArea) = True Then Return BVSoftware.BVC.Core.DiscountingServices.PricingLevels.Update(levels) Else token.TokenRejected = True Return False End If End Function _ Public Sub PricingLevels_ApplyPricingLevelToProduct(ByRef token As Membership.AuthenticationToken, ByRef level As Discounting.PricingLevel, ByRef p As Catalog.Product) If SecurityServices.WebServiceTokens.IsWebServiceTokenValidForPermission(token.TokenID, Security.RolePermission.AccessProductArea) = True Then BVSoftware.BVC.Core.DiscountingServices.PricingLevels.ApplyPricingLevelToProduct(level, p) Else token.TokenRejected = True End If End Sub _ Public Function Sales_ListSales(ByRef token As Membership.AuthenticationToken) As Discounting.Sale() If SecurityServices.WebServiceTokens.IsWebServiceTokenValidForPermission(token.TokenID, Security.RolePermission.AccessProductArea) = True Then Return BVSoftware.BVC.Core.DiscountingServices.Sales.ListSales() Else token.TokenRejected = True Return Nothing End If End Function _ Public Function Sales_ToDataTable(ByRef token As Membership.AuthenticationToken) As DataSet If SecurityServices.WebServiceTokens.IsWebServiceTokenValidForPermission(token.TokenID, Security.RolePermission.AccessProductArea) = True Then Return BVSoftware.BVC.Core.DiscountingServices.Sales.ToDataTable().DataSet Else token.TokenRejected = True Return New DataSet End If End Function _ Public Function Sales_CreateNewSale(ByRef token As Membership.AuthenticationToken, ByVal saleType As Discounting.SaleType, ByVal discountType As Discounting.SaleDiscountType, ByVal allowSaleBelowCost As Boolean, ByVal amount As Decimal, ByVal startDate As Date, ByVal endDate As Date) As Discounting.Sale If SecurityServices.WebServiceTokens.IsWebServiceTokenValidForPermission(token.TokenID, Security.RolePermission.AccessProductArea) = True Then Return BVSoftware.BVC.Core.DiscountingServices.Sales.CreateNewSale(saleType, discountType, allowSaleBelowCost, amount, startDate, endDate) Else token.TokenRejected = True Return Nothing End If End Function _ Public Function Sales_CreateNew(ByRef token As Membership.AuthenticationToken, ByRef s As Discounting.Sale) As Boolean If SecurityServices.WebServiceTokens.IsWebServiceTokenValidForPermission(token.TokenID, Security.RolePermission.AccessProductArea) = True Then Return BVSoftware.BVC.Core.DiscountingServices.Sales.CreateNew(s) Else token.TokenRejected = True Return False End If End Function _ Public Function Sales_Update(ByRef token As Membership.AuthenticationToken, ByRef s As Discounting.Sale) As Boolean If SecurityServices.WebServiceTokens.IsWebServiceTokenValidForPermission(token.TokenID, Security.RolePermission.AccessProductArea) = True Then Return BVSoftware.BVC.Core.DiscountingServices.Sales.Update(s) Else token.TokenRejected = True Return False End If End Function _ Public Function Sales_DeleteSale(ByRef token As Membership.AuthenticationToken, ByVal saleID As Integer) As Boolean If SecurityServices.WebServiceTokens.IsWebServiceTokenValidForPermission(token.TokenID, Security.RolePermission.AccessProductArea) = True Then Return BVSoftware.BVC.Core.DiscountingServices.Sales.DeleteSale(saleID) Else token.TokenRejected = True Return False End If End Function _ Public Function Sales_AddProductToSale(ByRef token As Membership.AuthenticationToken, ByVal productID As String, ByVal saleID As Integer) As Boolean If SecurityServices.WebServiceTokens.IsWebServiceTokenValidForPermission(token.TokenID, Security.RolePermission.AccessProductArea) = True Then Return BVSoftware.BVC.Core.DiscountingServices.Sales.AddProductToSale(productID, saleID) Else token.TokenRejected = True Return False End If End Function _ Public Function Sales_AddProductsToSale(ByRef token As Membership.AuthenticationToken, ByVal productID As String(), ByVal saleID As Integer) As Boolean If SecurityServices.WebServiceTokens.IsWebServiceTokenValidForPermission(token.TokenID, Security.RolePermission.AccessProductArea) = True Then Return BVSoftware.BVC.Core.DiscountingServices.Sales.AddProductsToSale(productID, saleID) Else token.TokenRejected = True Return False End If End Function _ Public Function Sales_RemoveProductFromSale(ByRef token As Membership.AuthenticationToken, ByVal productID As String, ByVal saleID As Integer) As Boolean If SecurityServices.WebServiceTokens.IsWebServiceTokenValidForPermission(token.TokenID, Security.RolePermission.AccessProductArea) = True Then Return BVSoftware.BVC.Core.DiscountingServices.Sales.RemoveProductFromSale(productID, saleID) Else token.TokenRejected = True Return False End If End Function _ Public Function Sales_RemoveProductsFromSale(ByRef token As Membership.AuthenticationToken, ByVal productID As String(), ByVal saleID As Integer) As Boolean If SecurityServices.WebServiceTokens.IsWebServiceTokenValidForPermission(token.TokenID, Security.RolePermission.AccessProductArea) = True Then Return BVSoftware.BVC.Core.DiscountingServices.Sales.RemoveProductsFromSale(productID, saleID) Else token.TokenRejected = True Return False End If End Function _ Public Function Sales_AddCategoryToSale(ByRef token As Membership.AuthenticationToken, ByVal categoryID As Integer, ByVal saleID As Integer) As Boolean If SecurityServices.WebServiceTokens.IsWebServiceTokenValidForPermission(token.TokenID, Security.RolePermission.AccessProductArea) = True Then Return BVSoftware.BVC.Core.DiscountingServices.Sales.AddCategoryToSale(categoryID, saleID) Else token.TokenRejected = True Return False End If End Function _ Public Function Sales_AddCategoriesToSale(ByRef token As Membership.AuthenticationToken, ByVal categoryID As Integer(), ByVal saleID As Integer) As Boolean If SecurityServices.WebServiceTokens.IsWebServiceTokenValidForPermission(token.TokenID, Security.RolePermission.AccessProductArea) = True Then Return BVSoftware.BVC.Core.DiscountingServices.Sales.AddCategoriesToSale(categoryID, saleID) Else token.TokenRejected = True Return False End If End Function _ Public Function Sales_RemoveCategoryFromSale(ByRef token As Membership.AuthenticationToken, ByVal categoryID As Integer, ByVal saleID As Integer) As Boolean If SecurityServices.WebServiceTokens.IsWebServiceTokenValidForPermission(token.TokenID, Security.RolePermission.AccessProductArea) = True Then Return BVSoftware.BVC.Core.DiscountingServices.Sales.RemoveCategoryFromSale(categoryID, saleID) Else token.TokenRejected = True Return False End If End Function _ Public Function Sales_RemoveCategoriesFromSale(ByRef token As Membership.AuthenticationToken, ByVal categoryID As Integer(), ByVal saleID As Integer) As Boolean If SecurityServices.WebServiceTokens.IsWebServiceTokenValidForPermission(token.TokenID, Security.RolePermission.AccessProductArea) = True Then Return BVSoftware.BVC.Core.DiscountingServices.Sales.RemoveCategoriesFromSale(categoryID, saleID) Else token.TokenRejected = True Return False End If End Function _ Public Function Discounts_GetDiscountForCoupon(ByRef token As Membership.AuthenticationToken, ByVal couponCode As String) As Discounting.Discount If SecurityServices.WebServiceTokens.IsWebServiceTokenValidForPermission(token.TokenID, Security.RolePermission.AccessProductArea) = True Then Return BVSoftware.BVC.Core.DiscountingServices.Discounts.GetDiscountForCoupon(couponCode) Else token.TokenRejected = True Return Nothing End If End Function _ Public Function Discounts_GetByID(ByRef token As Membership.AuthenticationToken, ByVal id As Integer) As Discounting.Discount If SecurityServices.WebServiceTokens.IsWebServiceTokenValidForPermission(token.TokenID, Security.RolePermission.AccessProductArea) = True Then Return BVSoftware.BVC.Core.DiscountingServices.Discounts.GetByID(id) Else token.TokenRejected = True Return Nothing End If End Function _ Public Function Discounts_ListDiscounts(ByRef token As Membership.AuthenticationToken) As Discounting.Discount() If SecurityServices.WebServiceTokens.IsWebServiceTokenValidForPermission(token.TokenID, Security.RolePermission.AccessProductArea) = True Then Return BVSoftware.BVC.Core.DiscountingServices.Discounts.ListDiscounts() Else token.TokenRejected = True Return Nothing End If End Function _ Public Function Discounts_ToDataTable(ByRef token As Membership.AuthenticationToken) As DataSet If SecurityServices.WebServiceTokens.IsWebServiceTokenValidForPermission(token.TokenID, Security.RolePermission.AccessProductArea) = True Then Return BVSoftware.BVC.Core.DiscountingServices.Discounts.ToDataTable().DataSet Else token.TokenRejected = True Return New DataSet End If End Function _ Public Function Discounts_CreateNew(ByRef token As Membership.AuthenticationToken, ByRef d As Discounting.Discount) As Boolean If SecurityServices.WebServiceTokens.IsWebServiceTokenValidForPermission(token.TokenID, Security.RolePermission.AccessProductArea) = True Then Return BVSoftware.BVC.Core.DiscountingServices.Discounts.CreateNew(d) Else token.TokenRejected = True Return False End If End Function _ Public Function Discounts_Update(ByRef token As Membership.AuthenticationToken, ByRef d As Discounting.Discount) As Boolean If SecurityServices.WebServiceTokens.IsWebServiceTokenValidForPermission(token.TokenID, Security.RolePermission.AccessProductArea) = True Then Return BVSoftware.BVC.Core.DiscountingServices.Discounts.Update(d) Else token.TokenRejected = True Return False End If End Function _ Public Function Discounts_Delete(ByRef token As Membership.AuthenticationToken, ByVal discountID As Integer) As Boolean If SecurityServices.WebServiceTokens.IsWebServiceTokenValidForPermission(token.TokenID, Security.RolePermission.AccessProductArea) = True Then Return BVSoftware.BVC.Core.DiscountingServices.Discounts.Delete(discountID) Else token.TokenRejected = True Return False End If End Function _ Public Function Discounts_GetProductsForDiscount(ByRef token As Membership.AuthenticationToken, ByVal discountID As Integer) As DataSet If SecurityServices.WebServiceTokens.IsWebServiceTokenValidForPermission(token.TokenID, Security.RolePermission.AccessProductArea) = True Then Return BVSoftware.BVC.Core.DiscountingServices.Discounts.GetProductsForDiscount(discountID).DataSet Else token.TokenRejected = True Return New DataSet End If End Function _ Public Function Discounts_AddProductToDiscount(ByRef token As Membership.AuthenticationToken, ByVal productID As String, ByVal discountID As Integer) As Boolean If SecurityServices.WebServiceTokens.IsWebServiceTokenValidForPermission(token.TokenID, Security.RolePermission.AccessProductArea) = True Then Return BVSoftware.BVC.Core.DiscountingServices.Discounts.AddProductToDiscount(productID, discountID) Else token.TokenRejected = True Return False End If End Function _ Public Function Discounts_RemoveProductFromDiscount(ByRef token As Membership.AuthenticationToken, ByVal productID As String, ByVal discountID As Integer) As Boolean If SecurityServices.WebServiceTokens.IsWebServiceTokenValidForPermission(token.TokenID, Security.RolePermission.AccessProductArea) = True Then Return BVSoftware.BVC.Core.DiscountingServices.Discounts.RemoveProductFromDiscount(productID, discountID) Else token.TokenRejected = True Return False End If End Function _ Public Function Discounts_GetUseageCountForCoupon(ByRef token As Membership.AuthenticationToken, ByVal couponCode As String, ByVal userID As Integer) As Integer If SecurityServices.WebServiceTokens.IsWebServiceTokenValidForPermission(token.TokenID, Security.RolePermission.AccessProductArea) = True Then Return BVSoftware.BVC.Core.DiscountingServices.Discounts.GetUseageCountForCoupon(couponCode, userID) Else token.TokenRejected = True Return -1 End If End Function End Class