IIS – Server 2003
22-Feb-1010 Leave a comment
IT and business subjects
22-Feb-1010 Leave a comment
19-Feb-1010 Leave a comment
02-Feb-1010 Leave a comment
Private Sub DecisionBindingSource_AddingNew(ByVal sender As System.Object, ByVal e As System.ComponentModel.AddingNewEventArgs) Handles DecisionBindingSource.AddingNew
Try
Dim dNew As New Decision
dNew.DateInput = Today
dNew.IsNew = True
dNew.StatusID = Decision.StatusIDEnum.Current
'Lambda
Dim dList As IList(Of Decision) = CType(DecisionBindingSource.DataSource, IList(Of Decision))
dNew.ID = dList.Max(Function(d) d.ID) + 1
e.NewObject = dNew
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub
02-Feb-1010 Leave a comment
02-Feb-1010 Leave a comment
Taken from MSDN Link Here but adjusted to make abstract
Private Sub SetupDGVComboBoxToEnum()
SetupDGVComboBoxColumnToEnumType(GetType(Decision.StatusIDEnum))
DGVColumnStatusID.DataPropertyName = "StatusID"
DGVColumnStatusID.Name = "Status"
End Sub
Private Sub SetupDGVComboBoxColumnToEnumType(ByVal enumType As Type)
DGVColumnStatusID.DataSource = [Enum].GetValues(enumType)
End Sub
02-Feb-1010 Leave a comment
Private mruList As IList(Of T)
Private Sub MRUAdd()
If mruList.Contains(Me.cPadMain) Then
mruList.Remove(Me.cPadMain)
End If
'Lambda
If mruList.Where(Function(m) m.ID = cPadMain.ID).Count = 0 Then
mruList.Insert(0, Me.cPadMain)
End If
MRUDisplay()
End Sub
Private Sub MRUDisplay()
MRUToolStripDropDownButton.DropDownItems.Clear()
'LINQ
Dim MRU As IEnumerable(Of PadMain) = From pm In mruList Order By pm.PadMaterial Descending
For Each pm As PadMain In MRU
Dim tsi As New ToolStripMenuItem
tsi.Tag = pm.ID
tsi.Text = pm.Pad + " in " + pm.Material.Material + " " + pm.ID.ToString
MRUToolStripDropDownButton.DropDownItems.Insert(0, tsi)
If MRUToolStripDropDownButton.DropDownItems.Count > 10 Then
Exit For
End If
Next
End Sub
02-Feb-1010 Leave a comment
Dim EntityConnectionString = Configuration.ConfigurationManager.ConnectionStrings(“SOPEntities”).ConnectionString
context = New BC.SWT.EntityModel.SOPEntities(EntityConnectionString)
Dim CustomerQuery AsObjectQuery(OfCustomer) = context.Customers
Dim results = From a In CustomerQuery Select a.CustomerID, a.Customer1 OrderBy Customer1
02-Feb-1010 Leave a comment
Lamda Where
If cPadMain.PadHistoryList.Where(Function(h) h.IsNew = True).Count <> 0 Then
Dim cPadHistoryData As New PadHistoryData(Me.ConnectionStringSettings)
For Each ph As PadHistory In cPadMain.PadHistoryList.Where(Function(h) h.IsNew = True)
cPadHistoryData.Insert(ph)
Next
End If
Lamda Max
Dim dList As IList(Of Decision) = CType(DecisionBindingSource.DataSource, IList(Of Decision))
dNew.ID = dList.Max(Function(d) d.ID) + 1
Lamda check for repeats
Public Function IsSupplierPriorityOK() As Boolean
'Lambda Check for repeats
For Each cs1 As Costing.ComponentSupplier In Me.ComponentSupplierList.OrderBy(Function(h) h.Priority)
Dim p1 As Integer = cs1.Priority
If Me.ComponentSupplierList.Where(Function(h) h.Priority = p1).Count <> 1 Then
Return False
End If
Next
Return True
End Function
02-Feb-1010 Leave a comment