我有一张表格,允许人们在一个地理区域内最多添加5个点(UNIT_NUMBER从1到5递增)。
在退出点添加并且想要编辑添加的五个点之一时,我具有防止用户添加点(如果UNIT_NUMBER已经存在)的功能。
就目前而言,如果用户说要决定编辑点3并从那里添加一个附加点,它将添加第二个点4。
我将如何执行检查以查看USER_NUMBER是否已在1-5范围内?
Public Sub New(ByVal Record As Feature, ByVal previousRecord As Till_NonTillStation, ByVal SurficialType As enumTillTypes)
MyBase.New(Record, Constants.COL_TILL_CREATED_BY, Constants.COL_TILL_CREATION_DATE, Constants.COL_TILL_EDITED_BY, Constants.COL_TILL_EDIT_DATE, DirectCast(previousRecord.Geometry, Esri.ArcGISRuntime.Geometry.MapPoint))
Try
_incrementStationCount = False
_surficialObsType = SurficialType
'If Me.UNIT_NUMBER = previousRecord.UNIT_NUMBER Then
' MessageBox.Show("Unit Number already exists at this point!")
'End If
If previousRecord.UNIT_NUMBER Is Nothing Then
Me.UNIT_NUMBER = 1S
Else
Me.UNIT_NUMBER = previousRecord.UNIT_NUMBER + 1S
End If
If previousRecord.UNIT_NUMBER <= 5S Then
If Me.OBSERVATION_TYPE = enumTillTypes.Non_Till Then
SECOND_LITHOFACIES_INTERVAL = 0
THIRD_LITHOFACIES_INTERVAL = 0
FOURTH_LITHOFACIES_INTERVAL = 0
Me.FIRST_LITHOFACIES_INTERVAL = previousRecord.FIRST_LITHOFACIES_INTERVAL
Me.SECOND_LITHOFACIES_INTERVAL = previousRecord.SECOND_LITHOFACIES_INTERVAL
Me.THIRD_LITHOFACIES_INTERVAL = previousRecord.THIRD_LITHOFACIES_INTERVAL
Me.FOURTH_LITHOFACIES_INTERVAL = previousRecord.FOURTH_LITHOFACIES_INTERVAL
End If
If Me.OBSERVATION_TYPE = enumTillTypes.Till Then
FIRST_LITHOFACIES_INTERVAL = 0
SECOND_LITHOFACIES_INTERVAL = 0
THIRD_LITHOFACIES_INTERVAL = 0
FOURTH_LITHOFACIES_INTERVAL = 0
End If
Me.SITE_ID = previousRecord.SITE_ID
If MessageBox.Show("Autopopulate fields from last point collected?", "Record Autopopulation", MessageBoxButton.YesNo) = vbYes Then
Me.EXPOSURE_TYPE = previousRecord.EXPOSURE_TYPE
Me.EXPOSURE_HEIGHT = previousRecord.EXPOSURE_HEIGHT
Me.UNIT_THICKNESS = previousRecord.UNIT_THICKNESS
Me.UNIT_TYPE = previousRecord.UNIT_TYPE
Me.TILL_FACIES = previousRecord.TILL_FACIES
Me.PERCENT_CLAY = previousRecord.PERCENT_CLAY
Me.FIRST_LITHOFACIES_TYPE = previousRecord.FIRST_LITHOFACIES_TYPE
Me.CONSISTENCY = previousRecord.CONSISTENCY
Me.COLOUR = previousRecord.COLOUR
Me.CLAST_PROVIDENCE = previousRecord.CLAST_PROVIDENCE
Me.CLAST_ROUNDNESS = previousRecord.CLAST_ROUNDNESS
Me.NOTES = previousRecord.NOTES
End If
End If
Catch ex As Exception
Constants.WriteToErrorLog(System.Reflection.MethodBase.GetCurrentMethod.DeclaringType.Name,
System.Reflection.MethodInfo.GetCurrentMethod.Name,
ex)
End Try
End Sub