I am using 3-Tier layer for my ASP.net project. i have a table in Database “PaymentTypes” where i put check constraint on the column PaymentTypeEN, so the user will not enter the duplicate values in this column. I have code in my Domain Layer (VB.net).
_
Public Function PaymentTypes_DML(ByVal PaymentTypeID As Long?, ByVal PaymentTypeEN As String, ByVal PaymentType As String, _
ByVal UserID As Long?, ByVal ActionCode As String) As Long
Dim iPaymentTypeID As Long? = PaymentTypeID
Dim sPaymentTypeEN As String = PaymentTypeEN
Dim sPaymentType As String = PaymentType
Dim iUserID As Long? = UserID
Dim sActionCode As String = ActionCode
Dim result As Long
result = CLng(PaymentTypesAdapter.DML(iPaymentTypeID, sPaymentTypeEN, sPaymentType, iUserID, sActionCode))
Return result
End Function
No what is happening when on the Presentation layer (ASP.net Form) when user enter the duplicate record in the Column “PaymentTypeEN” the ASP.net page shows ugly error…………i want to handle those errors by showing the user some pre defined messages in this case….like……”You can’t enter duplicate values, please enter some other value.”………………….How can i handle the Errors in Domain Layer or in Presentation layer for ObjectDataSource.