請問什么軟件可以生成以下代碼:
Imports TierLibrary
Public Class ConfCommon
#Region "Members and Constants"?Public Enum CommonType??None??Header = 1??Footer??Menu??Label??Message?End Enum
?Private Const SP_SELECTLIST As String = "spConfCommon_GetList"?Private Const SP_SELECTLISTBYFIIDANDSITETYPEID As String = "spConfCommon_GetList_ByFIIDAndSitTypeID"?Public Enum EListField??ConfCommonID??ConfCommonName??ControlID??ControlText??ConfCommonTypeID??ConfSiteTypeID?End Enum
?Private Const SP_SELECTONE As String = "spConfCommon_GetOne"?Public Enum ESelectField??ConfCommonID??ConfCommonName??ControlID??ControlText??ConfCommonTypeID??ConfSiteTypeID?End Enum
?Private Const SP_INSERT As String = "spConfCommon_Insert"?Private Const SP_UPDATE As String = "spConfCommon_Update"?Private Const SP_DELETE As String = "spConfCommon_Delete"
?Private Class ConfCommonData??Public iConfCommonID As Integer??Public sConfCommonName As String??Public sControlID As String??Public sControlText As String??Public iConfCommonTypeID As Integer??Public iConfSiteTypeID As Integer?End Class
?'Private mPermissions As PermissionService.NounPermission?Private mbLoadedFromDB As Boolean?Private mbUncommittedChanges As Boolean?Private mTheConfCommon As ConfCommonData
#End Region
#Region "Properties"
?Public ReadOnly Property ConfCommonID() As Integer??Get???Return mTheConfCommon.iConfCommonID??End Get
?End Property
?Public Property ConfCommonName() As String??Get???Return mTheConfCommon.sConfCommonName??End Get??Set(ByVal Value As String)???If Value <> mTheConfCommon.sConfCommonName Then????mbUncommittedChanges = True????mTheConfCommon.sConfCommonName = Value???End If??End Set?End Property
?Public Property ConfSiteTypeID() As Integer??Get???Return mTheConfCommon.iConfSiteTypeID??End Get??Set(ByVal Value As Integer)???If Value <> mTheConfCommon.iConfSiteTypeID Then????mbUncommittedChanges = True????mTheConfCommon.iConfSiteTypeID = Value???End If??End Set?End Property
?
?Public Property ControlID() As String??Get???Return mTheConfCommon.sControlID??End Get??Set(ByVal Value As String)???If Value <> mTheConfCommon.sControlID Then????mbUncommittedChanges = True????mTheConfCommon.sControlID = Value???End If??End Set?End Property
?Public Property ControlText() As String??Get???Return mTheConfCommon.sControlText??End Get??Set(ByVal Value As String)???If Value <> mTheConfCommon.sControlText Then????mbUncommittedChanges = True????mTheConfCommon.sControlText = Value???End If??End Set?End Property
?Public Property ConfCommonTypeID() As Integer??Get???Return mTheConfCommon.iConfCommonTypeID??End Get??Set(ByVal Value As Integer)???If Value <> mTheConfCommon.iConfCommonTypeID Then????mbUncommittedChanges = True????mTheConfCommon.iConfCommonTypeID = Value???End If??End Set?End Property
#End Region
#Region "Methods"?''' <summary>?''' Initializes a new instance of the <see cref="T:ConfCommon" /> class.?''' </summary>?Public Sub New()??mTheConfCommon = New ConfCommonData()??mbUncommittedChanges = False?End Sub
?''' <summary>?''' Initializes a new instance of the <see cref="T:ConfCommon" /> class.?''' </summary>?''' <param name="iConfCommonID">The iConfCommonID.</param>?Public Sub New(ByVal iConfCommonID As Integer)??Me.New()??FillFromDB(iConfCommonID)?End Sub
?''' <summary>?''' Initializes a new instance of the <see cref="T:ConfCommon" /> class.?''' </summary>?''' <param name="DataRow">The data row.</param>?Public Sub New(ByVal DataRow As IDataRecord)??Me.New()??FillFromDB(DataRow)?End Sub
?
?''' <summary>?''' Inserts the specified transaction.?''' </summary>?''' <returns></returns>?Public Function Insert() As Integer
??Dim Parameters() As Object = { _??mTheConfCommon.sConfCommonName, _??mTheConfCommon.iConfSiteTypeID, _??mTheConfCommon.sControlID, _??mTheConfCommon.sControlText, _??mTheConfCommon.iConfCommonTypeID _??}??AppAssertion.Assert(Not mbLoadedFromDB, _?? "Tried to insert a ConfCommon that was loaded from database.", _?? AppAssertion.LineNumber)
??' If there's been no changes, exit doing nothing.??If Not mbUncommittedChanges Then Return mTheConfCommon.iConfCommonID
??' Perform the insert.??mTheConfCommon.iConfCommonID = CType(DataService.ExecuteScalar(Nothing, SP_INSERT, Parameters), Integer)
??' In case caller doesn't discard this object after insert, ensure internal state??' is correct??mbUncommittedChanges = False??mbLoadedFromDB = True
??' Return ID of new object to caller??Return mTheConfCommon.iConfCommonID?End Function
?''' <summary>?''' Updates the specified ConfCommon.?''' </summary>?Public Sub Update()
??Dim Parameters() As Object = { _??mTheConfCommon.iConfCommonID, _??mTheConfCommon.sConfCommonName, _??mTheConfCommon.iConfSiteTypeID, _??mTheConfCommon.sControlID, _??mTheConfCommon.sControlText, _??mTheConfCommon.iConfCommonTypeID _??}??AppAssertion.Assert(mbLoadedFromDB, _?? "Tried to update the ConfCommon that hadn't been loaded first.", _?? AppAssertion.LineNumber)
??' If there's been no changes, exit doing nothing.??If Not mbUncommittedChanges Then Return
??' Save changes to the database.??DataService.ExecuteScalar(Nothing, SP_UPDATE, Parameters)
??' In case caller doesn't disacard this object after update, ensure internal state ??' is correct??mbUncommittedChanges = False?End Sub
?''' <summary>?''' Deletes the specified ConfCommon.?''' </summary>?Public Sub Delete()
??Dim Parameters() As Object = {mTheConfCommon.iConfCommonID}
??'Perform the delete.??DataService.ExecuteScalar(Nothing, SP_DELETE, Parameters)
??'In case caller doesn't discard this object after delete, ensure internal state is corrrect??mTheConfCommon = Nothing??mbUncommittedChanges = False??mbLoadedFromDB = False?End Sub
?''' <summary>?''' Saves the specified ConfCommon.?''' </summary>?''' <returns></returns>?Public Function Save() As Integer
??' Note: Permissions are checked in the Insert/Update routines??If mbLoadedFromDB Then???Update()???Return mTheConfCommon.iConfCommonID??Else???Return Insert()??End If?End Function
?''' <summary>?''' Fills from DB.?''' </summary>?''' <param name="iConfCommonID">The iConfCommonID.</param>?Private Sub FillFromDB(ByVal iConfCommonID As Integer)??Dim DataReader As IDataReader??Dim Parameters() As Object = {iConfCommonID}??DataReader = DataService.ExecuteReader(Nothing, SP_SELECTONE, Parameters)??Try???If Not DataReader.Read() Then????Throw New AppDataObjectNotFound("ApplicationDefinition", mTheConfCommon.iConfCommonID)???End If???FillFromDB(DataReader)??Finally???DataReader.Close()??End Try?End Sub
?''' <summary>?''' Fills from DB.?''' </summary>?''' <param name="DataRow">The data row.</param>?Private Sub FillFromDB(ByVal DataRow As IDataRecord)??With mTheConfCommon???'Fields that should new be null???.iConfCommonID = DataRow.GetInt32(ESelectField.ConfCommonID)???.iConfSiteTypeID = DataRow.GetInt32(ESelectField.ConfSiteTypeID)???.iConfCommonTypeID = DataRow.GetInt32(ESelectField.ConfCommonTypeID)
???'Fields that could be null???.sConfCommonName = DataService.GetString(DataRow, ESelectField.ConfCommonName)???.sControlID = DataService.GetString(DataRow, ESelectField.ControlID)???.sControlText = DataService.GetString(DataRow, ESelectField.ControlText)
???'Revision fields (won't be null)
??End With??mbLoadedFromDB = True?End Sub#End Region
#Region "Shared Methods"
?Public Shared Function GetList() As IDataReader??Return DataService.ExecuteReader(Nothing, SP_SELECTLIST)?End Function
?Public Shared Function GetListAsDataSet() As DataSet??Return DataService.ExecuteDataset(Nothing, SP_SELECTLIST)?End Function
?#End RegionEnd Class
- 1 回答
- 0 關(guān)注
- 462 瀏覽
添加回答
舉報
0/150
提交
取消