From 8531009320d2a8f18fa38cf5ef158cb85cb22998 Mon Sep 17 00:00:00 2001 From: DevExpressExampleBot Date: Sun, 3 Sep 2023 13:57:00 +0400 Subject: [PATCH 1/2] autogenerate VB --- VB/LinqServerModeSource/EditForm.Designer.vb | 318 ++-- VB/LinqServerModeSource/EditForm.vb | 41 +- VB/LinqServerModeSource/Form1.Designer.vb | 217 +-- VB/LinqServerModeSource/Form1.vb | 288 ++- .../LinqServerModeSource.vbproj | 35 +- VB/LinqServerModeSource/Northwind.designer.vb | 1625 +++++++++-------- VB/LinqServerModeSource/Person.vb | 94 +- VB/LinqServerModeSource/Program.vb | 37 +- .../Properties/AssemblyInfo.vb | 39 + .../Properties/Resources.Designer.vb | 74 + .../Properties/Resources.resx | 117 ++ .../Properties/Settings.Designer.vb | 45 + .../Properties/Settings.settings | 14 + VB/LinqServerModeSource/app.config | 2 +- 14 files changed, 1656 insertions(+), 1290 deletions(-) create mode 100644 VB/LinqServerModeSource/Properties/AssemblyInfo.vb create mode 100644 VB/LinqServerModeSource/Properties/Resources.Designer.vb create mode 100644 VB/LinqServerModeSource/Properties/Resources.resx create mode 100644 VB/LinqServerModeSource/Properties/Settings.Designer.vb create mode 100644 VB/LinqServerModeSource/Properties/Settings.settings diff --git a/VB/LinqServerModeSource/EditForm.Designer.vb b/VB/LinqServerModeSource/EditForm.Designer.vb index ff33950..63cfc27 100644 --- a/VB/LinqServerModeSource/EditForm.Designer.vb +++ b/VB/LinqServerModeSource/EditForm.Designer.vb @@ -1,4 +1,4 @@ -' Developer Express Code Central Example: +' Developer Express Code Central Example: ' How to implement CRUD operations using XtraGrid and LinqServeModeSource ' ' This example demonstrates how to implement create, update and delete operations @@ -8,165 +8,171 @@ ' ' You can find sample updates and versions for different programming languages here: ' http://www.devexpress.com/example=E4498 - -Imports Microsoft.VisualBasic -Imports System Namespace LinqServerModeSource - Partial Public Class EditForm - ''' - ''' Required designer variable. - ''' - Private components As System.ComponentModel.IContainer = Nothing - ''' - ''' Clean up any resources being used. - ''' - ''' true if managed resources should be disposed; otherwise, false. - Protected Overrides Sub Dispose(ByVal disposing As Boolean) - If disposing AndAlso (components IsNot Nothing) Then - components.Dispose() - End If - MyBase.Dispose(disposing) - End Sub + Partial Class EditForm + + ''' + ''' Required designer variable. + ''' + Private components As System.ComponentModel.IContainer = Nothing + + ''' + ''' Clean up any resources being used. + ''' + ''' true if managed resources should be disposed; otherwise, false. + Protected Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing AndAlso (Me.components IsNot Nothing) Then + Me.components.Dispose() + End If + + MyBase.Dispose(disposing) + End Sub + +#Region "Windows Form Designer generated code" + ''' + ''' Required method for Designer support - do not modify + ''' the contents of this method with the code editor. + ''' + Private Sub InitializeComponent() + Me.simpleButton1 = New DevExpress.XtraEditors.SimpleButton() + Me.simpleButton2 = New DevExpress.XtraEditors.SimpleButton() + Me.textEdit1 = New DevExpress.XtraEditors.TextEdit() + Me.textEdit2 = New DevExpress.XtraEditors.TextEdit() + Me.textEdit3 = New DevExpress.XtraEditors.TextEdit() + Me.textEdit4 = New DevExpress.XtraEditors.TextEdit() + Me.labelControl1 = New DevExpress.XtraEditors.LabelControl() + Me.labelControl2 = New DevExpress.XtraEditors.LabelControl() + Me.labelControl3 = New DevExpress.XtraEditors.LabelControl() + Me.labelControl4 = New DevExpress.XtraEditors.LabelControl() + CType((Me.textEdit1.Properties), System.ComponentModel.ISupportInitialize).BeginInit() + CType((Me.textEdit2.Properties), System.ComponentModel.ISupportInitialize).BeginInit() + CType((Me.textEdit3.Properties), System.ComponentModel.ISupportInitialize).BeginInit() + CType((Me.textEdit4.Properties), System.ComponentModel.ISupportInitialize).BeginInit() + Me.SuspendLayout() + ' + ' simpleButton1 + ' + Me.simpleButton1.Location = New System.Drawing.Point(20, 179) + Me.simpleButton1.Name = "simpleButton1" + Me.simpleButton1.Size = New System.Drawing.Size(75, 23) + Me.simpleButton1.TabIndex = 0 + Me.simpleButton1.Text = "Ok" + AddHandler Me.simpleButton1.Click, New System.EventHandler(AddressOf Me.simpleButton1_Click) + ' + ' simpleButton2 + ' + Me.simpleButton2.Location = New System.Drawing.Point(161, 179) + Me.simpleButton2.Name = "simpleButton2" + Me.simpleButton2.Size = New System.Drawing.Size(75, 23) + Me.simpleButton2.TabIndex = 1 + Me.simpleButton2.Text = "Cancel" + AddHandler Me.simpleButton2.Click, New System.EventHandler(AddressOf Me.simpleButton2_Click) + ' + ' textEdit1 + ' + Me.textEdit1.Location = New System.Drawing.Point(89, 45) + Me.textEdit1.Name = "textEdit1" + Me.textEdit1.Size = New System.Drawing.Size(100, 20) + Me.textEdit1.TabIndex = 2 + ' + ' textEdit2 + ' + Me.textEdit2.Location = New System.Drawing.Point(89, 71) + Me.textEdit2.Name = "textEdit2" + Me.textEdit2.Size = New System.Drawing.Size(100, 20) + Me.textEdit2.TabIndex = 3 + ' + ' textEdit3 + ' + Me.textEdit3.Location = New System.Drawing.Point(89, 97) + Me.textEdit3.Name = "textEdit3" + Me.textEdit3.Size = New System.Drawing.Size(100, 20) + Me.textEdit3.TabIndex = 4 + ' + ' textEdit4 + ' + Me.textEdit4.Location = New System.Drawing.Point(89, 123) + Me.textEdit4.Name = "textEdit4" + Me.textEdit4.Size = New System.Drawing.Size(100, 20) + Me.textEdit4.TabIndex = 5 + ' + ' labelControl1 + ' + Me.labelControl1.Location = New System.Drawing.Point(12, 52) + Me.labelControl1.Name = "labelControl1" + Me.labelControl1.Size = New System.Drawing.Size(72, 13) + Me.labelControl1.TabIndex = 6 + Me.labelControl1.Text = "CompanyName" + ' + ' labelControl2 + ' + Me.labelControl2.Location = New System.Drawing.Point(20, 78) + Me.labelControl2.Name = "labelControl2" + Me.labelControl2.Size = New System.Drawing.Size(65, 13) + Me.labelControl2.TabIndex = 7 + Me.labelControl2.Text = "ContactName" + ' + ' labelControl3 + ' + Me.labelControl3.Location = New System.Drawing.Point(44, 104) + Me.labelControl3.Name = "labelControl3" + Me.labelControl3.Size = New System.Drawing.Size(39, 13) + Me.labelControl3.TabIndex = 8 + Me.labelControl3.Text = "Address" + ' + ' labelControl4 + ' + Me.labelControl4.Location = New System.Drawing.Point(44, 130) + Me.labelControl4.Name = "labelControl4" + Me.labelControl4.Size = New System.Drawing.Size(39, 13) + Me.labelControl4.TabIndex = 9 + Me.labelControl4.Text = "Country" + ' + ' EditForm + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(6F, 13F) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.ClientSize = New System.Drawing.Size(276, 226) + Me.Controls.Add(Me.labelControl4) + Me.Controls.Add(Me.labelControl3) + Me.Controls.Add(Me.labelControl2) + Me.Controls.Add(Me.labelControl1) + Me.Controls.Add(Me.textEdit4) + Me.Controls.Add(Me.textEdit3) + Me.Controls.Add(Me.textEdit2) + Me.Controls.Add(Me.textEdit1) + Me.Controls.Add(Me.simpleButton2) + Me.Controls.Add(Me.simpleButton1) + Me.Name = "EditForm" + Me.Text = "EditForm" + CType((Me.textEdit1.Properties), System.ComponentModel.ISupportInitialize).EndInit() + CType((Me.textEdit2.Properties), System.ComponentModel.ISupportInitialize).EndInit() + CType((Me.textEdit3.Properties), System.ComponentModel.ISupportInitialize).EndInit() + CType((Me.textEdit4.Properties), System.ComponentModel.ISupportInitialize).EndInit() + Me.ResumeLayout(False) + Me.PerformLayout() + End Sub + +#End Region + Private simpleButton1 As DevExpress.XtraEditors.SimpleButton + + Private simpleButton2 As DevExpress.XtraEditors.SimpleButton + + Private textEdit1 As DevExpress.XtraEditors.TextEdit + + Private textEdit2 As DevExpress.XtraEditors.TextEdit + + Private textEdit3 As DevExpress.XtraEditors.TextEdit - #Region "Windows Form Designer generated code" + Private textEdit4 As DevExpress.XtraEditors.TextEdit - ''' - ''' Required method for Designer support - do not modify - ''' the contents of this method with the code editor. - ''' - Private Sub InitializeComponent() - Me.simpleButton1 = New DevExpress.XtraEditors.SimpleButton() - Me.simpleButton2 = New DevExpress.XtraEditors.SimpleButton() - Me.textEdit1 = New DevExpress.XtraEditors.TextEdit() - Me.textEdit2 = New DevExpress.XtraEditors.TextEdit() - Me.textEdit3 = New DevExpress.XtraEditors.TextEdit() - Me.textEdit4 = New DevExpress.XtraEditors.TextEdit() - Me.labelControl1 = New DevExpress.XtraEditors.LabelControl() - Me.labelControl2 = New DevExpress.XtraEditors.LabelControl() - Me.labelControl3 = New DevExpress.XtraEditors.LabelControl() - Me.labelControl4 = New DevExpress.XtraEditors.LabelControl() - CType(Me.textEdit1.Properties, System.ComponentModel.ISupportInitialize).BeginInit() - CType(Me.textEdit2.Properties, System.ComponentModel.ISupportInitialize).BeginInit() - CType(Me.textEdit3.Properties, System.ComponentModel.ISupportInitialize).BeginInit() - CType(Me.textEdit4.Properties, System.ComponentModel.ISupportInitialize).BeginInit() - Me.SuspendLayout() - ' - ' simpleButton1 - ' - Me.simpleButton1.Location = New System.Drawing.Point(20, 179) - Me.simpleButton1.Name = "simpleButton1" - Me.simpleButton1.Size = New System.Drawing.Size(75, 23) - Me.simpleButton1.TabIndex = 0 - Me.simpleButton1.Text = "Ok" -' Me.simpleButton1.Click += New System.EventHandler(Me.simpleButton1_Click); - ' - ' simpleButton2 - ' - Me.simpleButton2.Location = New System.Drawing.Point(161, 179) - Me.simpleButton2.Name = "simpleButton2" - Me.simpleButton2.Size = New System.Drawing.Size(75, 23) - Me.simpleButton2.TabIndex = 1 - Me.simpleButton2.Text = "Cancel" -' Me.simpleButton2.Click += New System.EventHandler(Me.simpleButton2_Click); - ' - ' textEdit1 - ' - Me.textEdit1.Location = New System.Drawing.Point(89, 45) - Me.textEdit1.Name = "textEdit1" - Me.textEdit1.Size = New System.Drawing.Size(100, 20) - Me.textEdit1.TabIndex = 2 - ' - ' textEdit2 - ' - Me.textEdit2.Location = New System.Drawing.Point(89, 71) - Me.textEdit2.Name = "textEdit2" - Me.textEdit2.Size = New System.Drawing.Size(100, 20) - Me.textEdit2.TabIndex = 3 - ' - ' textEdit3 - ' - Me.textEdit3.Location = New System.Drawing.Point(89, 97) - Me.textEdit3.Name = "textEdit3" - Me.textEdit3.Size = New System.Drawing.Size(100, 20) - Me.textEdit3.TabIndex = 4 - ' - ' textEdit4 - ' - Me.textEdit4.Location = New System.Drawing.Point(89, 123) - Me.textEdit4.Name = "textEdit4" - Me.textEdit4.Size = New System.Drawing.Size(100, 20) - Me.textEdit4.TabIndex = 5 - ' - ' labelControl1 - ' - Me.labelControl1.Location = New System.Drawing.Point(12, 52) - Me.labelControl1.Name = "labelControl1" - Me.labelControl1.Size = New System.Drawing.Size(72, 13) - Me.labelControl1.TabIndex = 6 - Me.labelControl1.Text = "CompanyName" - ' - ' labelControl2 - ' - Me.labelControl2.Location = New System.Drawing.Point(20, 78) - Me.labelControl2.Name = "labelControl2" - Me.labelControl2.Size = New System.Drawing.Size(65, 13) - Me.labelControl2.TabIndex = 7 - Me.labelControl2.Text = "ContactName" - ' - ' labelControl3 - ' - Me.labelControl3.Location = New System.Drawing.Point(44, 104) - Me.labelControl3.Name = "labelControl3" - Me.labelControl3.Size = New System.Drawing.Size(39, 13) - Me.labelControl3.TabIndex = 8 - Me.labelControl3.Text = "Address" - ' - ' labelControl4 - ' - Me.labelControl4.Location = New System.Drawing.Point(44, 130) - Me.labelControl4.Name = "labelControl4" - Me.labelControl4.Size = New System.Drawing.Size(39, 13) - Me.labelControl4.TabIndex = 9 - Me.labelControl4.Text = "Country" - ' - ' EditForm - ' - Me.AutoScaleDimensions = New System.Drawing.SizeF(6F, 13F) - Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font - Me.ClientSize = New System.Drawing.Size(276, 226) - Me.Controls.Add(Me.labelControl4) - Me.Controls.Add(Me.labelControl3) - Me.Controls.Add(Me.labelControl2) - Me.Controls.Add(Me.labelControl1) - Me.Controls.Add(Me.textEdit4) - Me.Controls.Add(Me.textEdit3) - Me.Controls.Add(Me.textEdit2) - Me.Controls.Add(Me.textEdit1) - Me.Controls.Add(Me.simpleButton2) - Me.Controls.Add(Me.simpleButton1) - Me.Name = "EditForm" - Me.Text = "EditForm" - CType(Me.textEdit1.Properties, System.ComponentModel.ISupportInitialize).EndInit() - CType(Me.textEdit2.Properties, System.ComponentModel.ISupportInitialize).EndInit() - CType(Me.textEdit3.Properties, System.ComponentModel.ISupportInitialize).EndInit() - CType(Me.textEdit4.Properties, System.ComponentModel.ISupportInitialize).EndInit() - Me.ResumeLayout(False) - Me.PerformLayout() + Private labelControl1 As DevExpress.XtraEditors.LabelControl - End Sub + Private labelControl2 As DevExpress.XtraEditors.LabelControl - #End Region + Private labelControl3 As DevExpress.XtraEditors.LabelControl - Private WithEvents simpleButton1 As DevExpress.XtraEditors.SimpleButton - Private WithEvents simpleButton2 As DevExpress.XtraEditors.SimpleButton - Private textEdit1 As DevExpress.XtraEditors.TextEdit - Private textEdit2 As DevExpress.XtraEditors.TextEdit - Private textEdit3 As DevExpress.XtraEditors.TextEdit - Private textEdit4 As DevExpress.XtraEditors.TextEdit - Private labelControl1 As DevExpress.XtraEditors.LabelControl - Private labelControl2 As DevExpress.XtraEditors.LabelControl - Private labelControl3 As DevExpress.XtraEditors.LabelControl - Private labelControl4 As DevExpress.XtraEditors.LabelControl - End Class -End Namespace \ No newline at end of file + Private labelControl4 As DevExpress.XtraEditors.LabelControl + End Class +End Namespace diff --git a/VB/LinqServerModeSource/EditForm.vb b/VB/LinqServerModeSource/EditForm.vb index 0dffede..c588841 100644 --- a/VB/LinqServerModeSource/EditForm.vb +++ b/VB/LinqServerModeSource/EditForm.vb @@ -1,4 +1,4 @@ -' Developer Express Code Central Example: +' Developer Express Code Central Example: ' How to implement CRUD operations using XtraGrid and LinqServeModeSource ' ' This example demonstrates how to implement create, update and delete operations @@ -8,35 +8,30 @@ ' ' You can find sample updates and versions for different programming languages here: ' http://www.devexpress.com/example=E4498 - -Imports Microsoft.VisualBasic Imports System -Imports System.Collections.Generic Imports System.ComponentModel -Imports System.Data Imports System.Drawing -Imports System.Linq -Imports System.Text Imports System.Windows.Forms Namespace LinqServerModeSource - Partial Public Class EditForm - Inherits Form - Public Sub New(ByVal customer As Customer) - InitializeComponent() - textEdit1.DataBindings.Add("EditValue", customer, "CompanyName") - textEdit2.DataBindings.Add("EditValue", customer, "ContactName") - textEdit3.DataBindings.Add("EditValue", customer, "Address") - textEdit4.DataBindings.Add("EditValue", customer, "Country") - End Sub - Private Sub simpleButton1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles simpleButton1.Click - DialogResult = System.Windows.Forms.DialogResult.OK - End Sub + Public Partial Class EditForm + Inherits Form + + Public Sub New(ByVal customer As Customer) + InitializeComponent() + textEdit1.DataBindings.Add("EditValue", customer, "CompanyName") + textEdit2.DataBindings.Add("EditValue", customer, "ContactName") + textEdit3.DataBindings.Add("EditValue", customer, "Address") + textEdit4.DataBindings.Add("EditValue", customer, "Country") + End Sub - Private Sub simpleButton2_Click(ByVal sender As Object, ByVal e As EventArgs) Handles simpleButton2.Click - DialogResult = System.Windows.Forms.DialogResult.Cancel - End Sub + Private Sub simpleButton1_Click(ByVal sender As Object, ByVal e As EventArgs) + DialogResult = DialogResult.OK + End Sub - End Class + Private Sub simpleButton2_Click(ByVal sender As Object, ByVal e As EventArgs) + DialogResult = DialogResult.Cancel + End Sub + End Class End Namespace diff --git a/VB/LinqServerModeSource/Form1.Designer.vb b/VB/LinqServerModeSource/Form1.Designer.vb index 36967e4..760bfbb 100644 --- a/VB/LinqServerModeSource/Form1.Designer.vb +++ b/VB/LinqServerModeSource/Form1.Designer.vb @@ -1,4 +1,4 @@ -' Developer Express Code Central Example: +' Developer Express Code Central Example: ' How to implement CRUD operations using XtraGrid and LinqServeModeSource ' ' This example demonstrates how to implement create, update and delete operations @@ -8,119 +8,120 @@ ' ' You can find sample updates and versions for different programming languages here: ' http://www.devexpress.com/example=E4498 - -Imports Microsoft.VisualBasic -Imports System Namespace LinqServerModeSource - Partial Public Class Form1 - ''' - ''' Required designer variable. - ''' - Private components As System.ComponentModel.IContainer = Nothing - ''' - ''' Clean up any resources being used. - ''' - ''' true if managed resources should be disposed; otherwise, false. - Protected Overrides Sub Dispose(ByVal disposing As Boolean) - If disposing AndAlso (components IsNot Nothing) Then - components.Dispose() - End If - MyBase.Dispose(disposing) - End Sub + Partial Class Form1 + + ''' + ''' Required designer variable. + ''' + Private components As System.ComponentModel.IContainer = Nothing + + ''' + ''' Clean up any resources being used. + ''' + ''' true if managed resources should be disposed; otherwise, false. + Protected Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing AndAlso (Me.components IsNot Nothing) Then + Me.components.Dispose() + End If + + MyBase.Dispose(disposing) + End Sub + +#Region "Windows Form Designer generated code" + ''' + ''' Required method for Designer support - do not modify + ''' the contents of this method with the code editor. + ''' + Private Sub InitializeComponent() + Me.gridControl = New DevExpress.XtraGrid.GridControl() + Me.gridView1 = New DevExpress.XtraGrid.Views.Grid.GridView() + Me.linqServerModeSource1 = New DevExpress.Data.Linq.LinqServerModeSource() + Me.button1 = New System.Windows.Forms.Button() + Me.button2 = New System.Windows.Forms.Button() + Me.button3 = New System.Windows.Forms.Button() + CType((Me.gridControl), System.ComponentModel.ISupportInitialize).BeginInit() + CType((Me.gridView1), System.ComponentModel.ISupportInitialize).BeginInit() + CType((Me.linqServerModeSource1), System.ComponentModel.ISupportInitialize).BeginInit() + Me.SuspendLayout() + ' + ' gridControl + ' + Me.gridControl.Dock = System.Windows.Forms.DockStyle.Top + Me.gridControl.Location = New System.Drawing.Point(0, 0) + Me.gridControl.MainView = Me.gridView1 + Me.gridControl.Name = "gridControl" + Me.gridControl.Size = New System.Drawing.Size(778, 519) + Me.gridControl.TabIndex = 0 + Me.gridControl.ViewCollection.AddRange(New DevExpress.XtraGrid.Views.Base.BaseView() {Me.gridView1}) + ' + ' gridView1 + ' + Me.gridView1.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.Simple + Me.gridView1.GridControl = Me.gridControl + Me.gridView1.Name = "gridView1" + ' + ' button1 + ' + Me.button1.Location = New System.Drawing.Point(196, 538) + Me.button1.Name = "button1" + Me.button1.Size = New System.Drawing.Size(75, 23) + Me.button1.TabIndex = 1 + Me.button1.Text = "Add" + Me.button1.UseVisualStyleBackColor = True + AddHandler Me.button1.Click, New System.EventHandler(AddressOf Me.button1_Click) + ' + ' button2 + ' + Me.button2.Location = New System.Drawing.Point(324, 538) + Me.button2.Name = "button2" + Me.button2.Size = New System.Drawing.Size(75, 23) + Me.button2.TabIndex = 2 + Me.button2.Text = "Edit" + Me.button2.UseVisualStyleBackColor = True + AddHandler Me.button2.Click, New System.EventHandler(AddressOf Me.button2_Click) + ' + ' button3 + ' + Me.button3.Location = New System.Drawing.Point(452, 538) + Me.button3.Name = "button3" + Me.button3.Size = New System.Drawing.Size(75, 23) + Me.button3.TabIndex = 3 + Me.button3.Text = "Delete" + Me.button3.UseVisualStyleBackColor = True + AddHandler Me.button3.Click, New System.EventHandler(AddressOf Me.button3_Click) + ' + ' Form1 + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(6F, 13F) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.ClientSize = New System.Drawing.Size(778, 573) + Me.Controls.Add(Me.button3) + Me.Controls.Add(Me.button2) + Me.Controls.Add(Me.button1) + Me.Controls.Add(Me.gridControl) + Me.LookAndFeel.SkinName = "Foggy" + Me.LookAndFeel.UseDefaultLookAndFeel = False + Me.Name = "Form1" + Me.Text = "Form1" + CType((Me.gridControl), System.ComponentModel.ISupportInitialize).EndInit() + CType((Me.gridView1), System.ComponentModel.ISupportInitialize).EndInit() + CType((Me.linqServerModeSource1), System.ComponentModel.ISupportInitialize).EndInit() + Me.ResumeLayout(False) + End Sub - #Region "Windows Form Designer generated code" +#End Region + Private gridControl As DevExpress.XtraGrid.GridControl - ''' - ''' Required method for Designer support - do not modify - ''' the contents of this method with the code editor. - ''' - Private Sub InitializeComponent() - Me.gridControl = New DevExpress.XtraGrid.GridControl() - Me.gridView1 = New DevExpress.XtraGrid.Views.Grid.GridView() - Me.linqServerModeSource1 = New DevExpress.Data.Linq.LinqServerModeSource() - Me.button1 = New System.Windows.Forms.Button() - Me.button2 = New System.Windows.Forms.Button() - Me.button3 = New System.Windows.Forms.Button() - CType(Me.gridControl, System.ComponentModel.ISupportInitialize).BeginInit() - CType(Me.gridView1, System.ComponentModel.ISupportInitialize).BeginInit() - CType(Me.linqServerModeSource1, System.ComponentModel.ISupportInitialize).BeginInit() - Me.SuspendLayout() - ' - ' gridControl - ' - Me.gridControl.Dock = System.Windows.Forms.DockStyle.Top - Me.gridControl.Location = New System.Drawing.Point(0, 0) - Me.gridControl.MainView = Me.gridView1 - Me.gridControl.Name = "gridControl" - Me.gridControl.Size = New System.Drawing.Size(778, 519) - Me.gridControl.TabIndex = 0 - Me.gridControl.ViewCollection.AddRange(New DevExpress.XtraGrid.Views.Base.BaseView() { Me.gridView1}) - ' - ' gridView1 - ' - Me.gridView1.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.Simple - Me.gridView1.GridControl = Me.gridControl - Me.gridView1.Name = "gridView1" - ' - ' button1 - ' - Me.button1.Location = New System.Drawing.Point(196, 538) - Me.button1.Name = "button1" - Me.button1.Size = New System.Drawing.Size(75, 23) - Me.button1.TabIndex = 1 - Me.button1.Text = "Add" - Me.button1.UseVisualStyleBackColor = True -' Me.button1.Click += New System.EventHandler(Me.button1_Click); - ' - ' button2 - ' - Me.button2.Location = New System.Drawing.Point(324, 538) - Me.button2.Name = "button2" - Me.button2.Size = New System.Drawing.Size(75, 23) - Me.button2.TabIndex = 2 - Me.button2.Text = "Edit" - Me.button2.UseVisualStyleBackColor = True -' Me.button2.Click += New System.EventHandler(Me.button2_Click); - ' - ' button3 - ' - Me.button3.Location = New System.Drawing.Point(452, 538) - Me.button3.Name = "button3" - Me.button3.Size = New System.Drawing.Size(75, 23) - Me.button3.TabIndex = 3 - Me.button3.Text = "Delete" - Me.button3.UseVisualStyleBackColor = True -' Me.button3.Click += New System.EventHandler(Me.button3_Click); - ' - ' Form1 - ' - Me.AutoScaleDimensions = New System.Drawing.SizeF(6F, 13F) - Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font - Me.ClientSize = New System.Drawing.Size(778, 573) - Me.Controls.Add(Me.button3) - Me.Controls.Add(Me.button2) - Me.Controls.Add(Me.button1) - Me.Controls.Add(Me.gridControl) - Me.LookAndFeel.SkinName = "Foggy" - Me.LookAndFeel.UseDefaultLookAndFeel = False - Me.Name = "Form1" - Me.Text = "Form1" - CType(Me.gridControl, System.ComponentModel.ISupportInitialize).EndInit() - CType(Me.gridView1, System.ComponentModel.ISupportInitialize).EndInit() - CType(Me.linqServerModeSource1, System.ComponentModel.ISupportInitialize).EndInit() - Me.ResumeLayout(False) + Private gridView1 As DevExpress.XtraGrid.Views.Grid.GridView - End Sub + Private linqServerModeSource1 As DevExpress.Data.Linq.LinqServerModeSource - #End Region + Private button1 As System.Windows.Forms.Button - Private gridControl As DevExpress.XtraGrid.GridControl - Private gridView1 As DevExpress.XtraGrid.Views.Grid.GridView - Private linqServerModeSource1 As DevExpress.Data.Linq.LinqServerModeSource - Private WithEvents button1 As System.Windows.Forms.Button - Private WithEvents button2 As System.Windows.Forms.Button - Private WithEvents button3 As System.Windows.Forms.Button + Private button2 As System.Windows.Forms.Button - End Class + Private button3 As System.Windows.Forms.Button + End Class End Namespace diff --git a/VB/LinqServerModeSource/Form1.vb b/VB/LinqServerModeSource/Form1.vb index d459b14..76df5be 100644 --- a/VB/LinqServerModeSource/Form1.vb +++ b/VB/LinqServerModeSource/Form1.vb @@ -1,4 +1,4 @@ -' Developer Express Code Central Example: +' Developer Express Code Central Example: ' How to implement CRUD operations using XtraGrid and LinqServeModeSource ' ' This example demonstrates how to implement create, update and delete operations @@ -8,161 +8,155 @@ ' ' You can find sample updates and versions for different programming languages here: ' http://www.devexpress.com/example=E4498 - -Imports Microsoft.VisualBasic Imports System -Imports System.Collections.Generic Imports System.ComponentModel -Imports System.Data Imports System.Drawing -Imports System.Text Imports System.Windows.Forms Imports DevExpress.Skins -Imports DevExpress.LookAndFeel -Imports DevExpress.UserSkins Imports DevExpress.XtraEditors Imports System.Data.Linq Imports System.Linq -Imports DevExpress.Data.Linq + Namespace LinqServerModeSource - Partial Public Class Form1 - Inherits XtraForm - Public Sub New() - InitializeComponent() - linqServerModeSource1.QueryableSource = nwdContext.Customers - gridControl.DataSource = linqServerModeSource1 - - End Sub - Private nwdContext As New NorthwindDataContext() - Private customerToEdit As Customer - Private f1 As EditForm - Private Sub button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles button1.Click - customerToEdit = CreateCustomer() - EditCustomer(customerToEdit, "NewCustomer", AddressOf CloseNewCustomerHandler) - End Sub - Private Function CreateCustomer() As Customer - Dim idString As String - Dim newCustomer = New Customer() - Do - idString = GenerateCustomerID() - If (Not String.IsNullOrEmpty(idString)) Then - newCustomer.CustomerID = idString - Exit Do - End If - Loop - Return newCustomer - End Function - - Private Function GenerateCustomerID() As String - Const IDLength As Integer = 5 - Dim result = String.Empty - Dim rnd = New Random() - Dim collisionFlag As Boolean = False - For i = 0 To IDLength - 1 - result += Convert.ToChar(rnd.Next(65, 90)) - Next i - For i As Integer = 0 To gridView1.DataRowCount - 1 - If result Is gridView1.GetRowCellValue(i, gridView1.Columns("CustomerID")).ToString() Then - collisionFlag = True - Exit For - End If - Next i - If collisionFlag Then - Return String.Empty - Else - Return result - End If - End Function - Private Sub button2_Click(ByVal sender As Object, ByVal e As EventArgs) Handles button2.Click - Dim keyString As String = GetCustomerIDByRowHandle(gridView1.FocusedRowHandle) - Dim query = From Customer In - nwdContext.Customers - Where - Customer.CustomerID = keyString - Select - Customer - customerToEdit = query.ToList()(0) - EditCustomer(customerToEdit, "EditInfo", AddressOf CloseEditCustomerHandler) - End Sub - Private Sub EditCustomer(ByVal customer As Customer, ByVal windowTitle As String, ByVal closedDelegate As FormClosingEventHandler) - f1 = New EditForm(customer) With {.Text = windowTitle} - AddHandler f1.FormClosing, closedDelegate - f1.ShowDialog() - End Sub - Private Function GetCustomerIDByRowHandle(ByVal rowHandle As Integer) As String - Return CStr(gridView1.GetRowCellValue(rowHandle, "CustomerID")) - End Function - Private Sub CloseEditCustomerHandler(ByVal sender As Object, ByVal e As EventArgs) - If (CType(sender, EditForm)).DialogResult = System.Windows.Forms.DialogResult.OK Then - Try - nwdContext.SubmitChanges() - nwdContext.Refresh(RefreshMode.OverwriteCurrentValues, nwdContext.Customers) - gridView1.RefreshRow(gridView1.FocusedRowHandle) - Catch ex As Exception - HandleExcepton(ex) - End Try - End If - customerToEdit = Nothing - End Sub - Private Sub CloseNewCustomerHandler(ByVal sender As Object, ByVal e As FormClosingEventArgs) - - If (CType(sender, EditForm)).DialogResult = System.Windows.Forms.DialogResult.OK Then - Try - nwdContext.Customers.InsertOnSubmit(customerToEdit) - nwdContext.SubmitChanges() - gridControl.BeginInvoke(New MethodInvoker(Function() AnonymousMethod1())) - Catch ex As Exception - HandleExcepton(ex) - End Try - linqServerModeSource1.Reload() - For i As Integer = 0 To gridView1.DataRowCount - 1 - If customerToEdit.CustomerID = gridView1.GetRowCellValue(i, gridView1.Columns("CustomerID")).ToString() Then - gridView1.FocusedRowHandle = i - Exit For - End If - Next i - End If - customerToEdit = Nothing - End Sub - - Private Function AnonymousMethod1() As Boolean - nwdContext.Refresh(RefreshMode.OverwriteCurrentValues, nwdContext.Customers) - gridView1.LayoutChanged() - Return True - End Function - Private Sub HandleExcepton(ByVal ex As Exception) - MessageBox.Show(ex.Message) - End Sub - - Private Sub button3_Click(ByVal sender As Object, ByVal e As EventArgs) Handles button3.Click - DeleteCustomer(gridView1.FocusedRowHandle) - - End Sub - Private Sub DeleteCustomer(ByVal focusedRowHandle As Integer) - If focusedRowHandle < 0 Then - Return - End If - If MessageBox.Show("Do you really want to delete the selected customer?", "Delete Customer", MessageBoxButtons.OKCancel) <> System.Windows.Forms.DialogResult.OK Then - Return - End If - Dim keyString As String = GetCustomerIDByRowHandle(focusedRowHandle) - Dim query = From Customer In - nwdContext.Customers - Where - Customer.CustomerID = keyString - Select - Customer - nwdContext.Customers.DeleteOnSubmit(query.ToList()(0)) - Try - nwdContext.SubmitChanges() - nwdContext.Refresh(RefreshMode.OverwriteCurrentValues, nwdContext.Customers) - Catch ex As Exception - HandleExcepton(ex) + + Public Partial Class Form1 + Inherits XtraForm + + Public Sub New() + InitializeComponent() + linqServerModeSource1.QueryableSource = nwdContext.Customers + gridControl.DataSource = linqServerModeSource1 + End Sub + + Private nwdContext As NorthwindDataContext = New NorthwindDataContext() + + Private customerToEdit As Customer + + Private f1 As EditForm + + Private Sub button1_Click(ByVal sender As Object, ByVal e As EventArgs) + customerToEdit = CreateCustomer() + EditCustomer(customerToEdit, "NewCustomer", New FormClosingEventHandler(AddressOf CloseNewCustomerHandler)) + End Sub + + Private Function CreateCustomer() As Customer + Dim idString As String + Dim newCustomer = New Customer() + While True + idString = GenerateCustomerID() + If Not String.IsNullOrEmpty(idString) Then + newCustomer.CustomerID = idString + Exit While + End If + End While + + Return newCustomer + End Function + + Private Function GenerateCustomerID() As String + Const IDLength As Integer = 5 + Dim result = String.Empty + Dim rnd = New Random() + Dim collisionFlag As Boolean = False + For i = 0 To IDLength - 1 + result += Convert.ToChar(rnd.Next(65, 90)) + Next + + For i As Integer = 0 To gridView1.DataRowCount - 1 + If Equals(result, gridView1.GetRowCellValue(i, gridView1.Columns("CustomerID")).ToString()) Then + collisionFlag = True + Exit For + End If + Next + + If collisionFlag Then + Return String.Empty + Else + Return result + End If + End Function + + Private Sub button2_Click(ByVal sender As Object, ByVal e As EventArgs) + Dim query = nwdContext.Customers.Where(Of Customer)(Function(customer) Equals(customer.CustomerID, GetCustomerIDByRowHandle(gridView1.FocusedRowHandle))) + customerToEdit = query.ToList()(0) + EditCustomer(customerToEdit, "EditInfo", New FormClosingEventHandler(AddressOf CloseEditCustomerHandler)) + End Sub + + Private Sub EditCustomer(ByVal customer As Customer, ByVal windowTitle As String, ByVal closedDelegate As FormClosingEventHandler) + f1 = New EditForm(customer) With {.Text = windowTitle} + AddHandler f1.FormClosing, closedDelegate + f1.ShowDialog() + End Sub + + Private Function GetCustomerIDByRowHandle(ByVal rowHandle As Integer) As String + Return CStr(gridView1.GetRowCellValue(rowHandle, "CustomerID")) + End Function + + Private Sub CloseEditCustomerHandler(ByVal sender As Object, ByVal e As EventArgs) + If CType(sender, EditForm).DialogResult = DialogResult.OK Then + Try + nwdContext.SubmitChanges() + nwdContext.Refresh(RefreshMode.OverwriteCurrentValues, nwdContext.Customers) + gridView1.RefreshRow(gridView1.FocusedRowHandle) + Catch ex As Exception + HandleExcepton(ex) End Try - linqServerModeSource1.Reload() - gridView1.FocusedRowHandle = focusedRowHandle - customerToEdit = Nothing + End If + + customerToEdit = Nothing End Sub - End Class -End Namespace \ No newline at end of file + Private Sub CloseNewCustomerHandler(ByVal sender As Object, ByVal e As FormClosingEventArgs) + If CType(sender, EditForm).DialogResult = DialogResult.OK Then + Try + nwdContext.Customers.InsertOnSubmit(customerToEdit) + nwdContext.SubmitChanges() + gridControl.BeginInvoke(New MethodInvoker(Sub() + nwdContext.Refresh(RefreshMode.OverwriteCurrentValues, nwdContext.Customers) + gridView1.LayoutChanged() + End Sub)) + Catch ex As Exception + HandleExcepton(ex) + End Try + + linqServerModeSource1.Reload() + For i As Integer = 0 To gridView1.DataRowCount - 1 + If Equals(customerToEdit.CustomerID, gridView1.GetRowCellValue(i, gridView1.Columns("CustomerID")).ToString()) Then + gridView1.FocusedRowHandle = i + Exit For + End If + Next + End If + + customerToEdit = Nothing + End Sub + + Private Sub HandleExcepton(ByVal ex As Exception) + MessageBox.Show(ex.Message) + End Sub + + Private Sub button3_Click(ByVal sender As Object, ByVal e As EventArgs) + DeleteCustomer(gridView1.FocusedRowHandle) + End Sub + + Private Sub DeleteCustomer(ByVal focusedRowHandle As Integer) + If focusedRowHandle < 0 Then Return + If MessageBox.Show("Do you really want to delete the selected customer?", "Delete Customer", MessageBoxButtons.OKCancel) <> DialogResult.OK Then + Return + End If + + Dim query = nwdContext.Customers.Where(Of Customer)(Function(customer) Equals(customer.CustomerID, GetCustomerIDByRowHandle(focusedRowHandle))) + nwdContext.Customers.DeleteOnSubmit(query.ToList()(0)) + Try + nwdContext.SubmitChanges() + nwdContext.Refresh(RefreshMode.OverwriteCurrentValues, nwdContext.Customers) + Catch ex As Exception + HandleExcepton(ex) + End Try + + linqServerModeSource1.Reload() + gridView1.FocusedRowHandle = focusedRowHandle + customerToEdit = Nothing + End Sub + End Class +End Namespace diff --git a/VB/LinqServerModeSource/LinqServerModeSource.vbproj b/VB/LinqServerModeSource/LinqServerModeSource.vbproj index 9b2affc..0abcf07 100644 --- a/VB/LinqServerModeSource/LinqServerModeSource.vbproj +++ b/VB/LinqServerModeSource/LinqServerModeSource.vbproj @@ -1,20 +1,20 @@ - + + On Debug AnyCPU 11.0.50727.1 2.0 {743FD596-27DB-44C7-8837-E9EA005C4E6D} WinExe - + Properties + + LinqServerModeSource v4.0 - On - Binary - Off - On - + + 2.0 publish\ @@ -38,17 +38,17 @@ full false bin\Debug\ - true - true + DEBUG,TRACE prompt + 4 pdbonly true bin\Release\ - false - true + TRACE prompt + 4 @@ -87,7 +87,7 @@ - + EditForm.vb @@ -98,12 +98,13 @@ Northwind.dbml - + ResXFileCodeGenerator Resources.Designer.vb Designer + LinqServerModeSource.Properties - + True Resources.resx True @@ -113,11 +114,11 @@ Northwind.designer.vb Designer - + SettingsSingleFileGenerator Settings.Designer.vb - + True Settings.settings True @@ -156,4 +157,4 @@ --> - + \ No newline at end of file diff --git a/VB/LinqServerModeSource/Northwind.designer.vb b/VB/LinqServerModeSource/Northwind.designer.vb index 7b925b9..bbc3e96 100644 --- a/VB/LinqServerModeSource/Northwind.designer.vb +++ b/VB/LinqServerModeSource/Northwind.designer.vb @@ -1,4 +1,4 @@ -' Developer Express Code Central Example: +' Developer Express Code Central Example: ' How to implement CRUD operations using XtraGrid and LinqServeModeSource ' ' This example demonstrates how to implement create, update and delete operations @@ -8,9 +8,6 @@ ' ' You can find sample updates and versions for different programming languages here: ' http://www.devexpress.com/example=E4498 - -'INSTANT VB TODO TASK: There is no equivalent to #pragma directives in VB.NET: -'#pragma warning disable 1591 '------------------------------------------------------------------------------ ' ' This code was generated by a tool. @@ -20,779 +17,859 @@ ' the code is regenerated. ' '------------------------------------------------------------------------------ +Imports System.Data.Linq +Imports System.Data.Linq.Mapping +Imports System.Data +Imports System.Collections.Generic +Imports System.Reflection +Imports System.Linq +Imports System.Linq.Expressions +Imports System.ComponentModel +Imports System - -Imports Microsoft.VisualBasic - Imports System.Data.Linq - Imports System.Data.Linq.Mapping - Imports System.Data - Imports System.Collections.Generic - Imports System.Reflection - Imports System.Linq - Imports System.Linq.Expressions - Imports System.ComponentModel - Imports System Namespace LinqServerModeSource + + Public Partial Class NorthwindDataContext + Inherits System.Data.Linq.DataContext + + Private Shared mappingSource As System.Data.Linq.Mapping.MappingSource = New System.Data.Linq.Mapping.AttributeMappingSource() + +#Region "Extensibility Method Definitions" + Partial Private Sub OnCreated() + End Sub + + Partial Private Sub InsertCustomer(ByVal instance As LinqServerModeSource.Customer) + End Sub + + Partial Private Sub UpdateCustomer(ByVal instance As LinqServerModeSource.Customer) + End Sub + + Partial Private Sub DeleteCustomer(ByVal instance As LinqServerModeSource.Customer) + End Sub + + Partial Private Sub InsertOrder(ByVal instance As LinqServerModeSource.Order) + End Sub + + Partial Private Sub UpdateOrder(ByVal instance As LinqServerModeSource.Order) + End Sub + + Partial Private Sub DeleteOrder(ByVal instance As LinqServerModeSource.Order) + End Sub + +#End Region + Public Sub New() + MyBase.New(Global.LinqServerModeSource.Properties.Settings.[Default].NorthwindConnectionString, LinqServerModeSource.NorthwindDataContext.mappingSource) + Me.OnCreated() + End Sub + + Public Sub New(ByVal connection As String) + MyBase.New(connection, LinqServerModeSource.NorthwindDataContext.mappingSource) + Me.OnCreated() + End Sub + + Public Sub New(ByVal connection As System.Data.IDbConnection) + MyBase.New(connection, LinqServerModeSource.NorthwindDataContext.mappingSource) + Me.OnCreated() + End Sub + + Public Sub New(ByVal connection As String, ByVal mappingSource As System.Data.Linq.Mapping.MappingSource) + MyBase.New(connection, mappingSource) + Me.OnCreated() + End Sub + + Public Sub New(ByVal connection As System.Data.IDbConnection, ByVal mappingSource As System.Data.Linq.Mapping.MappingSource) + MyBase.New(connection, mappingSource) + Me.OnCreated() + End Sub + + Public ReadOnly Property Customers As System.Data.Linq.Table(Of LinqServerModeSource.Customer) + Get + Return Me.GetTable(Of LinqServerModeSource.Customer)() + End Get + End Property + + Public ReadOnly Property Orders As System.Data.Linq.Table(Of LinqServerModeSource.Order) + Get + Return Me.GetTable(Of LinqServerModeSource.Order)() + End Get + End Property + End Class + + + Public Partial Class Customer + Implements System.ComponentModel.INotifyPropertyChanging, System.ComponentModel.INotifyPropertyChanged + + Private Shared emptyChangingEventArgs As System.ComponentModel.PropertyChangingEventArgs = New System.ComponentModel.PropertyChangingEventArgs(System.[String].Empty) + + Private _CustomerID As String + + Private _CompanyName As String + + Private _ContactName As String + + Private _ContactTitle As String + + Private _Address As String + + Private _City As String + + Private _Region As String + + Private _PostalCode As String + + Private _Country As String + + Private _Phone As String + + Private _Fax As String + + Private _Orders As System.Data.Linq.EntitySet(Of LinqServerModeSource.Order) + +#Region "Extensibility Method Definitions" + Partial Private Sub OnLoaded() + End Sub + + Partial Private Sub OnValidate(ByVal action As System.Data.Linq.ChangeAction) + End Sub + + Partial Private Sub OnCreated() + End Sub + + Partial Private Sub OnCustomerIDChanging(ByVal value As String) + End Sub + + Partial Private Sub OnCustomerIDChanged() + End Sub + + Partial Private Sub OnCompanyNameChanging(ByVal value As String) + End Sub + + Partial Private Sub OnCompanyNameChanged() + End Sub + + Partial Private Sub OnContactNameChanging(ByVal value As String) + End Sub + + Partial Private Sub OnContactNameChanged() + End Sub + + Partial Private Sub OnContactTitleChanging(ByVal value As String) + End Sub + + Partial Private Sub OnContactTitleChanged() + End Sub + + Partial Private Sub OnAddressChanging(ByVal value As String) + End Sub + + Partial Private Sub OnAddressChanged() + End Sub + + Partial Private Sub OnCityChanging(ByVal value As String) + End Sub + + Partial Private Sub OnCityChanged() + End Sub + + Partial Private Sub OnRegionChanging(ByVal value As String) + End Sub + + Partial Private Sub OnRegionChanged() + End Sub + + Partial Private Sub OnPostalCodeChanging(ByVal value As String) + End Sub + + Partial Private Sub OnPostalCodeChanged() + End Sub + + Partial Private Sub OnCountryChanging(ByVal value As String) + End Sub + + Partial Private Sub OnCountryChanged() + End Sub + + Partial Private Sub OnPhoneChanging(ByVal value As String) + End Sub + + Partial Private Sub OnPhoneChanged() + End Sub + + Partial Private Sub OnFaxChanging(ByVal value As String) + End Sub + + Partial Private Sub OnFaxChanged() + End Sub + +#End Region + Public Sub New() + Me._Orders = New System.Data.Linq.EntitySet(Of LinqServerModeSource.Order)(New System.Action(Of LinqServerModeSource.Order)(AddressOf Me.attach_Orders), New System.Action(Of LinqServerModeSource.Order)(AddressOf Me.detach_Orders)) + Me.OnCreated() + End Sub + + + Public Property CustomerID As String + Get + Return Me._CustomerID + End Get + + Set(ByVal value As String) + If(Not Equals(Me._CustomerID, value)) Then + Me.OnCustomerIDChanging(value) + Me.SendPropertyChanging() + Me._CustomerID = value + Me.SendPropertyChanged("CustomerID") + Me.OnCustomerIDChanged() + End If + End Set + End Property + + + Public Property CompanyName As String + Get + Return Me._CompanyName + End Get + + Set(ByVal value As String) + If(Not Equals(Me._CompanyName, value)) Then + Me.OnCompanyNameChanging(value) + Me.SendPropertyChanging() + Me._CompanyName = value + Me.SendPropertyChanged("CompanyName") + Me.OnCompanyNameChanged() + End If + End Set + End Property + + + Public Property ContactName As String + Get + Return Me._ContactName + End Get + + Set(ByVal value As String) + If(Not Equals(Me._ContactName, value)) Then + Me.OnContactNameChanging(value) + Me.SendPropertyChanging() + Me._ContactName = value + Me.SendPropertyChanged("ContactName") + Me.OnContactNameChanged() + End If + End Set + End Property + + + Public Property ContactTitle As String + Get + Return Me._ContactTitle + End Get + + Set(ByVal value As String) + If(Not Equals(Me._ContactTitle, value)) Then + Me.OnContactTitleChanging(value) + Me.SendPropertyChanging() + Me._ContactTitle = value + Me.SendPropertyChanged("ContactTitle") + Me.OnContactTitleChanged() + End If + End Set + End Property + + + Public Property Address As String + Get + Return Me._Address + End Get + + Set(ByVal value As String) + If(Not Equals(Me._Address, value)) Then + Me.OnAddressChanging(value) + Me.SendPropertyChanging() + Me._Address = value + Me.SendPropertyChanged("Address") + Me.OnAddressChanged() + End If + End Set + End Property + + + Public Property City As String + Get + Return Me._City + End Get + + Set(ByVal value As String) + If(Not Equals(Me._City, value)) Then + Me.OnCityChanging(value) + Me.SendPropertyChanging() + Me._City = value + Me.SendPropertyChanged("City") + Me.OnCityChanged() + End If + End Set + End Property + + + Public Property Region As String + Get + Return Me._Region + End Get + + Set(ByVal value As String) + If(Not Equals(Me._Region, value)) Then + Me.OnRegionChanging(value) + Me.SendPropertyChanging() + Me._Region = value + Me.SendPropertyChanged("Region") + Me.OnRegionChanged() + End If + End Set + End Property + + + Public Property PostalCode As String + Get + Return Me._PostalCode + End Get + + Set(ByVal value As String) + If(Not Equals(Me._PostalCode, value)) Then + Me.OnPostalCodeChanging(value) + Me.SendPropertyChanging() + Me._PostalCode = value + Me.SendPropertyChanged("PostalCode") + Me.OnPostalCodeChanged() + End If + End Set + End Property + + + Public Property Country As String + Get + Return Me._Country + End Get + + Set(ByVal value As String) + If(Not Equals(Me._Country, value)) Then + Me.OnCountryChanging(value) + Me.SendPropertyChanging() + Me._Country = value + Me.SendPropertyChanged("Country") + Me.OnCountryChanged() + End If + End Set + End Property + + + Public Property Phone As String + Get + Return Me._Phone + End Get + + Set(ByVal value As String) + If(Not Equals(Me._Phone, value)) Then + Me.OnPhoneChanging(value) + Me.SendPropertyChanging() + Me._Phone = value + Me.SendPropertyChanged("Phone") + Me.OnPhoneChanged() + End If + End Set + End Property + + + Public Property Fax As String + Get + Return Me._Fax + End Get + + Set(ByVal value As String) + If(Not Equals(Me._Fax, value)) Then + Me.OnFaxChanging(value) + Me.SendPropertyChanging() + Me._Fax = value + Me.SendPropertyChanged("Fax") + Me.OnFaxChanged() + End If + End Set + End Property + + + Public Property Orders As EntitySet(Of LinqServerModeSource.Order) + Get + Return Me._Orders + End Get + + Set(ByVal value As EntitySet(Of LinqServerModeSource.Order)) + Me._Orders.Assign(value) + End Set + End Property + + Public Event PropertyChanging As System.ComponentModel.PropertyChangingEventHandler Implements Global.System.ComponentModel.INotifyPropertyChanging.PropertyChanging + + Public Event PropertyChanged As System.ComponentModel.PropertyChangedEventHandler Implements Global.System.ComponentModel.INotifyPropertyChanged.PropertyChanged + + Protected Overridable Sub SendPropertyChanging() + RaiseEvent PropertyChanging(Me, LinqServerModeSource.Customer.emptyChangingEventArgs) + End Sub + + Protected Overridable Sub SendPropertyChanged(ByVal propertyName As System.[String]) + RaiseEvent PropertyChanged(Me, New System.ComponentModel.PropertyChangedEventArgs(propertyName)) + End Sub + + Private Sub attach_Orders(ByVal entity As LinqServerModeSource.Order) + Me.SendPropertyChanging() + entity.Customer = Me + End Sub + + Private Sub detach_Orders(ByVal entity As LinqServerModeSource.Order) + Me.SendPropertyChanging() + entity.Customer = Nothing + End Sub + End Class + + + Public Partial Class Order + Implements System.ComponentModel.INotifyPropertyChanging, System.ComponentModel.INotifyPropertyChanged + + Private Shared emptyChangingEventArgs As System.ComponentModel.PropertyChangingEventArgs = New System.ComponentModel.PropertyChangingEventArgs(System.[String].Empty) + + Private _OrderID As Integer + + Private _CustomerID As String + + Private _EmployeeID As System.Nullable(Of Integer) + + Private _OrderDate As System.Nullable(Of System.DateTime) + + Private _RequiredDate As System.Nullable(Of System.DateTime) + + Private _ShippedDate As System.Nullable(Of System.DateTime) + + Private _ShipVia As System.Nullable(Of Integer) + + Private _Freight As System.Nullable(Of Decimal) + + Private _ShipName As String + + Private _ShipAddress As String + + Private _ShipCity As String + + Private _ShipRegion As String + + Private _ShipPostalCode As String + + Private _ShipCountry As String + + Private _ShipAdress As String + + Private _Customer As System.Data.Linq.EntityRef(Of LinqServerModeSource.Customer) + +#Region "Extensibility Method Definitions" + Partial Private Sub OnLoaded() + End Sub + + Partial Private Sub OnValidate(ByVal action As System.Data.Linq.ChangeAction) + End Sub + + Partial Private Sub OnCreated() + End Sub + + Partial Private Sub OnOrderIDChanging(ByVal value As Integer) + End Sub + + Partial Private Sub OnOrderIDChanged() + End Sub + + Partial Private Sub OnCustomerIDChanging(ByVal value As String) + End Sub + + Partial Private Sub OnCustomerIDChanged() + End Sub + + Partial Private Sub OnEmployeeIDChanging(ByVal value As System.Nullable(Of Integer)) + End Sub + + Partial Private Sub OnEmployeeIDChanged() + End Sub + + Partial Private Sub OnOrderDateChanging(ByVal value As System.Nullable(Of System.DateTime)) + End Sub + + Partial Private Sub OnOrderDateChanged() + End Sub + + Partial Private Sub OnRequiredDateChanging(ByVal value As System.Nullable(Of System.DateTime)) + End Sub + + Partial Private Sub OnRequiredDateChanged() + End Sub + + Partial Private Sub OnShippedDateChanging(ByVal value As System.Nullable(Of System.DateTime)) + End Sub + + Partial Private Sub OnShippedDateChanged() + End Sub + + Partial Private Sub OnShipViaChanging(ByVal value As System.Nullable(Of Integer)) + End Sub + + Partial Private Sub OnShipViaChanged() + End Sub + + Partial Private Sub OnFreightChanging(ByVal value As System.Nullable(Of Decimal)) + End Sub + + Partial Private Sub OnFreightChanged() + End Sub + + Partial Private Sub OnShipNameChanging(ByVal value As String) + End Sub + + Partial Private Sub OnShipNameChanged() + End Sub + + Partial Private Sub OnShipAddressChanging(ByVal value As String) + End Sub + + Partial Private Sub OnShipAddressChanged() + End Sub + + Partial Private Sub OnShipCityChanging(ByVal value As String) + End Sub + + Partial Private Sub OnShipCityChanged() + End Sub + + Partial Private Sub OnShipRegionChanging(ByVal value As String) + End Sub + + Partial Private Sub OnShipRegionChanged() + End Sub + + Partial Private Sub OnShipPostalCodeChanging(ByVal value As String) + End Sub - _ - Partial Public Class NorthwindDataContext - Inherits System.Data.Linq.DataContext + Partial Private Sub OnShipPostalCodeChanged() + End Sub - Private Shared mappingSource As System.Data.Linq.Mapping.MappingSource = New AttributeMappingSource() - - #Region "Extensibility Method Definitions" - Partial Private Sub OnCreated() - End Sub - Partial Private Sub InsertCustomer(ByVal instance As Customer) - End Sub - Partial Private Sub UpdateCustomer(ByVal instance As Customer) - End Sub - Partial Private Sub DeleteCustomer(ByVal instance As Customer) - End Sub - Partial Private Sub InsertOrder(ByVal instance As Order) - End Sub - Partial Private Sub UpdateOrder(ByVal instance As Order) - End Sub - Partial Private Sub DeleteOrder(ByVal instance As Order) - End Sub - #End Region - - Public Sub New() - MyBase.New(My.Settings.Default.NorthwindConnectionString, mappingSource) - OnCreated() - End Sub - - Public Sub New(ByVal connection As String) - MyBase.New(connection, mappingSource) - OnCreated() - End Sub - - Public Sub New(ByVal connection As System.Data.IDbConnection) - MyBase.New(connection, mappingSource) - OnCreated() - End Sub - - Public Sub New(ByVal connection As String, ByVal mappingSource As System.Data.Linq.Mapping.MappingSource) - MyBase.New(connection, mappingSource) - OnCreated() - End Sub - - Public Sub New(ByVal connection As System.Data.IDbConnection, ByVal mappingSource As System.Data.Linq.Mapping.MappingSource) - MyBase.New(connection, mappingSource) - OnCreated() - End Sub - - Public ReadOnly Property Customers() As System.Data.Linq.Table(Of Customer) - Get - Return Me.GetTable(Of Customer)() - End Get - End Property - - Public ReadOnly Property Orders() As System.Data.Linq.Table(Of Order) - Get - Return Me.GetTable(Of Order)() - End Get - End Property - End Class - - _ - Partial Public Class Customer - Implements INotifyPropertyChanging, INotifyPropertyChanged - - Private Shared emptyChangingEventArgs As New PropertyChangingEventArgs(String.Empty) - - Private _CustomerID As String - - Private _CompanyName As String - - Private _ContactName As String - - Private _ContactTitle As String - - Private _Address As String - - Private _City As String - - Private _Region As String - - Private _PostalCode As String - - Private _Country As String - - Private _Phone As String - - Private _Fax As String - - Private _Orders As EntitySet(Of Order) - - #Region "Extensibility Method Definitions" - Partial Private Sub OnLoaded() - End Sub - Partial Private Sub OnValidate(ByVal action As System.Data.Linq.ChangeAction) - End Sub - Partial Private Sub OnCreated() - End Sub - Partial Private Sub OnCustomerIDChanging(ByVal value As String) - End Sub - Partial Private Sub OnCustomerIDChanged() - End Sub - Partial Private Sub OnCompanyNameChanging(ByVal value As String) - End Sub - Partial Private Sub OnCompanyNameChanged() - End Sub - Partial Private Sub OnContactNameChanging(ByVal value As String) - End Sub - Partial Private Sub OnContactNameChanged() - End Sub - Partial Private Sub OnContactTitleChanging(ByVal value As String) - End Sub - Partial Private Sub OnContactTitleChanged() - End Sub - Partial Private Sub OnAddressChanging(ByVal value As String) - End Sub - Partial Private Sub OnAddressChanged() - End Sub - Partial Private Sub OnCityChanging(ByVal value As String) - End Sub - Partial Private Sub OnCityChanged() - End Sub - Partial Private Sub OnRegionChanging(ByVal value As String) - End Sub - Partial Private Sub OnRegionChanged() - End Sub - Partial Private Sub OnPostalCodeChanging(ByVal value As String) - End Sub - Partial Private Sub OnPostalCodeChanged() - End Sub - Partial Private Sub OnCountryChanging(ByVal value As String) - End Sub - Partial Private Sub OnCountryChanged() - End Sub - Partial Private Sub OnPhoneChanging(ByVal value As String) - End Sub - Partial Private Sub OnPhoneChanged() - End Sub - Partial Private Sub OnFaxChanging(ByVal value As String) - End Sub - Partial Private Sub OnFaxChanged() - End Sub - #End Region - - Public Sub New() - Me._Orders = New EntitySet(Of Order)(New Action(Of Order)(AddressOf Me.attach_Orders), New Action(Of Order)(AddressOf Me.detach_Orders)) - OnCreated() - End Sub - - _ - Public Property CustomerID() As String - Get - Return Me._CustomerID - End Get - Set(ByVal value As String) - If (Me._CustomerID <> value) Then - Me.OnCustomerIDChanging(value) - Me.SendPropertyChanging() - Me._CustomerID = value - Me.SendPropertyChanged("CustomerID") - Me.OnCustomerIDChanged() - End If - End Set - End Property - - _ - Public Property CompanyName() As String - Get - Return Me._CompanyName - End Get - Set(ByVal value As String) - If (Me._CompanyName <> value) Then - Me.OnCompanyNameChanging(value) - Me.SendPropertyChanging() - Me._CompanyName = value - Me.SendPropertyChanged("CompanyName") - Me.OnCompanyNameChanged() - End If - End Set - End Property - - _ - Public Property ContactName() As String - Get - Return Me._ContactName - End Get - Set(ByVal value As String) - If (Me._ContactName <> value) Then - Me.OnContactNameChanging(value) - Me.SendPropertyChanging() - Me._ContactName = value - Me.SendPropertyChanged("ContactName") - Me.OnContactNameChanged() - End If - End Set - End Property - - _ - Public Property ContactTitle() As String - Get - Return Me._ContactTitle - End Get - Set(ByVal value As String) - If (Me._ContactTitle <> value) Then - Me.OnContactTitleChanging(value) - Me.SendPropertyChanging() - Me._ContactTitle = value - Me.SendPropertyChanged("ContactTitle") - Me.OnContactTitleChanged() - End If - End Set - End Property - - _ - Public Property Address() As String - Get - Return Me._Address - End Get - Set(ByVal value As String) - If (Me._Address <> value) Then - Me.OnAddressChanging(value) - Me.SendPropertyChanging() - Me._Address = value - Me.SendPropertyChanged("Address") - Me.OnAddressChanged() - End If - End Set - End Property - - _ - Public Property City() As String - Get - Return Me._City - End Get - Set(ByVal value As String) - If (Me._City <> value) Then - Me.OnCityChanging(value) - Me.SendPropertyChanging() - Me._City = value - Me.SendPropertyChanged("City") - Me.OnCityChanged() - End If - End Set - End Property - - _ - Public Property Region() As String - Get - Return Me._Region - End Get - Set(ByVal value As String) - If (Me._Region <> value) Then - Me.OnRegionChanging(value) - Me.SendPropertyChanging() - Me._Region = value - Me.SendPropertyChanged("Region") - Me.OnRegionChanged() - End If - End Set - End Property - - _ - Public Property PostalCode() As String - Get - Return Me._PostalCode - End Get - Set(ByVal value As String) - If (Me._PostalCode <> value) Then - Me.OnPostalCodeChanging(value) - Me.SendPropertyChanging() - Me._PostalCode = value - Me.SendPropertyChanged("PostalCode") - Me.OnPostalCodeChanged() - End If - End Set - End Property - - _ - Public Property Country() As String - Get - Return Me._Country - End Get - Set(ByVal value As String) - If (Me._Country <> value) Then - Me.OnCountryChanging(value) - Me.SendPropertyChanging() - Me._Country = value - Me.SendPropertyChanged("Country") - Me.OnCountryChanged() - End If - End Set - End Property - - _ - Public Property Phone() As String - Get - Return Me._Phone - End Get - Set(ByVal value As String) - If (Me._Phone <> value) Then - Me.OnPhoneChanging(value) - Me.SendPropertyChanging() - Me._Phone = value - Me.SendPropertyChanged("Phone") - Me.OnPhoneChanged() - End If - End Set - End Property - - _ - Public Property Fax() As String - Get - Return Me._Fax - End Get - Set(ByVal value As String) - If (Me._Fax <> value) Then - Me.OnFaxChanging(value) - Me.SendPropertyChanging() - Me._Fax = value - Me.SendPropertyChanged("Fax") - Me.OnFaxChanged() - End If - End Set - End Property - - _ - Public Property Orders() As EntitySet(Of Order) - Get - Return Me._Orders - End Get - Set(ByVal value As EntitySet(Of Order)) - Me._Orders.Assign(value) - End Set - End Property - - Public Event PropertyChanging As PropertyChangingEventHandler Implements INotifyPropertyChanging.PropertyChanging - - Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged - - Protected Overridable Sub SendPropertyChanging() - If (Me.PropertyChangingEvent IsNot Nothing) Then - RaiseEvent PropertyChanging(Me, emptyChangingEventArgs) - End If - End Sub - - Protected Overridable Sub SendPropertyChanged(ByVal propertyName As String) - If (Me.PropertyChangedEvent IsNot Nothing) Then - RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(propertyName)) - End If - End Sub - - Private Sub attach_Orders(ByVal entity As Order) - Me.SendPropertyChanging() - entity.Customer = Me - End Sub - - Private Sub detach_Orders(ByVal entity As Order) - Me.SendPropertyChanging() - entity.Customer = Nothing - End Sub - End Class - - _ - Partial Public Class Order - Implements INotifyPropertyChanging, INotifyPropertyChanged - - Private Shared emptyChangingEventArgs As New PropertyChangingEventArgs(String.Empty) - - Private _OrderID As Integer - - Private _CustomerID As String - - Private _EmployeeID? As Integer - - Private _OrderDate? As System.DateTime - - Private _RequiredDate? As System.DateTime - - Private _ShippedDate? As System.DateTime - - Private _ShipVia? As Integer - - Private _Freight? As Decimal - - Private _ShipName As String - - Private _ShipAddress As String - - Private _ShipCity As String - - Private _ShipRegion As String - - Private _ShipPostalCode As String - - Private _ShipCountry As String - - Private _ShipAdress As String - - Private _Customer As EntityRef(Of Customer) - - #Region "Extensibility Method Definitions" - Partial Private Sub OnLoaded() - End Sub - Partial Private Sub OnValidate(ByVal action As System.Data.Linq.ChangeAction) - End Sub - Partial Private Sub OnCreated() - End Sub - Partial Private Sub OnOrderIDChanging(ByVal value As Integer) - End Sub - Partial Private Sub OnOrderIDChanged() - End Sub - Partial Private Sub OnCustomerIDChanging(ByVal value As String) - End Sub - Partial Private Sub OnCustomerIDChanged() - End Sub - Partial Private Sub OnEmployeeIDChanging(ByVal value? As Integer) - End Sub - Partial Private Sub OnEmployeeIDChanged() - End Sub - Partial Private Sub OnOrderDateChanging(ByVal value? As System.DateTime) - End Sub - Partial Private Sub OnOrderDateChanged() - End Sub - Partial Private Sub OnRequiredDateChanging(ByVal value? As System.DateTime) - End Sub - Partial Private Sub OnRequiredDateChanged() - End Sub - Partial Private Sub OnShippedDateChanging(ByVal value? As System.DateTime) - End Sub - Partial Private Sub OnShippedDateChanged() - End Sub - Partial Private Sub OnShipViaChanging(ByVal value? As Integer) - End Sub - Partial Private Sub OnShipViaChanged() - End Sub - Partial Private Sub OnFreightChanging(ByVal value? As Decimal) - End Sub - Partial Private Sub OnFreightChanged() - End Sub - Partial Private Sub OnShipNameChanging(ByVal value As String) - End Sub - Partial Private Sub OnShipNameChanged() - End Sub - Partial Private Sub OnShipAddressChanging(ByVal value As String) - End Sub - Partial Private Sub OnShipAddressChanged() - End Sub - Partial Private Sub OnShipCityChanging(ByVal value As String) - End Sub - Partial Private Sub OnShipCityChanged() - End Sub - Partial Private Sub OnShipRegionChanging(ByVal value As String) - End Sub - Partial Private Sub OnShipRegionChanged() - End Sub - Partial Private Sub OnShipPostalCodeChanging(ByVal value As String) - End Sub - Partial Private Sub OnShipPostalCodeChanged() - End Sub - Partial Private Sub OnShipCountryChanging(ByVal value As String) - End Sub - Partial Private Sub OnShipCountryChanged() - End Sub - Partial Private Sub OnShipAdressChanging(ByVal value As String) - End Sub - Partial Private Sub OnShipAdressChanged() - End Sub - #End Region - - Public Sub New() - Me._Customer = Nothing - OnCreated() - End Sub - - _ - Public Property OrderID() As Integer - Get - Return Me._OrderID - End Get - Set(ByVal value As Integer) - If (Me._OrderID <> value) Then - Me.OnOrderIDChanging(value) - Me.SendPropertyChanging() - Me._OrderID = value - Me.SendPropertyChanged("OrderID") - Me.OnOrderIDChanged() - End If - End Set - End Property - - _ - Public Property CustomerID() As String - Get - Return Me._CustomerID - End Get - Set(ByVal value As String) - If (Me._CustomerID <> value) Then - If Me._Customer.HasLoadedOrAssignedValue Then - Throw New System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException() - End If - Me.OnCustomerIDChanging(value) - Me.SendPropertyChanging() - Me._CustomerID = value - Me.SendPropertyChanged("CustomerID") - Me.OnCustomerIDChanged() - End If - End Set - End Property - - _ - Public Property EmployeeID() As Integer? - Get - Return Me._EmployeeID - End Get - Set(ByVal value? As Integer) - If (Not Me._EmployeeID.Equals(value)) Then - Me.OnEmployeeIDChanging(value) - Me.SendPropertyChanging() - Me._EmployeeID = value - Me.SendPropertyChanged("EmployeeID") - Me.OnEmployeeIDChanged() - End If - End Set - End Property - - _ - Public Property OrderDate() As System.DateTime? - Get - Return Me._OrderDate - End Get - Set(ByVal value? As System.DateTime) - If (Not Me._OrderDate.Equals(value)) Then - Me.OnOrderDateChanging(value) - Me.SendPropertyChanging() - Me._OrderDate = value - Me.SendPropertyChanged("OrderDate") - Me.OnOrderDateChanged() - End If - End Set - End Property - - _ - Public Property RequiredDate() As System.DateTime? - Get - Return Me._RequiredDate - End Get - Set(ByVal value? As System.DateTime) - If (Not Me._RequiredDate.Equals(value)) Then - Me.OnRequiredDateChanging(value) - Me.SendPropertyChanging() - Me._RequiredDate = value - Me.SendPropertyChanged("RequiredDate") - Me.OnRequiredDateChanged() - End If - End Set - End Property - - _ - Public Property ShippedDate() As System.DateTime? - Get - Return Me._ShippedDate - End Get - Set(ByVal value? As System.DateTime) - If (Not Me._ShippedDate.Equals(value)) Then - Me.OnShippedDateChanging(value) - Me.SendPropertyChanging() - Me._ShippedDate = value - Me.SendPropertyChanged("ShippedDate") - Me.OnShippedDateChanged() - End If - End Set - End Property - - _ - Public Property ShipVia() As Integer? - Get - Return Me._ShipVia - End Get - Set(ByVal value? As Integer) - If (Not Me._ShipVia.Equals(value)) Then - Me.OnShipViaChanging(value) - Me.SendPropertyChanging() - Me._ShipVia = value - Me.SendPropertyChanged("ShipVia") - Me.OnShipViaChanged() - End If - End Set - End Property - - _ - Public Property Freight() As Decimal? - Get - Return Me._Freight - End Get - Set(ByVal value? As Decimal) - If (Not Me._Freight.Equals(value)) Then - Me.OnFreightChanging(value) - Me.SendPropertyChanging() - Me._Freight = value - Me.SendPropertyChanged("Freight") - Me.OnFreightChanged() - End If - End Set - End Property - - _ - Public Property ShipName() As String - Get - Return Me._ShipName - End Get - Set(ByVal value As String) - If (Me._ShipName <> value) Then - Me.OnShipNameChanging(value) - Me.SendPropertyChanging() - Me._ShipName = value - Me.SendPropertyChanged("ShipName") - Me.OnShipNameChanged() - End If - End Set - End Property - - _ - Public Property ShipAddress() As String - Get - Return Me._ShipAddress - End Get - Set(ByVal value As String) - If (Me._ShipAddress <> value) Then - Me.OnShipAddressChanging(value) - Me.SendPropertyChanging() - Me._ShipAddress = value - Me.SendPropertyChanged("ShipAddress") - Me.OnShipAddressChanged() - End If - End Set - End Property - - _ - Public Property ShipCity() As String - Get - Return Me._ShipCity - End Get - Set(ByVal value As String) - If (Me._ShipCity <> value) Then - Me.OnShipCityChanging(value) - Me.SendPropertyChanging() - Me._ShipCity = value - Me.SendPropertyChanged("ShipCity") - Me.OnShipCityChanged() - End If - End Set - End Property - - _ - Public Property ShipRegion() As String - Get - Return Me._ShipRegion - End Get - Set(ByVal value As String) - If (Me._ShipRegion <> value) Then - Me.OnShipRegionChanging(value) - Me.SendPropertyChanging() - Me._ShipRegion = value - Me.SendPropertyChanged("ShipRegion") - Me.OnShipRegionChanged() - End If - End Set - End Property - - _ - Public Property ShipPostalCode() As String - Get - Return Me._ShipPostalCode - End Get - Set(ByVal value As String) - If (Me._ShipPostalCode <> value) Then - Me.OnShipPostalCodeChanging(value) - Me.SendPropertyChanging() - Me._ShipPostalCode = value - Me.SendPropertyChanged("ShipPostalCode") - Me.OnShipPostalCodeChanged() - End If - End Set - End Property - - _ - Public Property ShipCountry() As String - Get - Return Me._ShipCountry - End Get - Set(ByVal value As String) - If (Me._ShipCountry <> value) Then - Me.OnShipCountryChanging(value) - Me.SendPropertyChanging() - Me._ShipCountry = value - Me.SendPropertyChanged("ShipCountry") - Me.OnShipCountryChanged() - End If - End Set - End Property - - _ - Public Property ShipAdress() As String - Get - Return Me._ShipAdress - End Get - Set(ByVal value As String) - If (Me._ShipAdress <> value) Then - Me.OnShipAdressChanging(value) - Me.SendPropertyChanging() - Me._ShipAdress = value - Me.SendPropertyChanged("ShipAdress") - Me.OnShipAdressChanged() - End If - End Set - End Property - - _ - Public Property Customer() As Customer - Get - Return Me._Customer.Entity - End Get - Set(ByVal value As Customer) - Dim previousValue As Customer = Me._Customer.Entity - If ((previousValue IsNot value) OrElse (Me._Customer.HasLoadedOrAssignedValue = False)) Then - Me.SendPropertyChanging() - If (previousValue IsNot Nothing) Then - Me._Customer.Entity = Nothing - previousValue.Orders.Remove(Me) - End If - Me._Customer.Entity = value - If (value IsNot Nothing) Then - value.Orders.Add(Me) - Me._CustomerID = value.CustomerID - Else - Me._CustomerID = Nothing - End If - Me.SendPropertyChanged("Customer") - End If - End Set - End Property - - Public Event PropertyChanging As PropertyChangingEventHandler Implements INotifyPropertyChanging.PropertyChanging - - Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged - - Protected Overridable Sub SendPropertyChanging() - If (Me.PropertyChangingEvent IsNot Nothing) Then - RaiseEvent PropertyChanging(Me, emptyChangingEventArgs) - End If - End Sub - - Protected Overridable Sub SendPropertyChanged(ByVal propertyName As String) - If (Me.PropertyChangedEvent IsNot Nothing) Then - RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(propertyName)) - End If - End Sub - End Class + Partial Private Sub OnShipCountryChanging(ByVal value As String) + End Sub + + Partial Private Sub OnShipCountryChanged() + End Sub + + Partial Private Sub OnShipAdressChanging(ByVal value As String) + End Sub + + Partial Private Sub OnShipAdressChanged() + End Sub + +#End Region + Public Sub New() + Me._Customer = DirectCast(Nothing, Global.System.Data.Linq.EntityRef(Of Global.LinqServerModeSource.Customer)) + Me.OnCreated() + End Sub + + + Public Property OrderID As Integer + Get + Return Me._OrderID + End Get + + Set(ByVal value As Integer) + If(Me._OrderID <> value) Then + Me.OnOrderIDChanging(value) + Me.SendPropertyChanging() + Me._OrderID = value + Me.SendPropertyChanged("OrderID") + Me.OnOrderIDChanged() + End If + End Set + End Property + + + Public Property CustomerID As String + Get + Return Me._CustomerID + End Get + + Set(ByVal value As String) + If(Not Equals(Me._CustomerID, value)) Then + If Me._Customer.HasLoadedOrAssignedValue Then + Throw New System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException() + End If + + Me.OnCustomerIDChanging(value) + Me.SendPropertyChanging() + Me._CustomerID = value + Me.SendPropertyChanged("CustomerID") + Me.OnCustomerIDChanged() + End If + End Set + End Property + + + Public Property EmployeeID As System.Nullable(Of Integer) + Get + Return Me._EmployeeID + End Get + + Set(ByVal value As System.Nullable(Of Integer)) + If(Me._EmployeeID <> value) Then + Me.OnEmployeeIDChanging(value) + Me.SendPropertyChanging() + Me._EmployeeID = value + Me.SendPropertyChanged("EmployeeID") + Me.OnEmployeeIDChanged() + End If + End Set + End Property + + + Public Property OrderDate As System.Nullable(Of System.DateTime) + Get + Return Me._OrderDate + End Get + + Set(ByVal value As System.Nullable(Of System.DateTime)) + If(Me._OrderDate <> value) Then + Me.OnOrderDateChanging(value) + Me.SendPropertyChanging() + Me._OrderDate = value + Me.SendPropertyChanged("OrderDate") + Me.OnOrderDateChanged() + End If + End Set + End Property + + + Public Property RequiredDate As System.Nullable(Of System.DateTime) + Get + Return Me._RequiredDate + End Get + + Set(ByVal value As System.Nullable(Of System.DateTime)) + If(Me._RequiredDate <> value) Then + Me.OnRequiredDateChanging(value) + Me.SendPropertyChanging() + Me._RequiredDate = value + Me.SendPropertyChanged("RequiredDate") + Me.OnRequiredDateChanged() + End If + End Set + End Property + + + Public Property ShippedDate As System.Nullable(Of System.DateTime) + Get + Return Me._ShippedDate + End Get + + Set(ByVal value As System.Nullable(Of System.DateTime)) + If(Me._ShippedDate <> value) Then + Me.OnShippedDateChanging(value) + Me.SendPropertyChanging() + Me._ShippedDate = value + Me.SendPropertyChanged("ShippedDate") + Me.OnShippedDateChanged() + End If + End Set + End Property + + + Public Property ShipVia As System.Nullable(Of Integer) + Get + Return Me._ShipVia + End Get + + Set(ByVal value As System.Nullable(Of Integer)) + If(Me._ShipVia <> value) Then + Me.OnShipViaChanging(value) + Me.SendPropertyChanging() + Me._ShipVia = value + Me.SendPropertyChanged("ShipVia") + Me.OnShipViaChanged() + End If + End Set + End Property + + + Public Property Freight As System.Nullable(Of Decimal) + Get + Return Me._Freight + End Get + + Set(ByVal value As System.Nullable(Of Decimal)) + If(Me._Freight <> value) Then + Me.OnFreightChanging(value) + Me.SendPropertyChanging() + Me._Freight = value + Me.SendPropertyChanged("Freight") + Me.OnFreightChanged() + End If + End Set + End Property + + + Public Property ShipName As String + Get + Return Me._ShipName + End Get + + Set(ByVal value As String) + If(Not Equals(Me._ShipName, value)) Then + Me.OnShipNameChanging(value) + Me.SendPropertyChanging() + Me._ShipName = value + Me.SendPropertyChanged("ShipName") + Me.OnShipNameChanged() + End If + End Set + End Property + + + Public Property ShipAddress As String + Get + Return Me._ShipAddress + End Get + + Set(ByVal value As String) + If(Not Equals(Me._ShipAddress, value)) Then + Me.OnShipAddressChanging(value) + Me.SendPropertyChanging() + Me._ShipAddress = value + Me.SendPropertyChanged("ShipAddress") + Me.OnShipAddressChanged() + End If + End Set + End Property + + + Public Property ShipCity As String + Get + Return Me._ShipCity + End Get + + Set(ByVal value As String) + If(Not Equals(Me._ShipCity, value)) Then + Me.OnShipCityChanging(value) + Me.SendPropertyChanging() + Me._ShipCity = value + Me.SendPropertyChanged("ShipCity") + Me.OnShipCityChanged() + End If + End Set + End Property + + + Public Property ShipRegion As String + Get + Return Me._ShipRegion + End Get + + Set(ByVal value As String) + If(Not Equals(Me._ShipRegion, value)) Then + Me.OnShipRegionChanging(value) + Me.SendPropertyChanging() + Me._ShipRegion = value + Me.SendPropertyChanged("ShipRegion") + Me.OnShipRegionChanged() + End If + End Set + End Property + + + Public Property ShipPostalCode As String + Get + Return Me._ShipPostalCode + End Get + + Set(ByVal value As String) + If(Not Equals(Me._ShipPostalCode, value)) Then + Me.OnShipPostalCodeChanging(value) + Me.SendPropertyChanging() + Me._ShipPostalCode = value + Me.SendPropertyChanged("ShipPostalCode") + Me.OnShipPostalCodeChanged() + End If + End Set + End Property + + + Public Property ShipCountry As String + Get + Return Me._ShipCountry + End Get + + Set(ByVal value As String) + If(Not Equals(Me._ShipCountry, value)) Then + Me.OnShipCountryChanging(value) + Me.SendPropertyChanging() + Me._ShipCountry = value + Me.SendPropertyChanged("ShipCountry") + Me.OnShipCountryChanged() + End If + End Set + End Property + + + Public Property ShipAdress As String + Get + Return Me._ShipAdress + End Get + + Set(ByVal value As String) + If(Not Equals(Me._ShipAdress, value)) Then + Me.OnShipAdressChanging(value) + Me.SendPropertyChanging() + Me._ShipAdress = value + Me.SendPropertyChanged("ShipAdress") + Me.OnShipAdressChanged() + End If + End Set + End Property + + + Public Property Customer As Customer + Get + Return Me._Customer.Entity + End Get + + Set(ByVal value As Customer) + Dim previousValue As LinqServerModeSource.Customer = Me._Customer.Entity + If((previousValue IsNot value) OrElse (Me._Customer.HasLoadedOrAssignedValue = False)) Then + Me.SendPropertyChanging() + If(previousValue IsNot Nothing) Then + Me._Customer.Entity = Nothing + previousValue.Orders.Remove(Me) + End If + + Me._Customer.Entity = value + If(value IsNot Nothing) Then + value.Orders.Add(Me) + Me._CustomerID = value.CustomerID + Else + Me._CustomerID = DirectCast(Nothing, System.String) + End If + + Me.SendPropertyChanged("Customer") + End If + End Set + End Property + + Public Event PropertyChanging As System.ComponentModel.PropertyChangingEventHandler Implements Global.System.ComponentModel.INotifyPropertyChanging.PropertyChanging + + Public Event PropertyChanged As System.ComponentModel.PropertyChangedEventHandler Implements Global.System.ComponentModel.INotifyPropertyChanged.PropertyChanged + + Protected Overridable Sub SendPropertyChanging() + RaiseEvent PropertyChanging(Me, LinqServerModeSource.Order.emptyChangingEventArgs) + End Sub + + Protected Overridable Sub SendPropertyChanged(ByVal propertyName As System.[String]) + RaiseEvent PropertyChanged(Me, New System.ComponentModel.PropertyChangedEventArgs(propertyName)) + End Sub + End Class End Namespace -'INSTANT VB TODO TASK: There is no equivalent to #pragma directives in VB.NET: -'#pragma warning restore 1591 diff --git a/VB/LinqServerModeSource/Person.vb b/VB/LinqServerModeSource/Person.vb index c7c6100..af42da1 100644 --- a/VB/LinqServerModeSource/Person.vb +++ b/VB/LinqServerModeSource/Person.vb @@ -1,4 +1,4 @@ -' Developer Express Code Central Example: +' Developer Express Code Central Example: ' How to implement CRUD operations using XtraGrid and LinqServeModeSource ' ' This example demonstrates how to implement create, update and delete operations @@ -8,47 +8,55 @@ ' ' You can find sample updates and versions for different programming languages here: ' http://www.devexpress.com/example=E4498 +Namespace LinqServerModeSource -Imports Microsoft.VisualBasic -Imports System + Friend Class Person -Namespace LinqServerModeSource - Friend Class Person - Private firstName_Renamed As String - Private secondName_Renamed As String - Private comments_Renamed As String - Public Sub New(ByVal firstName As String, ByVal secondName As String) - Me.firstName_Renamed = firstName - Me.secondName_Renamed = secondName - comments_Renamed = String.Empty - End Sub - Public Sub New(ByVal firstName As String, ByVal secondName As String, ByVal comments As String) - Me.New(firstName, secondName) - Me.comments_Renamed = comments - End Sub - Public Property FirstName() As String - Get - Return firstName_Renamed - End Get - Set(ByVal value As String) - firstName_Renamed = value - End Set - End Property - Public Property SecondName() As String - Get - Return secondName_Renamed - End Get - Set(ByVal value As String) - secondName_Renamed = value - End Set - End Property - Public Property Comments() As String - Get - Return comments_Renamed - End Get - Set(ByVal value As String) - comments_Renamed = value - End Set - End Property - End Class -End Namespace \ No newline at end of file + Private firstNameField As String + + Private secondNameField As String + + Private commentsField As String + + Public Sub New(ByVal firstName As String, ByVal secondName As String) + firstNameField = firstName + secondNameField = secondName + commentsField = String.Empty + End Sub + + Public Sub New(ByVal firstName As String, ByVal secondName As String, ByVal comments As String) + Me.New(firstName, secondName) + commentsField = comments + End Sub + + Public Property FirstName As String + Get + Return firstNameField + End Get + + Set(ByVal value As String) + firstNameField = value + End Set + End Property + + Public Property SecondName As String + Get + Return secondNameField + End Get + + Set(ByVal value As String) + secondNameField = value + End Set + End Property + + Public Property Comments As String + Get + Return commentsField + End Get + + Set(ByVal value As String) + commentsField = value + End Set + End Property + End Class +End Namespace diff --git a/VB/LinqServerModeSource/Program.vb b/VB/LinqServerModeSource/Program.vb index 2409605..47f5443 100644 --- a/VB/LinqServerModeSource/Program.vb +++ b/VB/LinqServerModeSource/Program.vb @@ -1,4 +1,4 @@ -' Developer Express Code Central Example: +' Developer Express Code Central Example: ' How to implement CRUD operations using XtraGrid and LinqServeModeSource ' ' This example demonstrates how to implement create, update and delete operations @@ -8,30 +8,25 @@ ' ' You can find sample updates and versions for different programming languages here: ' http://www.devexpress.com/example=E4498 - -Imports Microsoft.VisualBasic Imports System -Imports System.Collections.Generic Imports System.Windows.Forms Imports DevExpress.LookAndFeel Namespace LinqServerModeSource - Friend NotInheritable Class Program - ''' - ''' The main entry point for the application. - ''' - Private Sub New() - End Sub - _ - Shared Sub Main() - Application.EnableVisualStyles() - Application.SetCompatibleTextRenderingDefault(False) - DevExpress.Skins.SkinManager.EnableFormSkins() - DevExpress.UserSkins.BonusSkins.Register() - UserLookAndFeel.Default.SetSkinStyle("Foggy") + Friend Module Program - Application.Run(New Form1()) - End Sub - End Class -End Namespace \ No newline at end of file + ''' + ''' The main entry point for the application. + ''' + + Sub Main() + Call Application.EnableVisualStyles() + Application.SetCompatibleTextRenderingDefault(False) + DevExpress.Skins.SkinManager.EnableFormSkins() + DevExpress.UserSkins.BonusSkins.Register() + UserLookAndFeel.Default.SetSkinStyle("Foggy") + Call Application.Run(New Form1()) + End Sub + End Module +End Namespace diff --git a/VB/LinqServerModeSource/Properties/AssemblyInfo.vb b/VB/LinqServerModeSource/Properties/AssemblyInfo.vb new file mode 100644 index 0000000..424676a --- /dev/null +++ b/VB/LinqServerModeSource/Properties/AssemblyInfo.vb @@ -0,0 +1,39 @@ +' Developer Express Code Central Example: +' How to implement CRUD operations using XtraGrid and LinqServeModeSource +' +' This example demonstrates how to implement create, update and delete operations +' using XtraGrid and LinqServeModeSource. +' This example works with the standard +' SQL Northwind database. +' +' You can find sample updates and versions for different programming languages here: +' http://www.devexpress.com/example=E4498 +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + + + + + + + + +' Setting ComVisible to false makes the types in this assembly not visible +' to COM components. If you need to access a type in this assembly from +' COM, set the ComVisible attribute to true on that type. + +' The following GUID is for the ID of the typelib if this project is exposed to COM + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' + + diff --git a/VB/LinqServerModeSource/Properties/Resources.Designer.vb b/VB/LinqServerModeSource/Properties/Resources.Designer.vb new file mode 100644 index 0000000..fca9119 --- /dev/null +++ b/VB/LinqServerModeSource/Properties/Resources.Designer.vb @@ -0,0 +1,74 @@ +' Developer Express Code Central Example: +' How to implement CRUD operations using XtraGrid and LinqServeModeSource +' +' This example demonstrates how to implement create, update and delete operations +' using XtraGrid and LinqServeModeSource. +' This example works with the standard +' SQL Northwind database. +' +' You can find sample updates and versions for different programming languages here: +' http://www.devexpress.com/example=E4498 +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version:4.0.30319.296 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ +Imports System + +Namespace LinqServerModeSource.Properties + + ''' + ''' A strongly-typed resource class, for looking up localized strings, etc. + ''' + ' This class was auto-generated by the StronglyTypedResourceBuilder + ' class via a tool like ResGen or Visual Studio. + ' To add or remove a member, edit your .ResX file then rerun ResGen + ' with the /str option, or rebuild your VS project. + + + + Friend Class Resources + + Private Shared resourceMan As Global.System.Resources.ResourceManager + + Private Shared resourceCulture As Global.System.Globalization.CultureInfo + + + Friend Sub New() + End Sub + + ''' + ''' Returns the cached ResourceManager instance used by this class. + ''' + + Friend Shared ReadOnly Property ResourceManager As Global.System.Resources.ResourceManager + Get + If Object.ReferenceEquals(LinqServerModeSource.Properties.Resources.resourceMan, Nothing) Then + Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("Resources", GetType(LinqServerModeSource.Properties.Resources).Assembly) + LinqServerModeSource.Properties.Resources.resourceMan = temp + End If + + Return LinqServerModeSource.Properties.Resources.resourceMan + End Get + End Property + + ''' + ''' Overrides the current thread's CurrentUICulture property for all + ''' resource lookups using this strongly typed resource class. + ''' + + Friend Shared Property Culture As Global.System.Globalization.CultureInfo + Get + Return LinqServerModeSource.Properties.Resources.resourceCulture + End Get + + Set(ByVal value As Global.System.Globalization.CultureInfo) + LinqServerModeSource.Properties.Resources.resourceCulture = value + End Set + End Property + End Class +End Namespace diff --git a/VB/LinqServerModeSource/Properties/Resources.resx b/VB/LinqServerModeSource/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/VB/LinqServerModeSource/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/VB/LinqServerModeSource/Properties/Settings.Designer.vb b/VB/LinqServerModeSource/Properties/Settings.Designer.vb new file mode 100644 index 0000000..7646995 --- /dev/null +++ b/VB/LinqServerModeSource/Properties/Settings.Designer.vb @@ -0,0 +1,45 @@ +' Developer Express Code Central Example: +' How to implement CRUD operations using XtraGrid and LinqServeModeSource +' +' This example demonstrates how to implement create, update and delete operations +' using XtraGrid and LinqServeModeSource. +' This example works with the standard +' SQL Northwind database. +' +' You can find sample updates and versions for different programming languages here: +' http://www.devexpress.com/example=E4498 +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version:4.0.30319.296 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ +Namespace LinqServerModeSource.Properties + + + + Friend NotInheritable Partial Class Settings + Inherits Global.System.Configuration.ApplicationSettingsBase + + Private Shared defaultInstance As LinqServerModeSource.Properties.Settings = CType((Global.System.Configuration.ApplicationSettingsBase.Synchronized(New LinqServerModeSource.Properties.Settings())), LinqServerModeSource.Properties.Settings) + + Public Shared ReadOnly Property [Default] As Settings + Get + Return LinqServerModeSource.Properties.Settings.defaultInstance + End Get + End Property + + + + + + Public ReadOnly Property NorthwindConnectionString As String + Get + Return(CStr((Me("NorthwindConnectionString")))) + End Get + End Property + End Class +End Namespace diff --git a/VB/LinqServerModeSource/Properties/Settings.settings b/VB/LinqServerModeSource/Properties/Settings.settings new file mode 100644 index 0000000..9103766 --- /dev/null +++ b/VB/LinqServerModeSource/Properties/Settings.settings @@ -0,0 +1,14 @@ + + + + + + <?xml version="1.0" encoding="utf-16"?> +<SerializableConnectionString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> + <ConnectionString>Data Source=KURCHENKO-SV;Initial Catalog=Northwind;Integrated Security=True</ConnectionString> + <ProviderName>System.Data.SqlClient</ProviderName> +</SerializableConnectionString> + Data Source=KURCHENKO-SV;Initial Catalog=Northwind;Integrated Security=True + + + \ No newline at end of file diff --git a/VB/LinqServerModeSource/app.config b/VB/LinqServerModeSource/app.config index 077e31b..4db64d1 100644 --- a/VB/LinqServerModeSource/app.config +++ b/VB/LinqServerModeSource/app.config @@ -4,7 +4,7 @@ \ No newline at end of file From e633932e42e8341845c2e53ac2ded43684ea0b44 Mon Sep 17 00:00:00 2001 From: DevExpressExampleBot Date: Sun, 3 Sep 2023 13:59:05 +0400 Subject: [PATCH 2/2] README auto update [skip ci] --- Readme.md | 1 - 1 file changed, 1 deletion(-) diff --git a/Readme.md b/Readme.md index a57fa20..576bc95 100644 --- a/Readme.md +++ b/Readme.md @@ -1,5 +1,4 @@ -![](https://img.shields.io/endpoint?url=https://codecentral.devexpress.com/api/v1/VersionRange/128629596/12.2.10%2B) [![](https://img.shields.io/badge/Open_in_DevExpress_Support_Center-FF7200?style=flat-square&logo=DevExpress&logoColor=white)](https://supportcenter.devexpress.com/ticket/details/E4498) [![](https://img.shields.io/badge/📖_How_to_use_DevExpress_Examples-e9f6fc?style=flat-square)](https://docs.devexpress.com/GeneralInformation/403183)