Imports System Imports System.ComponentModel.DataAnnotations Imports System.ComponentModel Namespace Models.Base ''' <summary> ''' Base class for ProductsModel. Do not make changes to this class, ''' instead, put additional code in the ProductsModel class ''' </summary> Public Class ProductsModelBase ' private members Private _productID As Integer Private _productName As String Private _supplierID As System.Nullable(Of Integer) Private _categoryID As System.Nullable(Of Integer) Private _quantityPerUnit As String Private _unitPrice As System.Nullable(Of Decimal) Private _unitPriceTotal As Decimal Private _unitsInStock As System.Nullable(Of Short) Private _unitsOnOrder As System.Nullable(Of Short) Private _reorderLevel As System.Nullable(Of Short) Private _discontinued As Boolean ''' <summary> ''' Gets or Sets ProductID ''' </summary> <Display(Name:="Product ID")> _ Public Property ProductID() As Integer Get Return _productID End Get Set(ByVal value As Integer) _productID = value End Set End Property ''' <summary> ''' Gets or Sets ProductName ''' </summary> <Required(ErrorMessage:="{0} is required!")> _ <StringLength(40, ErrorMessage:="{0} must be a maximum of {1} characters long!")> _ <Display(Name:="Product Name")> _ Public Property ProductName() As String Get Return _productName End Get Set(ByVal value As String) _productName = value End Set End Property ''' <summary> ''' Gets or Sets SupplierID ''' </summary> <Display(Name:="Supplier ID")> _ Public Property SupplierID() As Integer? Get Return _supplierID End Get Set(ByVal value As Integer?) _supplierID = value End Set End Property ''' <summary> ''' Gets or Sets CategoryID ''' </summary> <Display(Name:="Category ID")> _ Public Property CategoryID() As Integer? Get Return _categoryID End Get Set(ByVal value As Integer?) _categoryID = value End Set End Property ''' <summary> ''' Gets or Sets QuantityPerUnit ''' </summary> <StringLength(20, ErrorMessage:="{0} must be a maximum of {1} characters long!")> _ <Display(Name:="Quantity Per Unit")> _ Public Property QuantityPerUnit() As String Get Return _quantityPerUnit End Get Set(ByVal value As String) _quantityPerUnit = value End Set End Property ''' <summary> ''' Gets or Sets UnitPrice ''' </summary> <RegularExpression("[-+]?[0-9]*\.?[0-9]?[0-9]", ErrorMessage:="{0} must be a valid decimal!")> _ <Display(Name:="Unit Price")> _ Public Property UnitPrice() As Decimal? Get Return _unitPrice End Get Set(ByVal value As Decimal?) _unitPrice = value End Set End Property ''' <summary> ''' Gets or Sets UnitPriceTotal ''' </summary> <Display(Name:="Unit Price Total")> _ Public Property UnitPriceTotal() As Decimal Get Return _unitPriceTotal End Get Set(ByVal value As Decimal) _unitPriceTotal = value End Set End Property ''' <summary> ''' Gets or Sets UnitsInStock ''' </summary> <Range(GetType(Int16), "-32768", "32767", ErrorMessage:="{0} must be an integer!")> _ <Display(Name:="Units In Stock")> _ Public Property UnitsInStock() As Short? Get Return _unitsInStock End Get Set(ByVal value As Short?) _unitsInStock = value End Set End Property ''' <summary> ''' Gets or Sets UnitsOnOrder ''' </summary> <Range(GetType(Int16), "-32768", "32767", ErrorMessage:="{0} must be an integer!")> _ <Display(Name:="Units On Order")> _ Public Property UnitsOnOrder() As Short? Get Return _unitsOnOrder End Get Set(ByVal value As Short?) _unitsOnOrder = value End Set End Property ''' <summary> ''' Gets or Sets ReorderLevel ''' </summary> <Range(GetType(Int16), "-32768", "32767", ErrorMessage:="{0} must be an integer!")> _ <Display(Name:="Reorder Level")> _ Public Property ReorderLevel() As Short? Get Return _reorderLevel End Get Set(ByVal value As Short?) _reorderLevel = value End Set End Property ''' <summary> ''' Gets or Sets Discontinued ''' </summary> <Required(ErrorMessage:="{0} is required!")> _ <Display(Name:="Discontinued")> _ Public Property Discontinued() As Boolean Get Return _discontinued End Get Set(ByVal value As Boolean) _discontinued = value End Set End Property End Class End Namespace