Mini Kabibi Habibi

Current Path : C:/Users/Public/Documents/DXperience 13.1 Demos/WinForms/VB/EditorsTutorials/Modules/
Upload File :
Current File : C:/Users/Public/Documents/DXperience 13.1 Demos/WinForms/VB/EditorsTutorials/Modules/Contacts.vb

Imports Microsoft.VisualBasic
Imports System
Imports System.Collections
Imports System.Drawing

Namespace DevExpress.Tutorials.XtraEditors
	Public Class ContactList
		Inherits System.Collections.CollectionBase
		Public Shared Function GetContacts() As ContactList
			Dim cl As ContactList = New ContactList()
			cl.Add(Contact.ReadContact1())
			cl.Add(Contact.ReadContact2())
			cl.Add(Contact.ReadContact3())
			cl.Add(Contact.ReadContact4())
			cl.Add(Contact.ReadContact5())
			Return cl
		End Function

		Public Default Property Item(ByVal index As Integer) As Contact
			Get
				Return CType(List(index), Contact)
			End Get
			Set
				List(index) = Value
			End Set
		End Property

		Public Function Add(ByVal value As Contact) As Integer
			Return List.Add(value)
		End Function

		Public Sub Insert(ByVal index As Integer, ByVal value As Contact)
			List.Insert(index, value)
		End Sub

		Public Function IndexOf(ByVal value As Contact) As Integer
			Return List.IndexOf(value)
		End Function

		Public Function Contains(ByVal value As Contact) As Boolean
			Return List.Contains(value)
		End Function

		Public Sub Remove(ByVal value As Contact)
			List.Remove(value)
		End Sub

		Public Sub CopyTo(ByVal array As Contact(), ByVal index As Integer)
			List.CopyTo(array, index)
		End Sub
	End Class

	Public Class Contact
		Private fID As String
		Private fName As String
		Private fPurchaseDate As DateTime
		Private fPaymentAmount As Double

		Friend Sub New(ByVal ID As String)
			MyBase.New()
			Me.fID = ID
		End Sub
		Public ReadOnly Property ID() As String
			Get
				Return fID
			End Get
		End Property
		Public Property Name() As String
			Get
				Return fName
			End Get
			Set
				fName = Value
			End Set
		End Property
		Public Property PurchaseDate() As DateTime
			Get
				Return fPurchaseDate
			End Get
			Set
				fPurchaseDate = Value
			End Set
		End Property
		Public Property PaymentAmount() As Double
			Get
				Return fPaymentAmount
			End Get
			Set
				fPaymentAmount = Value
			End Set
		End Property

		Friend Shared Function ReadContact1() As Contact
			Dim c As Contact = New Contact("1")
			c.Name = "John Doe"
			c.PurchaseDate = DateTime.Parse("5/3/2005")
			c.PaymentAmount = 330.99
			Return c
		End Function

		Friend Shared Function ReadContact2() As Contact
			Dim c As Contact = New Contact("2")
			c.Name = "Sam Hill"
			c.PurchaseDate = DateTime.Parse("5/7/2004")
			c.PaymentAmount = 100.0
			Return c
		End Function

		Friend Shared Function ReadContact3() As Contact
			Dim c As Contact = New Contact("3")
			c.Name = "Karen Holmes"
			c.PurchaseDate = DateTime.Parse("7/11/2005")
			c.PaymentAmount = 230.50
			Return c
		End Function

		Friend Shared Function ReadContact4() As Contact
			Dim c As Contact = New Contact("4")
			c.Name = "Bobbie Valentine"
			c.PurchaseDate = DateTime.Parse("6/1/2005")
			c.PaymentAmount = 550.1
			Return c
		End Function

		Friend Shared Function ReadContact5() As Contact
			Dim c As Contact = New Contact("5")
			c.Name = "Frank Frankson"
			c.PurchaseDate = DateTime.Parse("2/2/2004")
			c.PaymentAmount = 50.0
			Return c
		End Function
	End Class
	' <lookUpEdit3>
	Public Class Record
		Private fCountry As String

		Public Sub New(ByVal fCountry As String)
			Me.fCountry = fCountry
		End Sub

		Public Property Country() As String
			Get
				Return fCountry
			End Get
			Set
				fCountry = Value
			End Set
		End Property
	End Class
	' </lookUpEdit3>
End Namespace