diff --git a/SRC/MESWin/SYS1/ENT_21685/ET_Subcontractor.sln b/SRC/MESWin/SYS1/ENT_21685/ET_Subcontractor.sln new file mode 100644 index 0000000..9c7f793 --- /dev/null +++ b/SRC/MESWin/SYS1/ENT_21685/ET_Subcontractor.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.34407.143 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "ET_Subcontractor", "ET_Subcontractor.vbproj", "{D6EE7B96-F10E-44E2-9731-162B70B4C8DD}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x86 = Debug|x86 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D6EE7B96-F10E-44E2-9731-162B70B4C8DD}.Debug|x86.ActiveCfg = Debug|x86 + {D6EE7B96-F10E-44E2-9731-162B70B4C8DD}.Debug|x86.Build.0 = Debug|x86 + {D6EE7B96-F10E-44E2-9731-162B70B4C8DD}.Release|x86.ActiveCfg = Release|x86 + {D6EE7B96-F10E-44E2-9731-162B70B4C8DD}.Release|x86.Build.0 = Release|x86 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {BCC83B33-4B36-4EB9-B200-F5C49DEAEE65} + EndGlobalSection +EndGlobal diff --git a/SRC/MESWin/SYS1/ENT_21685/ET_Subcontractor.vbproj b/SRC/MESWin/SYS1/ENT_21685/ET_Subcontractor.vbproj new file mode 100644 index 0000000..7b834ed --- /dev/null +++ b/SRC/MESWin/SYS1/ENT_21685/ET_Subcontractor.vbproj @@ -0,0 +1,194 @@ + + + + + Debug + x86 + {D6EE7B96-F10E-44E2-9731-162B70B4C8DD} + Library + ENT_StuBasis + ENT_StuBasis + 512 + Windows + v4.7.2 + + SAK + SAK + SAK + SAK + + + On + + + Binary + + + Off + + + On + + + true + true + true + ..\..\..\MESClient\ + ENT_StuBasis.xml + 0 + 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 + full + x86 + MinimumRecommendedRules.ruleset + false + + + true + ..\..\..\MESClient\ + ENT_StuBasis.xml + true + 0 + 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 + pdbonly + x86 + MinimumRecommendedRules.ruleset + false + + + true + + + iMES.snk + + + + False + C:\Program Files (x86)\Infragistics\2019.1\Windows Forms\CLR4.0\Bin\Infragistics4.Win.v19.1.dll + False + + + False + C:\Program Files (x86)\Infragistics\2019.1\Windows Forms\CLR4.0\Bin\Infragistics4.Win.UltraWinGrid.v19.1.dll + False + + + False + C:\Program Files (x86)\Infragistics\2019.1\Windows Forms\CLR4.0\Bin\Infragistics4.Win.UltraWinEditors.v19.1.dll + False + + + False + C:\Program Files (x86)\Infragistics\2019.1\Windows Forms\CLR4.0\Bin\Infragistics4.Win.Misc.v19.1.dll + False + + + False + C:\Program Files (x86)\Infragistics\2019.1\Windows Forms\CLR4.0\Bin\Infragistics4.Shared.v19.1.dll + False + + + ..\..\..\MESClient\COM_Kit.dll + False + + + ..\..\..\MES_C_DLL\iMESExceptionManager.dll + False + + + ..\..\..\MES_C_DLL\iMESUltraGrid.dll + False + + + + + + + + + + + + + + + + + + + + + + + + + + + + modConstant.vb + + + Form + + + Form + + + Form + + + + True + Application.myapp + True + + + True + True + Resources.resx + + + True + Settings.settings + True + + + + + frmSubcontractor.vb + + + frmSubcontractorContDef.vb + + + frmSubcontractorDef.vb + + + + VbMyResourcesResXFileCodeGenerator + Resources.Designer.vb + My.Resources + Designer + + + + + + MyApplicationCodeGenerator + Application.Designer.vb + + + SettingsSingleFileGenerator + My + Settings.Designer.vb + + + + + + \ No newline at end of file diff --git a/SRC/MESWin/SYS1/ENT_21685/ET_Subcontractor.vbproj.user b/SRC/MESWin/SYS1/ENT_21685/ET_Subcontractor.vbproj.user new file mode 100644 index 0000000..eb07303 --- /dev/null +++ b/SRC/MESWin/SYS1/ENT_21685/ET_Subcontractor.vbproj.user @@ -0,0 +1,6 @@ + + + + E:\MESEnv\607.4\MESsc\SClientSource\ + + \ No newline at end of file diff --git a/SRC/MESWin/SYS1/ENT_21685/ET_Subcontractor.vbproj.vspscc b/SRC/MESWin/SYS1/ENT_21685/ET_Subcontractor.vbproj.vspscc new file mode 100644 index 0000000..b6d3289 --- /dev/null +++ b/SRC/MESWin/SYS1/ENT_21685/ET_Subcontractor.vbproj.vspscc @@ -0,0 +1,10 @@ +"" +{ +"FILE_VERSION" = "9237" +"ENLISTMENT_CHOICE" = "NEVER" +"PROJECT_FILE_RELATIVE_PATH" = "" +"NUMBER_OF_EXCLUDED_FILES" = "0" +"ORIGINAL_PROJECT_FILE_PATH" = "" +"NUMBER_OF_NESTED_PROJECTS" = "0" +"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER" +} diff --git a/SRC/MESWin/SYS1/ENT_21685/My Project/Application.Designer.vb b/SRC/MESWin/SYS1/ENT_21685/My Project/Application.Designer.vb new file mode 100644 index 0000000..537244b --- /dev/null +++ b/SRC/MESWin/SYS1/ENT_21685/My Project/Application.Designer.vb @@ -0,0 +1,13 @@ +'------------------------------------------------------------------------------ +' +' 此代码由工具生成。 +' 运行时版本:4.0.30319.42000 +' +' 对此文件的更改可能会导致不正确的行为,并且如果 +' 重新生成代码,这些更改将会丢失。 +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + diff --git a/SRC/MESWin/SYS1/ENT_21685/My Project/Application.myapp b/SRC/MESWin/SYS1/ENT_21685/My Project/Application.myapp new file mode 100644 index 0000000..758895d --- /dev/null +++ b/SRC/MESWin/SYS1/ENT_21685/My Project/Application.myapp @@ -0,0 +1,10 @@ + + + false + false + 0 + true + 0 + 1 + true + diff --git a/SRC/MESWin/SYS1/ENT_21685/My Project/AssemblyInfo.vb b/SRC/MESWin/SYS1/ENT_21685/My Project/AssemblyInfo.vb new file mode 100644 index 0000000..b0cdd98 --- /dev/null +++ b/SRC/MESWin/SYS1/ENT_21685/My Project/AssemblyInfo.vb @@ -0,0 +1,35 @@ +Imports System +Imports System.Reflection +Imports System.Runtime.InteropServices + +' 組件的一般資訊是由下列的屬性集控制。 +' 變更這些屬性的值即可修改組件的相關 +' 資訊。 + +' 檢閱組件屬性的值 + + + + + + + + + + +'下列 GUID 為專案公開 (Expose) 至 COM 時所要使用的 typelib ID + + +' 組件的版本資訊由下列四個值所組成: +' +' 主要版本 +' 次要版本 +' 組建編號 +' 修訂編號 +' +' 您可以指定所有的值,也可以依照以下的方式,使用 '*' 將組建和修訂編號 +' 指定為預設值: +' + + + diff --git a/SRC/MESWin/SYS1/ENT_21685/My Project/BuildIncrementVersionInfo.vb b/SRC/MESWin/SYS1/ENT_21685/My Project/BuildIncrementVersionInfo.vb new file mode 100644 index 0000000..d2f2e21 --- /dev/null +++ b/SRC/MESWin/SYS1/ENT_21685/My Project/BuildIncrementVersionInfo.vb @@ -0,0 +1 @@ + diff --git a/SRC/MESWin/SYS1/ENT_21685/My Project/Resources.Designer.vb b/SRC/MESWin/SYS1/ENT_21685/My Project/Resources.Designer.vb new file mode 100644 index 0000000..50201eb --- /dev/null +++ b/SRC/MESWin/SYS1/ENT_21685/My Project/Resources.Designer.vb @@ -0,0 +1,63 @@ +'------------------------------------------------------------------------------ +' +' 此代码由工具生成。 +' 运行时版本:4.0.30319.42000 +' +' 对此文件的更改可能会导致不正确的行为,并且如果 +' 重新生成代码,这些更改将会丢失。 +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + +Imports System + +Namespace My.Resources + + '此类是由 StronglyTypedResourceBuilder + '类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。 + '若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen + '(以 /str 作为命令选项),或重新生成 VS 项目。 + ''' + ''' 一个强类型的资源类,用于查找本地化的字符串等。 + ''' + _ + Friend Module Resources + + Private resourceMan As Global.System.Resources.ResourceManager + + Private resourceCulture As Global.System.Globalization.CultureInfo + + ''' + ''' 返回此类使用的缓存的 ResourceManager 实例。 + ''' + _ + Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager + Get + If Object.ReferenceEquals(resourceMan, Nothing) Then + Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("ENT_StuBasis.Resources", GetType(Resources).Assembly) + resourceMan = temp + End If + Return resourceMan + End Get + End Property + + ''' + ''' 重写当前线程的 CurrentUICulture 属性,对 + ''' 使用此强类型资源类的所有资源查找执行重写。 + ''' + _ + Friend Property Culture() As Global.System.Globalization.CultureInfo + Get + Return resourceCulture + End Get + Set + resourceCulture = value + End Set + End Property + End Module +End Namespace diff --git a/SRC/MESWin/SYS1/ENT_21685/My Project/Resources.resx b/SRC/MESWin/SYS1/ENT_21685/My Project/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/SRC/MESWin/SYS1/ENT_21685/My Project/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/SRC/MESWin/SYS1/ENT_21685/My Project/Settings.Designer.vb b/SRC/MESWin/SYS1/ENT_21685/My Project/Settings.Designer.vb new file mode 100644 index 0000000..350aec6 --- /dev/null +++ b/SRC/MESWin/SYS1/ENT_21685/My Project/Settings.Designer.vb @@ -0,0 +1,73 @@ +'------------------------------------------------------------------------------ +' +' 此代码由工具生成。 +' 运行时版本:4.0.30319.42000 +' +' 对此文件的更改可能会导致不正确的行为,并且如果 +' 重新生成代码,这些更改将会丢失。 +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + + +Namespace My + + _ + Partial Friend NotInheritable Class MySettings + Inherits Global.System.Configuration.ApplicationSettingsBase + + Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings()),MySettings) + +#Region "My.Settings 自动保存功能" +#If _MyType = "WindowsForms" Then + Private Shared addedHandler As Boolean + + Private Shared addedHandlerLockObject As New Object + + _ + Private Shared Sub AutoSaveSettings(sender As Global.System.Object, e As Global.System.EventArgs) + If My.Application.SaveMySettingsOnExit Then + My.Settings.Save() + End If + End Sub +#End If +#End Region + + Public Shared ReadOnly Property [Default]() As MySettings + Get + +#If _MyType = "WindowsForms" Then + If Not addedHandler Then + SyncLock addedHandlerLockObject + If Not addedHandler Then + AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings + addedHandler = True + End If + End SyncLock + End If +#End If + Return defaultInstance + End Get + End Property + End Class +End Namespace + +Namespace My + + _ + Friend Module MySettingsProperty + + _ + Friend ReadOnly Property Settings() As Global.ENT_StuBasis.My.MySettings + Get + Return Global.ENT_StuBasis.My.MySettings.Default + End Get + End Property + End Module +End Namespace diff --git a/SRC/MESWin/SYS1/ENT_21685/My Project/Settings.settings b/SRC/MESWin/SYS1/ENT_21685/My Project/Settings.settings new file mode 100644 index 0000000..85b890b --- /dev/null +++ b/SRC/MESWin/SYS1/ENT_21685/My Project/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/SRC/MESWin/SYS1/ENT_21685/My Project/licenses.licx b/SRC/MESWin/SYS1/ENT_21685/My Project/licenses.licx new file mode 100644 index 0000000..6291ad1 --- /dev/null +++ b/SRC/MESWin/SYS1/ENT_21685/My Project/licenses.licx @@ -0,0 +1,8 @@ +Infragistics.Win.Misc.UltraGroupBox, Infragistics4.Win.Misc.v19.1, Version=19.1.20191.294, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb +Infragistics.Win.Misc.UltraLabel, Infragistics4.Win.Misc.v19.1, Version=19.1.20191.294, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb +Infragistics.Win.Misc.UltraButton, Infragistics4.Win.Misc.v19.1, Version=19.1.20191.294, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb +Infragistics.Win.UltraWinEditors.UltraRadioButton, Infragistics4.Win.UltraWinEditors.v19.1, Version=19.1.20191.294, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb +Infragistics.Win.UltraWinEditors.UltraControlContainerEditor, Infragistics4.Win.v19.1, Version=19.1.20191.294, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb +Infragistics.Win.UltraWinEditors.UltraComboEditor, Infragistics4.Win.UltraWinEditors.v19.1, Version=19.1.20191.294, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb +Infragistics.Win.Misc.UltraPanel, Infragistics4.Win.Misc.v19.1, Version=19.1.20191.294, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb +Infragistics.Win.UltraWinEditors.UltraTextEditor, Infragistics4.Win.UltraWinEditors.v19.1, Version=19.1.20191.294, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb diff --git a/SRC/MESWin/SYS1/ENT_21685/frmSubcontractor.resx b/SRC/MESWin/SYS1/ENT_21685/frmSubcontractor.resx new file mode 100644 index 0000000..5a57a57 --- /dev/null +++ b/SRC/MESWin/SYS1/ENT_21685/frmSubcontractor.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + \ No newline at end of file diff --git a/SRC/MESWin/SYS1/ENT_21685/frmSubcontractor.vb b/SRC/MESWin/SYS1/ENT_21685/frmSubcontractor.vb new file mode 100644 index 0000000..edd6ed5 --- /dev/null +++ b/SRC/MESWin/SYS1/ENT_21685/frmSubcontractor.vb @@ -0,0 +1,1083 @@ +Imports iMESExceptionManager + +Imports Infragistics.Win +Imports Infragistics.Win.UltraWinGrid +Public Class frmENTStuBasis + + Inherits COM_Kit.frmBasisTemplat + + Public PrivFunNo As String = defString + + '//WS相關變數 + ' 2016 YF, Dim wsENT As New wsENT.wsENT '宣告Web Service物件? + Dim tmpStringReader As System.IO.StringReader '將字串轉換成可讀入DataSet的物件 + Dim XmlData As String '儲存取回之資料 + Dim XmlSchema As String '儲存取回之資料結構 + Dim InXml As String '儲存呼叫Web Service的傳入參數(Request字串) + Dim OutXml As String '儲存Web Service的傳回值(Response字串) + Dim strIdentity As String '儲存Identity XML字串? + Dim strParameter As String '儲存Parameter XML字串 + + '//資料表相關變數 + + Dim dsENT As New DataSet '資料集:儲存取回之資料? + + Dim tblENTStuBasis As String '儲存取回資料表的名稱(master)? + Dim tblENTStuBasisCont As String '明細資料表名稱(detail) + Dim strFilter As String 'Filter string及列印的過濾條件 + + '//其他共用變數 + Dim StuBasisNo As String 'for Gird to Focus + Dim ContactorName As String 'for DetailGrid to Focus + Dim ugrRow As Infragistics.Win.UltraWinGrid.UltraGridRow + Friend WithEvents btnAdd As Misc.UltraButton + Friend WithEvents btnEdit As Misc.UltraButton + Friend WithEvents btnDel As Misc.UltraButton + Friend WithEvents btnCopy As Misc.UltraButton + Friend WithEvents btnApprove As Misc.UltraButton + Friend WithEvents iugStuBasis As iMESUltraGrid.iMESUltraGridControl + Friend WithEvents UltraControlContainerEditor1 As UltraWinEditors.UltraControlContainerEditor + Dim i As Integer + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + Private components As System.ComponentModel.IContainer + Friend WithEvents iugDetail As iMESUltraGrid.iMESUltraGridControl + Friend WithEvents btnClose As Infragistics.Win.Misc.UltraButton + Friend WithEvents btnEMail As Infragistics.Win.Misc.UltraButton + Friend WithEvents btnDCopy As Infragistics.Win.Misc.UltraButton + Friend WithEvents btnDDel As Infragistics.Win.Misc.UltraButton + Friend WithEvents btnDEdit As Infragistics.Win.Misc.UltraButton + Friend WithEvents btnDAdd As Infragistics.Win.Misc.UltraButton + Private Sub InitializeComponent() + Me.components = New System.ComponentModel.Container() + Me.btnClose = New Infragistics.Win.Misc.UltraButton() + Me.btnEMail = New Infragistics.Win.Misc.UltraButton() + Me.btnDCopy = New Infragistics.Win.Misc.UltraButton() + Me.btnDDel = New Infragistics.Win.Misc.UltraButton() + Me.btnDEdit = New Infragistics.Win.Misc.UltraButton() + Me.btnDAdd = New Infragistics.Win.Misc.UltraButton() + Me.iugDetail = New iMESUltraGrid.iMESUltraGridControl() + Me.btnAdd = New Infragistics.Win.Misc.UltraButton() + Me.btnEdit = New Infragistics.Win.Misc.UltraButton() + Me.btnDel = New Infragistics.Win.Misc.UltraButton() + Me.btnCopy = New Infragistics.Win.Misc.UltraButton() + Me.btnApprove = New Infragistics.Win.Misc.UltraButton() + Me.iugStuBasis = New iMESUltraGrid.iMESUltraGridControl() + Me.UltraControlContainerEditor1 = New Infragistics.Win.UltraWinEditors.UltraControlContainerEditor(Me.components) + CType(Me.UltraControlContainerEditor1, System.ComponentModel.ISupportInitialize).BeginInit() + Me.SuspendLayout() + ' + 'btnClose + ' + Me.btnClose.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.btnClose.Location = New System.Drawing.Point(912, 552) + Me.btnClose.Name = "btnClose" + Me.btnClose.Size = New System.Drawing.Size(88, 32) + Me.btnClose.TabIndex = 18 + Me.btnClose.Text = "Close (&X)" + ' + 'btnEMail + ' + Me.btnEMail.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.btnEMail.Location = New System.Drawing.Point(912, 429) + Me.btnEMail.Name = "btnEMail" + Me.btnEMail.Size = New System.Drawing.Size(88, 32) + Me.btnEMail.TabIndex = 17 + Me.btnEMail.Text = "Mail" + ' + 'btnDCopy + ' + Me.btnDCopy.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.btnDCopy.Location = New System.Drawing.Point(912, 389) + Me.btnDCopy.Name = "btnDCopy" + Me.btnDCopy.Size = New System.Drawing.Size(88, 32) + Me.btnDCopy.TabIndex = 16 + Me.btnDCopy.Text = "Copy" + ' + 'btnDDel + ' + Me.btnDDel.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.btnDDel.Location = New System.Drawing.Point(912, 349) + Me.btnDDel.Name = "btnDDel" + Me.btnDDel.Size = New System.Drawing.Size(88, 32) + Me.btnDDel.TabIndex = 15 + Me.btnDDel.Text = "DEL" + ' + 'btnDEdit + ' + Me.btnDEdit.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.btnDEdit.Location = New System.Drawing.Point(912, 309) + Me.btnDEdit.Name = "btnDEdit" + Me.btnDEdit.Size = New System.Drawing.Size(88, 32) + Me.btnDEdit.TabIndex = 14 + Me.btnDEdit.Text = "EDIT" + ' + 'btnDAdd + ' + Me.btnDAdd.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.btnDAdd.Location = New System.Drawing.Point(912, 269) + Me.btnDAdd.Name = "btnDAdd" + Me.btnDAdd.Size = New System.Drawing.Size(88, 32) + Me.btnDAdd.TabIndex = 13 + Me.btnDAdd.Text = "ADD" + ' + 'iugDetail + ' + Me.iugDetail.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _ + Or System.Windows.Forms.AnchorStyles.Left) _ + Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.iugDetail.EnterDirection = iMESUltraGrid.iMESUltraGridControl.EnterDirectionEnum.Down + Me.iugDetail.GroupBoxPromptText = "Drag a column header here to group by that column." + Me.iugDetail.GroupBoxTextForeColor = System.Drawing.Color.Red + Me.iugDetail.Identity = "IMes" + Me.iugDetail.IdentityForm = "" + Me.iugDetail.LayOutFilePath = "" + Me.iugDetail.Location = New System.Drawing.Point(12, 270) + Me.iugDetail.Name = "iugDetail" + Me.iugDetail.PrintFitWidthToPages = 0 + Me.iugDetail.PrintLandscape = True + Me.iugDetail.PrintPageFooter = "" + Me.iugDetail.PrintPageFooterHAlign = Infragistics.Win.HAlign.[Default] + Me.iugDetail.PrintPageFooterHeight = 20 + Me.iugDetail.PrintPageHeader = "" + Me.iugDetail.PrintPageHeaderHAlign = Infragistics.Win.HAlign.[Default] + Me.iugDetail.PrintPageHeaderHeight = 20 + Me.iugDetail.PrintZoom = 1.0R + Me.iugDetail.Size = New System.Drawing.Size(894, 314) + Me.iugDetail.TabIndex = 12 + Me.iugDetail.UserNo = "IMes" + ' + 'btnAdd + ' + Me.btnAdd.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.btnAdd.Location = New System.Drawing.Point(912, 53) + Me.btnAdd.Name = "btnAdd" + Me.btnAdd.Size = New System.Drawing.Size(88, 32) + Me.btnAdd.TabIndex = 20 + Me.btnAdd.Text = "Add(&A)" + ' + 'btnEdit + ' + Me.btnEdit.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.btnEdit.Location = New System.Drawing.Point(912, 93) + Me.btnEdit.Name = "btnEdit" + Me.btnEdit.Size = New System.Drawing.Size(88, 32) + Me.btnEdit.TabIndex = 21 + Me.btnEdit.Text = "Edit(&E)" + ' + 'btnDel + ' + Me.btnDel.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.btnDel.Location = New System.Drawing.Point(912, 133) + Me.btnDel.Name = "btnDel" + Me.btnDel.Size = New System.Drawing.Size(88, 32) + Me.btnDel.TabIndex = 22 + Me.btnDel.Text = "Del(&D)" + ' + 'btnCopy + ' + Me.btnCopy.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.btnCopy.Location = New System.Drawing.Point(912, 173) + Me.btnCopy.Name = "btnCopy" + Me.btnCopy.Size = New System.Drawing.Size(88, 32) + Me.btnCopy.TabIndex = 23 + Me.btnCopy.Text = "Copy(&C)" + ' + 'btnApprove + ' + Me.btnApprove.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.btnApprove.Location = New System.Drawing.Point(912, 213) + Me.btnApprove.Name = "btnApprove" + Me.btnApprove.Size = New System.Drawing.Size(88, 32) + Me.btnApprove.TabIndex = 24 + Me.btnApprove.Text = "Approve(&Y)" + ' + 'iugStuBasis + ' + Me.iugStuBasis.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _ + Or System.Windows.Forms.AnchorStyles.Left) _ + Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.iugStuBasis.EnterDirection = iMESUltraGrid.iMESUltraGridControl.EnterDirectionEnum.Down + Me.iugStuBasis.GroupBoxPromptText = "Drag a column header here to group by that column." + Me.iugStuBasis.GroupBoxTextForeColor = System.Drawing.Color.Red + Me.iugStuBasis.Identity = "IMes" + Me.iugStuBasis.IdentityForm = "" + Me.iugStuBasis.LayOutFilePath = "" + Me.iugStuBasis.Location = New System.Drawing.Point(12, 53) + Me.iugStuBasis.Name = "iugStuBasis" + Me.iugStuBasis.PrintFitWidthToPages = 0 + Me.iugStuBasis.PrintLandscape = True + Me.iugStuBasis.PrintPageFooter = "" + Me.iugStuBasis.PrintPageFooterHAlign = Infragistics.Win.HAlign.[Default] + Me.iugStuBasis.PrintPageFooterHeight = 20 + Me.iugStuBasis.PrintPageHeader = "" + Me.iugStuBasis.PrintPageHeaderHAlign = Infragistics.Win.HAlign.[Default] + Me.iugStuBasis.PrintPageHeaderHeight = 20 + Me.iugStuBasis.PrintZoom = 1.0R + Me.iugStuBasis.Size = New System.Drawing.Size(894, 192) + Me.iugStuBasis.TabIndex = 25 + Me.iugStuBasis.UserNo = "IMes" + ' + 'UltraControlContainerEditor1 + ' + Me.UltraControlContainerEditor1.ContainingControl = Me + Me.UltraControlContainerEditor1.Name = "UltraControlContainerEditor1" + ' + 'frmENTStuBasis + ' + Me.ClientSize = New System.Drawing.Size(1008, 591) + Me.Controls.Add(Me.btnClose) + Me.Controls.Add(Me.btnApprove) + Me.Controls.Add(Me.btnEMail) + Me.Controls.Add(Me.btnDCopy) + Me.Controls.Add(Me.btnCopy) + Me.Controls.Add(Me.btnDDel) + Me.Controls.Add(Me.iugStuBasis) + Me.Controls.Add(Me.btnDEdit) + Me.Controls.Add(Me.btnAdd) + Me.Controls.Add(Me.btnDAdd) + Me.Controls.Add(Me.btnDel) + Me.Controls.Add(Me.iugDetail) + Me.Controls.Add(Me.btnEdit) + Me.Font = New System.Drawing.Font("Times New Roman", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.Name = "frmENTStuBasis" + Me.Text = "ENT StuBasis & Contactor" + Me.WindowState = System.Windows.Forms.FormWindowState.Maximized + Me.Controls.SetChildIndex(Me.btnEdit, 0) + Me.Controls.SetChildIndex(Me.iugDetail, 0) + Me.Controls.SetChildIndex(Me.btnDel, 0) + Me.Controls.SetChildIndex(Me.btnDAdd, 0) + Me.Controls.SetChildIndex(Me.btnAdd, 0) + Me.Controls.SetChildIndex(Me.btnDEdit, 0) + Me.Controls.SetChildIndex(Me.iugStuBasis, 0) + Me.Controls.SetChildIndex(Me.btnDDel, 0) + Me.Controls.SetChildIndex(Me.btnCopy, 0) + Me.Controls.SetChildIndex(Me.btnDCopy, 0) + Me.Controls.SetChildIndex(Me.btnEMail, 0) + Me.Controls.SetChildIndex(Me.btnApprove, 0) + Me.Controls.SetChildIndex(Me.btnClose, 0) + CType(Me.UltraControlContainerEditor1, System.ComponentModel.ISupportInitialize).EndInit() + Me.ResumeLayout(False) + + End Sub + +#End Region + + Private Sub frmStuBasis_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load + + Cursor.Current = Cursors.WaitCursor + + ' 2016 YF, wsENT.Url = LocalizeWebService(wsENT.Url.ToString) + ' 2016 YF, wsENT.EnableDecompression = True + + Call funiMESUltraGridIni() 'Grid初始設定 + + '//取出資料 + Call funLoadStuBasis() + + SetIssueState(Issue.Unfrozen) '預設在Unforzen上 + SetSearchFieldName(New String() {"StuBasisNo", "StuBasisName"}) '設置搜尋欄位 + + + '語系切換 + Call ExeChangeResource(Me, gLanguageMode) + ExeGroupControlPriv(Me, PrivFunNo) + + Cursor.Current = Cursors.Default + + End Sub + + Private Sub frmStuBasis_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing + If Not dsENT Is Nothing Then dsENT.Dispose() + ' 2016 YF, If Not wsENT Is Nothing Then wsENT.Dispose() + End Sub + + Protected Overrides Sub rdoIssue_CheckedChanged(sender As Object, e As EventArgs) + If IsNothing(dsENT) Then Exit Sub + + Select Case GetIssueState() + Case Issue.Unfrozen + dsENT.Tables(tblENTStuBasis).DefaultView.RowFilter = "IssueState=0" + Case Issue.Pending + dsENT.Tables(tblENTStuBasis).DefaultView.RowFilter = "IssueState=1" + Case Issue.Active + dsENT.Tables(tblENTStuBasis).DefaultView.RowFilter = "IssueState=2" + Case Issue.Unused + dsENT.Tables(tblENTStuBasis).DefaultView.RowFilter = "IssueState=-1" + End Select + Me.iugStuBasis.iMESUltraGrid.DataSource = dsENT.Tables(tblENTStuBasis).DefaultView + Call funShowActiveDetail() + End Sub + + Protected Overrides Sub Finalize() + MyBase.Finalize() + End Sub + + Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click + + Dim fStuBasisDef As New frmStuBasisDef + + fStuBasisDef.DefMode = 0 + fStuBasisDef.ShowDialog(Me) + fStuBasisDef.Dispose() + + If gReturnKeyValue = "" Then Exit Sub + + StuBasisNo = gReturnKeyValue + + '重新取出資料 + Call funLoadStuBasis() + + If GetIssueState() = Issue.Unfrozen Then + ugrRow = FindRecordPosition(iugStuBasis, "StuBasisNo", StuBasisNo) + If Not ugrRow Is Nothing Then + Me.iugStuBasis.iMESUltraGrid.ActiveRow = ugrRow + Me.iugStuBasis.iMESUltraGrid.ActiveRow.Selected = True + End If + End If + + End Sub + + Private Sub btnEdit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEdit.Click + + + + If Not Me.iugStuBasis.iMESUltraGrid.ActiveRow Is Nothing Then + 'IsGroupByRow不做任何處理 + If iugStuBasis.iMESUltraGrid.ActiveRow.IsGroupByRow Then + Exit Sub + End If + Dim Rows As DataRow() + + '找出DataSet中在目前游標列的資料列(DataRow) + Rows = dsENT.Tables(tblENTStuBasis).Select("StuBasisNo = '" _ + & Replace(Me.iugStuBasis.iMESUltraGrid.ActiveRow.Cells("StuBasisNo").Value.ToString, "'", "''") & "'") + + '核准狀態為"Unfrozen"者才可修改 + + If Rows(0).Item("IssueState") <> 0 Then + iMESExceptionManager.ExceptionManager.iMESMsgBoxShowDialog(ChgTranslateName_Msg("0000-202202", "[%NOT ALLOWED TO EDIT%]"), MsgBoxStyle.Exclamation, Me.Text) + Exit Sub + End If + + Dim fStuBasisDef As New frmStuBasisDef + fStuBasisDef.DefMode = 1 + fStuBasisDef.EditDataRow = Rows(0) + fStuBasisDef.ShowDialog(Me) + fStuBasisDef.Dispose() + + If gReturnKeyValue = "" Then + Exit Sub + End If + + StuBasisNo = gReturnKeyValue + + '重新取出資料 + Call funLoadStuBasis() + + If GetIssueState() = Issue.Unfrozen Then + ugrRow = FindRecordPosition(iugStuBasis, "StuBasisNo", StuBasisNo) + If Not ugrRow Is Nothing Then + Me.iugStuBasis.iMESUltraGrid.ActiveRow = ugrRow + Me.iugStuBasis.iMESUltraGrid.ActiveRow.Selected = True + End If + End If + + End If + End Sub + + Private Sub btnDel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDel.Click + + + + '1.先檢查是否為單筆,是:將其Selecte + If Me.iugStuBasis.iMESUltraGrid.ActiveRow Is Nothing Then Exit Sub + If iugStuBasis.iMESUltraGrid.ActiveRow.IsGroupByRow Then Exit Sub + Cursor.Current = Cursors.WaitCursor + If Not Me.iugStuBasis.iMESUltraGrid.ActiveRow.Selected Then + Me.iugStuBasis.iMESUltraGrid.ActiveRow.Selected = True + End If + + '2.Multi + If Me.iugStuBasis.iMESUltraGrid.Selected.Rows.Count > 0 Then + If Me.iugStuBasis.iMESUltraGrid.Selected.Rows.Item(0).IsGroupByRow Then + Exit Sub 'Selected.Rows,不會包含GroupRow & 一般的Row在一起,故若是GroupRow不做任何處理 + End If + If iMESExceptionManager.ExceptionManager.iMESMsgBoxShowDialog(ChgTranslateName_Msg("0000-100001", "[%ARE YOU SURE TO DELETE ALL SELECTED RECORDS%]"), MsgBoxStyle.OkCancel + MsgBoxStyle.Question + MsgBoxStyle.DefaultButton2, Me.Text) = MsgBoxResult.Cancel Then + Exit Sub + End If + + '共用資料 + Dim XmlDoc As New XmlDocument + Dim blnReLoad As Boolean = False + Dim intIssueState As Integer + + strIdentity = CombineXMLIdentity(gComputerName, gUserNo, GetNow()) + For i = 0 To Me.iugStuBasis.iMESUltraGrid.Selected.Rows.Count - 1 + intIssueState = Me.iugStuBasis.iMESUltraGrid.Selected.Rows(i).Cells("IssueState").Value + If intIssueState = 0 Or intIssueState = -1 Or intIssueState = 2 Then '狀態為Unforzen或Unused時直接刪除 + + strParameter = CombineXMLParameter("StuBasisNo", "StuBasisNo", "String", CInput(Me.iugStuBasis.iMESUltraGrid.Selected.Rows(i).Cells("StuBasisNo").Value.ToString), "") + strParameter = strParameter & CombineXMLParameter("issuestate", "IssueState", "String", CInput(intIssueState), "") + strParameter = strParameter & CombineXMLParameter("datastamp", "DataStamp", "Integer", iugStuBasis.iMESUltraGrid.Selected.Rows(i).Cells("DataStamp").Value, "") + InXml = CombineXMLRequest(strIdentity, strParameter) + Try + ' 2016 YF, OutXml = wsENT.DelStuBasis(InXml) + 'OutXml = InvokeSrv("wsENT.DelStuBasis", InXml) + OutXml = InvokeSrv("SXS.ws_21685.DelStuBasis", InXml) + + XmlDoc.LoadXml(OutXml) + If ChkExecutionSuccess(XmlDoc) Then + If Not blnReLoad Then blnReLoad = True + Else + '找出Exception訊並顯示出來 + ExceptionManager.iMESShowDialog(GetExceptionCode(XmlDoc), GetExceptionSysMsg(XmlDoc), GetExceptionStack(XmlDoc)) + Exit For + End If + Catch ex As Exception + 'MsgBox("Unexpected Error. Delete failed," & e1.Message, MsgBoxStyle.Exclamation) + ExceptionManager.iMESShowDialog(defWinErrCode, ex.Message, ex.StackTrace) + Exit For + End Try + Else + iMESExceptionManager.ExceptionManager.iMESMsgBoxShowDialog(ChgTranslateName_Msg("0000-200021", "[%NOT ALLOWED TO delete%]"), MsgBoxStyle.Exclamation, Me.Text) + End If + Next + + XmlDoc = Nothing + + If blnReLoad Then + + Call funLoadStuBasis() + + Call funShowActiveDetail() + + End If + + End If + + Cursor.Current = Cursors.Default + + End Sub + + Private Sub btnCopy_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCopy.Click + + + + If Not Me.iugStuBasis.iMESUltraGrid.ActiveRow Is Nothing Then + 'IsGroupByRow不做任何處理 + If iugStuBasis.iMESUltraGrid.ActiveRow.IsGroupByRow Then + Exit Sub + End If + Dim Rows As DataRow() + + '找出DataSet中在目前游標列的資料列(DataRow) + Rows = dsENT.Tables(tblENTStuBasis).Select("StuBasisNo = '" _ + & Replace(Me.iugStuBasis.iMESUltraGrid.ActiveRow.Cells("StuBasisNo").Value.ToString, "'", "''") & "'") + + Dim fStuBasisDef As New frmStuBasisDef + fStuBasisDef.DefMode = 2 + fStuBasisDef.EditDataRow = Rows(0) + fStuBasisDef.ShowDialog(Me) + + If gReturnKeyValue = "" Then Exit Sub + + StuBasisNo = gReturnKeyValue + + '重新取出資料 + Call funLoadStuBasis() + + If GetIssueState() = Issue.Unfrozen Then + ugrRow = FindRecordPosition(iugStuBasis, "StuBasisNo", StuBasisNo) + If Not ugrRow Is Nothing Then + Me.iugStuBasis.iMESUltraGrid.ActiveRow = ugrRow + Me.iugStuBasis.iMESUltraGrid.ActiveRow.Selected = True + End If + End If + + End If + End Sub + + Private Sub btnApprove_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnApprove.Click + + + + '1.先檢查是否為單筆,是:將其Selecte + If Me.iugStuBasis.iMESUltraGrid.ActiveRow Is Nothing Then Exit Sub + If iugStuBasis.iMESUltraGrid.ActiveRow.IsGroupByRow Then Exit Sub + Cursor.Current = Cursors.WaitCursor + If Not Me.iugStuBasis.iMESUltraGrid.ActiveRow.Selected Then + Me.iugStuBasis.iMESUltraGrid.ActiveRow.Selected = True + End If + + '2.Multi + If Me.iugStuBasis.iMESUltraGrid.Selected.Rows.Count > 0 Then + If Me.iugStuBasis.iMESUltraGrid.Selected.Rows.Item(0).IsGroupByRow Then + Exit Sub 'Selected.Rows,不會包含GroupRow & 一般的Row在一起,故若是GroupRow不做任何處理 + End If + If iMESExceptionManager.ExceptionManager.iMESMsgBoxShowDialog(ChgTranslateName_Msg("0000-100002", "[%ARE YOU SURE TO APPROVE ALL SELECTED RECORDS%]"), MsgBoxStyle.OkCancel + MsgBoxStyle.Question + MsgBoxStyle.DefaultButton2, Me.Text) = MsgBoxResult.Cancel Then + Exit Sub + End If + + '共用資料 + Dim XmlDoc As New XmlDocument + Dim blnReLoad As Boolean = False + Dim intIssueState As Integer + + strIdentity = CombineXMLIdentity(gComputerName, gUserNo, GetNow()) + For i = 0 To Me.iugStuBasis.iMESUltraGrid.Selected.Rows.Count - 1 + intIssueState = Me.iugStuBasis.iMESUltraGrid.Selected.Rows(i).Cells("IssueState").Value + If intIssueState = 0 Then + strParameter = CombineXMLParameter("StuBasisNo", "StuBasisNo", "String", CInput(Me.iugStuBasis.iMESUltraGrid.Selected.Rows(i).Cells("StuBasisNo").Value.ToString), "") + strParameter += CombineXMLParameter("issuestate", "IssueState", "String", intIssueState, "") + strParameter += CombineXMLParameter("creator", "Creator", "String", gUserNo, "") + strParameter = strParameter & CombineXMLParameter("datastamp", "DataStamp", "Integer", iugStuBasis.iMESUltraGrid.Selected.Rows(i).Cells("DataStamp").Value, "") + InXml = CombineXMLRequest(strIdentity, strParameter) + Try + ' 2016 YF, OutXml = wsENT.ApproveStuBasis(InXml) + 'OutXml = InvokeSrv("wsENT.ApproveStuBasis", InXml) + OutXml = InvokeSrv("SXS.wsENT.ApproveStuBasis", InXml) + + XmlDoc.LoadXml(OutXml) + If ChkExecutionSuccess(XmlDoc) Then + If Not blnReLoad Then blnReLoad = True + Else + '找出Exception訊並顯示出來 + ExceptionManager.iMESShowDialog(GetExceptionCode(XmlDoc), GetExceptionSysMsg(XmlDoc), GetExceptionStack(XmlDoc)) + Exit For + End If + Catch ex As Exception + 'MsgBox("Unexpected Error. Approve failed," & e1.Message, MsgBoxStyle.Exclamation) + ExceptionManager.iMESShowDialog(defWinErrCode, ex.Message, ex.StackTrace) + Exit For + End Try + Else + iMESExceptionManager.ExceptionManager.iMESMsgBoxShowDialog(ChgTranslateName_Msg("0000-200021", "[%NOT ALLOW TO APPROVE%]"), MsgBoxStyle.Exclamation, Me.Text) + End If + Next + + XmlDoc = Nothing + + If blnReLoad Then + + Call funLoadStuBasis() + + Call funShowActiveDetail() + + End If + + End If + + Cursor.Current = Cursors.Default + + End Sub + + Private Sub btnDAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDAdd.Click + + If Not Me.iugStuBasis.iMESUltraGrid.ActiveRow Is Nothing Then + + 'Dim Rows As DataRow() + Dim fStuBasisContDef As New frmStuBasisContDef + + fStuBasisContDef.DefMode = 0 + fStuBasisContDef.StuBasisNo = Me.iugStuBasis.iMESUltraGrid.ActiveRow.Cells("StuBasisNo").Value.ToString + fStuBasisContDef.ShowDialog(Me) + + If gReturnKeyValue = "" Then Exit Sub + + ContactorName = gReturnKeyValue + + '重新取出資料 + Call funLoadStuBasisCont(Me.iugStuBasis.iMESUltraGrid.ActiveRow.Cells("StuBasisNo").Value.ToString) + + ugrRow = FindRecordPosition(iugDetail, "ContactorName", ContactorName) + If Not ugrRow Is Nothing Then + Me.iugDetail.iMESUltraGrid.ActiveRow = ugrRow + Me.iugDetail.iMESUltraGrid.ActiveRow.Selected = True + End If + + End If + End Sub + + Private Sub btnDEdit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDEdit.Click + + If Not Me.iugStuBasis.iMESUltraGrid.ActiveRow Is Nothing And Not Me.iugDetail.iMESUltraGrid.ActiveRow Is Nothing Then + If iugStuBasis.iMESUltraGrid.ActiveRow.IsGroupByRow OrElse iugDetail.iMESUltraGrid.ActiveRow.IsGroupByRow Then Exit Sub + Dim Rows As DataRow() + + '找出DataSet中在目前游標列的資料列(DataRow) + Rows = dsENT.Tables(tblENTStuBasisCont).Select("StuBasisNo = '" _ + & Replace(Me.iugStuBasis.iMESUltraGrid.ActiveRow.Cells("StuBasisNo").Value.ToString, "'", "''") & "'" _ + & " And ContactorName = '" & Replace(Me.iugDetail.iMESUltraGrid.ActiveRow.Cells("ContactorName").Value.ToString, "'", "''") & "'") + + Dim fStuBasisContDef As New frmStuBasisContDef + fStuBasisContDef.DefMode = 1 + fStuBasisContDef.EditDataRow = Rows(0) + fStuBasisContDef.StuBasisNo = Me.iugStuBasis.iMESUltraGrid.ActiveRow.Cells("StuBasisNo").Value.ToString + fStuBasisContDef.ShowDialog(Me) + + If gReturnKeyValue = "" Then Exit Sub + + ContactorName = gReturnKeyValue + + '重新取出資料 + Call funLoadStuBasisCont(Me.iugStuBasis.iMESUltraGrid.ActiveRow.Cells("StuBasisNo").Value.ToString) + + ugrRow = FindRecordPosition(iugDetail, "ContactorName", ContactorName) + If Not ugrRow Is Nothing Then + Me.iugDetail.iMESUltraGrid.ActiveRow = ugrRow + Me.iugDetail.iMESUltraGrid.ActiveRow.Selected = True + End If + Else + + Exit Sub + End If + + End Sub + + Private Sub btnDDel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDDel.Click + + + '1.先檢查是否為單筆,是:將其Selecte + If Me.iugDetail.iMESUltraGrid.ActiveRow Is Nothing Then Exit Sub + If iugDetail.iMESUltraGrid.ActiveRow.IsGroupByRow Then Exit Sub + + Cursor.Current = Cursors.WaitCursor + + If Not Me.iugDetail.iMESUltraGrid.ActiveRow.Selected Then + Me.iugDetail.iMESUltraGrid.ActiveRow.Selected = True + End If + + '2.Multi + If Me.iugDetail.iMESUltraGrid.Selected.Rows.Count > 0 Then + If Me.iugDetail.iMESUltraGrid.Selected.Rows.Item(0).IsGroupByRow Then + Exit Sub 'Selected.Rows,不會包含GroupRow & 一般的Row在一起,故若是GroupRow不做任何處理 + End If + If iMESExceptionManager.ExceptionManager.iMESMsgBoxShowDialog(ChgTranslateName_Msg("0000-100001", "[%ARE YOU SURE TO DELETE ALL SELECTED RECORDS%]"), MsgBoxStyle.OkCancel + MsgBoxStyle.Question + MsgBoxStyle.DefaultButton2, Me.Text) = MsgBoxResult.Cancel Then + Exit Sub + End If + + '共用資料 + Dim XmlDoc As New XmlDocument + Dim blnReLoad As Boolean = False + Dim intIssueState As Integer + + strIdentity = CombineXMLIdentity(gComputerName, gUserNo, GetNow()) + For i = 0 To Me.iugDetail.iMESUltraGrid.Selected.Rows.Count - 1 + strParameter = CombineXMLParameter("StuBasisNo", "StuBasisNo", "String", CInput(Me.iugStuBasis.iMESUltraGrid.ActiveRow.Cells("StuBasisNo").Value.ToString), "") + strParameter = strParameter & CombineXMLParameter("ContactorName", "ContactorName", "String", CInput(Me.iugDetail.iMESUltraGrid.Selected.Rows(i).Cells("ContactorName").Value.ToString), "") + InXml = CombineXMLRequest(strIdentity, strParameter) + Try + ' 2016 YF, OutXml = wsENT.DelStuBasisCont(InXml) + 'OutXml = InvokeSrv("wsENT.DelStuBasisCont", InXml) + OutXml = InvokeSrv("SXS.wsENT.DelStuBasisCont", InXml) + + XmlDoc.LoadXml(OutXml) + If ChkExecutionSuccess(XmlDoc) Then + If Not blnReLoad Then blnReLoad = True + Else + '找出Exception訊並顯示出來 + ExceptionManager.iMESShowDialog(GetExceptionCode(XmlDoc), GetExceptionSysMsg(XmlDoc), GetExceptionStack(XmlDoc)) + Exit For + End If + Catch ex As Exception + 'MsgBox("Unexpected Error. Delete failed," & e1.Message, MsgBoxStyle.Exclamation) + ExceptionManager.iMESShowDialog(defWinErrCode, ex.Message, ex.StackTrace) + Exit For + End Try + + Next + + XmlDoc = Nothing + + If blnReLoad Then Call funLoadStuBasisCont(Me.iugStuBasis.iMESUltraGrid.ActiveRow.Cells("StuBasisNo").Value.ToString) + + End If + + Cursor.Current = Cursors.Default + + End Sub + + Private Sub btnDCopy_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDCopy.Click + + If Not Me.iugStuBasis.iMESUltraGrid.ActiveRow Is Nothing And Not Me.iugDetail.iMESUltraGrid.ActiveRow Is Nothing Then + If iugStuBasis.iMESUltraGrid.ActiveRow.IsGroupByRow OrElse iugDetail.iMESUltraGrid.ActiveRow.IsGroupByRow Then Exit Sub + Dim Rows As DataRow() + + '找出DataSet中在目前游標列的資料列(DataRow) + Rows = dsENT.Tables(tblENTStuBasisCont).Select("StuBasisNo = '" _ + & Replace(Me.iugStuBasis.iMESUltraGrid.ActiveRow.Cells("StuBasisNo").Value.ToString, "'", "''") & "'" _ + & " And ContactorName = '" & Replace(Me.iugDetail.iMESUltraGrid.ActiveRow.Cells("ContactorName").Value.ToString, "'", "''") & "'") + + Dim fStuBasisContDef As New frmStuBasisContDef + fStuBasisContDef.DefMode = 2 + fStuBasisContDef.EditDataRow = Rows(0) + fStuBasisContDef.StuBasisNo = Me.iugStuBasis.iMESUltraGrid.ActiveRow.Cells("StuBasisNo").Value.ToString + fStuBasisContDef.ShowDialog(Me) + + If gReturnKeyValue = "" Then Exit Sub + + ContactorName = gReturnKeyValue + + '重新取出資料 + Call funLoadStuBasisCont(Me.iugStuBasis.iMESUltraGrid.ActiveRow.Cells("StuBasisNo").Value.ToString) + + ugrRow = FindRecordPosition(iugDetail, "ContactorName", ContactorName) + If Not ugrRow Is Nothing Then + Me.iugDetail.iMESUltraGrid.ActiveRow = ugrRow + Me.iugDetail.iMESUltraGrid.ActiveRow.Selected = True + End If + Else + + Exit Sub + End If + + End Sub + + Private Sub btnEMail_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEMail.Click + + If Not Me.iugDetail.iMESUltraGrid.ActiveRow Is Nothing Then + If iugDetail.iMESUltraGrid.ActiveRow.IsGroupByRow Then Exit Sub + Dim Rows As DataRow() + Dim proMail As New System.Diagnostics.Process + Dim strAccount As String + + Rows = dsENT.Tables(tblENTStuBasisCont).Select("StuBasisNo = '" _ + & Replace(Me.iugStuBasis.iMESUltraGrid.ActiveRow.Cells("StuBasisNo").Value.ToString, "'", "''") & "'" _ + & " And ContactorName = '" & Replace(Me.iugDetail.iMESUltraGrid.ActiveRow.Cells("ContactorName").Value.ToString, "'", "''") & "'") + + strAccount = "mailto:" & Rows(0).Item("EMail").ToString + proMail.Start(strAccount) + + End If + + End Sub + + Private Sub btnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClose.Click + Me.Close() + End Sub + + Protected Overrides Sub btnQuery_Click(sender As Object, e As EventArgs) + Cursor.Current = Cursors.WaitCursor + + funLoadStuBasis() + + Cursor.Current = Cursors.Default + End Sub + +#Region "Ultra Grid" + + Private Sub iugStuBasis_iMESUltraGrid_InitializeLayOut(ByVal sender As System.Object, ByVal e As Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs) Handles iugStuBasis.iMESUltraGrid_InitializeLayOut + + With e.Layout + With .Bands(0).Columns("StuBasisNo") + .Header.Caption = "StuBasisNo" + .Width = 110 + .Hidden = False + .Header.VisiblePosition = 0 + End With + With .Bands(0).Columns("StuBasisName") + .Header.Caption = "StuBasisName" + .Width = 110 + .Hidden = False + .CellMultiLine = DefaultableBoolean.True + .Header.VisiblePosition = 1 + End With + With .Bands(0).Columns("Sex") + .Header.Caption = "Sex" + .Width = 110 + .Hidden = False + .CellMultiLine = DefaultableBoolean.True + .Header.VisiblePosition = 2 + End With + + End With + + '語系切換 + Call ExeChangeResource(Me, gLanguageMode) + End Sub + + Private Sub iugStuBasis_iMESUltraGrid_AfterRowActivate(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles iugStuBasis.iMESUltraGrid_AfterRowActivate + + 'IsGroupByRow不做任何處理 + 'If Not iugStuBasis.iMESUltraGrid.ActiveRow.IsGroupByRow Then + 'Call funLoadStuBasisCont(Me.iugStuBasis.iMESUltraGrid.ActiveRow.Cells("StuBasisNo").Value.ToString) + 'Else + 'Exit Sub + 'End If + + End Sub + + Private Sub iugDetail_iMESUltraGrid_InitializeLayOut(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs) Handles iugDetail.iMESUltraGrid_InitializeLayOut + + With e.Layout + With .Bands(0).Columns("StuBasisNo") + .Header.Caption = "StuBasisNo" + .Width = 110 + .Hidden = False + .Header.VisiblePosition = 0 + End With + With .Bands(0).Columns("TeacherName") + .Header.Caption = "TeacherName" + .Width = 110 + .Hidden = False + .Header.VisiblePosition = 1 + End With + With .Bands(0).Columns("TelNo") + .Header.Caption = "TelNo" + .Width = 110 + .Hidden = False + .Header.VisiblePosition = 2 + End With + With .Bands(0).Columns("Description") + .Header.Caption = "Description" + .Width = 200 + .Hidden = False + .CellMultiLine = DefaultableBoolean.True + .Header.VisiblePosition = 3 + End With + With .Bands(0).Columns("Creator") + .Header.Caption = "Creator" + .Width = 80 + .Hidden = False + .Header.VisiblePosition = 4 + End With + With .Bands(0).Columns("CreateDate") + .Header.Caption = "CreateDate" + .Width = 150 + .Format = "yyyy/MM/dd HH:mm:ss" + .Hidden = False + .Header.VisiblePosition = 5 + End With + With .Bands(0).Columns("Reviser") + .Header.Caption = "Reviser" + .Width = 80 + .Hidden = False + .Header.VisiblePosition = 6 + End With + With .Bands(0).Columns("ReviseDate") + .Header.Caption = "ReviseDate" + .Width = 150 + .Format = "yyyy/MM/dd HH:mm:ss" + .Hidden = False + .Header.VisiblePosition = 7 + End With + With e.Layout.Bands(0).Columns("DataStamp") + .Hidden = True + End With + End With + + '語系切換 + Call ExeChangeResource(Me, gLanguageMode) + End Sub + +#End Region + +#Region "Load Function" + + '//取出tblENTStuBasis 外包商資料 + + Private Sub funLoadStuBasis() + + '先判斷是否dataset中已有ENTStuBasis之datatable,若有,需先remove否則會有錯誤 + If Not IsNothing(dsENT.Tables(tblENTStuBasis)) Then + dsENT.Tables.Remove(tblENTStuBasis) + End If + + '組InXml的字串 + strIdentity = CombineXMLIdentity(gComputerName, gUserNo, GetNow()) + '加上IssueState要求取出所有資料 + strParameter = CombineXMLParameter("issuestate", "IssueState", "Integer", defInteger, "") + '加上查詢條件 cboSearchFieldName,txtSearchFieldValue + strParameter += CombineXMLQueryCondition() + InXml = CombineXMLRequest(strIdentity, strParameter) + + Try + ' 2016 YF, OutXml = wsENT.LoadStuBasis(InXml) + 'OutXml = InvokeSrv("wsENT.LoadStuBasis", InXml) + OutXml = InvokeSrv("SXS.ws_21685.LoadStuBasis", InXml) + + Dim XmlDoc As New XmlDocument '處理Xml字串之物件? + + '利用XmlDoc物件處理ReturnValue + XmlDoc.LoadXml(OutXml) + + If ChkExecutionSuccess(XmlDoc) Then + '讀取取出資料表之名稱 + + tblENTStuBasis = XmlDoc.GetElementsByTagName("returnvalue").Item(0).SelectNodes("loadStuBasis").Item(0).SelectNodes("name").Item(0).InnerXml + '取出Schema,dataset讀取Schema可防止Null Field及DateTime的問題 + + XmlSchema = XmlDoc.DocumentElement.GetElementsByTagName("loadStuBasis").Item(0).SelectNodes("schema").Item(0).InnerXml + If XmlSchema <> "" Then + '將XML讀入String Reader object中,因為Dataset讀入XML時必須透過String Reader物件 + tmpStringReader = New System.IO.StringReader(XmlSchema) + dsENT.ReadXmlSchema(tmpStringReader) + tmpStringReader.Close() + End If + + '取出Data + XmlData = XmlDoc.DocumentElement.GetElementsByTagName("loadStuBasis").Item(0).SelectNodes("value").Item(0).InnerXml + If XmlData <> "" Then + tmpStringReader = New System.IO.StringReader(XmlData) + dsENT.ReadXml(tmpStringReader, XmlReadMode.InferSchema) + tmpStringReader.Close() + End If + + strFilter = "" + Select Case GetIssueState() + Case Issue.Unfrozen + strFilter = FilterByInteger(strFilter, "IssueState", 0) + Case Issue.Pending + strFilter = FilterByInteger(strFilter, "IssueState", 1) + Case Issue.Active + strFilter = FilterByInteger(strFilter, "IssueState", 2) + Case Issue.Unused + strFilter = FilterByInteger(strFilter, "IssueState", -1) + End Select + + dsENT.Tables(tblENTStuBasis).DefaultView.RowFilter = strFilter + dsENT.Tables(tblENTStuBasis).DefaultView.Sort = "StuBasisNo" + + Me.iugStuBasis.iMESUltraGrid.DataSource = dsENT.Tables(tblENTStuBasis).DefaultView + + Else + ExceptionManager.iMESShowDialog(GetExceptionCode(XmlDoc), GetExceptionSysMsg(XmlDoc), GetExceptionStack(XmlDoc)) + Exit Sub + End If + + XmlDoc = Nothing + + Catch ex As Exception + 'MsgBox("Unexpected Error. Load ENT StuBasis Failed!!," & e1.Message, MsgBoxStyle.Exclamation) + ExceptionManager.iMESShowDialog(defWinErrCode, ex.Message, ex.StackTrace) + End Try + + End Sub + + '//取出tblENTStuBasisCont聯絡人資料 + + Private Sub funLoadStuBasisCont(ByRef StuBasisNo As String) + + If Not IsNothing(dsENT.Tables(tblENTStuBasisCont)) Then + dsENT.Tables.Remove(tblENTStuBasisCont) + End If + + '組InXml的字串 + strIdentity = CombineXMLIdentity(gComputerName, gUserNo, GetNow()) + strParameter = CombineXMLParameter("StuBasisNo", "StuBasisNo", "String", StuBasisNo, "") + InXml = CombineXMLRequest(strIdentity, strParameter) + + Try + ' 2016 YF, OutXml = wsENT.LoadStuBasisCont(InXml) + 'OutXml = InvokeSrv("wsENT.LoadStuBasisCont", InXml) + OutXml = InvokeSrv("SXS.ws_21685.LoadStuBasisCont", InXml) + + Dim XmlDoc As New XmlDocument '處理Xml字串之物件? + + '利用XmlDoc物件處理ReturnValue + XmlDoc.LoadXml(OutXml) + If ChkExecutionSuccess(XmlDoc) Then + '讀取取出資料表之名稱 + + tblENTStuBasisCont = XmlDoc.GetElementsByTagName("returnvalue").Item(0).SelectNodes("loadStuBasiscont").Item(0).SelectNodes("name").Item(0).InnerXml + '取出Schema,dataset讀取Schema可防止Null Field及DateTime的問題 + XmlSchema = XmlDoc.DocumentElement.GetElementsByTagName("loadStuBasiscont").Item(0).SelectNodes("schema").Item(0).InnerXml + If XmlSchema <> "" Then + '將XML讀入String Reader object中,因為Dataset讀入XML時必須透過String Reader物件 + tmpStringReader = New System.IO.StringReader(XmlSchema) + dsENT.ReadXmlSchema(tmpStringReader) + tmpStringReader.Close() + End If + + '取出Data + XmlData = XmlDoc.DocumentElement.GetElementsByTagName("loadStuBasiscont").Item(0).SelectNodes("value").Item(0).InnerXml + If XmlData <> "" Then + tmpStringReader = New System.IO.StringReader(XmlData) + dsENT.ReadXml(tmpStringReader, XmlReadMode.InferSchema) + tmpStringReader.Close() + End If + + Me.iugDetail.iMESUltraGrid.DataSource = dsENT.Tables(tblENTStuBasisCont).DefaultView + + Else + ExceptionManager.iMESShowDialog(GetExceptionCode(XmlDoc), GetExceptionSysMsg(XmlDoc), GetExceptionStack(XmlDoc)) + End If + + XmlDoc = Nothing + + Catch ex As Exception + 'MsgBox("Unexpected Error. Load ENT StuBasis Cont Failed!!," & e1.Message, MsgBoxStyle.Exclamation) + ExceptionManager.iMESShowDialog(defWinErrCode, ex.Message, ex.StackTrace) + End Try + + End Sub + + Private Sub funShowActiveDetail() + + If Me.iugStuBasis.iMESUltraGrid.ActiveRow Is Nothing Then + Me.iugDetail.iMESUltraGrid.DataSource = Nothing + Else + Call funLoadStuBasisCont(Me.iugStuBasis.iMESUltraGrid.ActiveRow.Cells("StuBasisNo").Value.ToString) + End If + + End Sub + + Private Sub funiMESUltraGridIni() + + 'iugStuBasis 初始設定 + With Me.iugStuBasis.iMESUltraGrid + .Text = "" + .DisplayLayout.GroupByBox.Hidden = True + .DisplayLayout.UseFixedHeaders = False + End With + + '系統會以UserNo做為Layout的檔名 + + iugStuBasis.UserNo = gUserNo + + 'iugDetail 初始設定 + With Me.iugDetail.iMESUltraGrid.DisplayLayout + .GroupByBox.Hidden = True + .Override.ExpansionIndicator = ShowExpansionIndicator.Default + .ViewStyle = ViewStyle.SingleBand + .RowConnectorStyle = RowConnectorStyle.Default + + End With + + '系統會以UserNo做為Layout的檔名 + + iugDetail.UserNo = gUserNo + + End Sub + + Private Sub iugStuBasis_Load(sender As Object, e As EventArgs) Handles iugStuBasis.Load + + End Sub + + +#End Region + +End Class + diff --git a/SRC/MESWin/SYS1/ENT_21685/frmSubcontractorContDef.resx b/SRC/MESWin/SYS1/ENT_21685/frmSubcontractorContDef.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/SRC/MESWin/SYS1/ENT_21685/frmSubcontractorContDef.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/SRC/MESWin/SYS1/ENT_21685/frmSubcontractorContDef.vb b/SRC/MESWin/SYS1/ENT_21685/frmSubcontractorContDef.vb new file mode 100644 index 0000000..da4daf3 --- /dev/null +++ b/SRC/MESWin/SYS1/ENT_21685/frmSubcontractorContDef.vb @@ -0,0 +1,507 @@ +Imports iMESExceptionManager + +Public Class frmStuBasisContDef + + Inherits COM_Kit.frmDefTemplat + + '//Public Variables + Public EditDataRow As DataRow + Public DefMode As Integer = 0 '0. ADD, 1.Edit, 2. Copy + + Public StuBasisNo As String = defString + Public PrivFunNo As String = defString + + '//Web Service相關變數 + ' 2016 YF, Dim wsENT As New wsENT.wsENT + Dim InXml As String + Dim OutXml As String + + Dim strIdentity As String + Dim strParameter As String + Dim intDataStamp As Integer '紀錄DataStamp + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents txtDescription As System.Windows.Forms.RichTextBox + Friend WithEvents lblTelNo As System.Windows.Forms.Label + Friend WithEvents lblDescription As System.Windows.Forms.Label + Friend WithEvents lblTeacherName As System.Windows.Forms.Label + Friend WithEvents lblStuBasisNo As System.Windows.Forms.Label + Friend WithEvents gbxStuBasisContData As System.Windows.Forms.GroupBox + Friend WithEvents txtStuBasisNo As Infragistics.Win.UltraWinEditors.UltraTextEditor + Friend WithEvents txtTeacherName As Infragistics.Win.UltraWinEditors.UltraTextEditor + Friend WithEvents txtTelNo As Infragistics.Win.UltraWinEditors.UltraTextEditor + Private Sub InitializeComponent() + Dim Appearance1 As Infragistics.Win.Appearance = New Infragistics.Win.Appearance() + Me.gbxStuBasisContData = New System.Windows.Forms.GroupBox() + Me.lblTelNo = New System.Windows.Forms.Label() + Me.txtDescription = New System.Windows.Forms.RichTextBox() + Me.lblDescription = New System.Windows.Forms.Label() + Me.lblStuBasisNo = New System.Windows.Forms.Label() + Me.lblTeacherName = New System.Windows.Forms.Label() + Me.txtStuBasisNo = New Infragistics.Win.UltraWinEditors.UltraTextEditor() + Me.txtTeacherName = New Infragistics.Win.UltraWinEditors.UltraTextEditor() + Me.txtTelNo = New Infragistics.Win.UltraWinEditors.UltraTextEditor() + CType(Me.gbxBasisData, System.ComponentModel.ISupportInitialize).BeginInit() + Me.gbxStuBasisContData.SuspendLayout() + CType(Me.txtStuBasisNo, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.txtTeacherName, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.txtTelNo, System.ComponentModel.ISupportInitialize).BeginInit() + Me.SuspendLayout() + ' + 'gbxBasisData + ' + Me.gbxBasisData.Location = New System.Drawing.Point(12, 322) + Me.gbxBasisData.Size = New System.Drawing.Size(472, 70) + ' + 'btnApply + ' + Me.btnApply.Location = New System.Drawing.Point(396, 401) + ' + 'btnConfirm + ' + Me.btnConfirm.Location = New System.Drawing.Point(208, 401) + ' + 'btnClose + ' + Me.btnClose.Location = New System.Drawing.Point(302, 401) + ' + 'gbxStuBasisContData + ' + Me.gbxStuBasisContData.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _ + Or System.Windows.Forms.AnchorStyles.Left) _ + Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.gbxStuBasisContData.Controls.Add(Me.lblTelNo) + Me.gbxStuBasisContData.Controls.Add(Me.txtDescription) + Me.gbxStuBasisContData.Controls.Add(Me.lblDescription) + Me.gbxStuBasisContData.Controls.Add(Me.lblStuBasisNo) + Me.gbxStuBasisContData.Controls.Add(Me.lblTeacherName) + Me.gbxStuBasisContData.Controls.Add(Me.txtStuBasisNo) + Me.gbxStuBasisContData.Controls.Add(Me.txtTeacherName) + Me.gbxStuBasisContData.Controls.Add(Me.txtTelNo) + Me.gbxStuBasisContData.Font = New System.Drawing.Font("Times New Roman", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.gbxStuBasisContData.Location = New System.Drawing.Point(15, 8) + Me.gbxStuBasisContData.Name = "gbxStuBasisContData" + Me.gbxStuBasisContData.Size = New System.Drawing.Size(469, 306) + Me.gbxStuBasisContData.TabIndex = 0 + Me.gbxStuBasisContData.TabStop = False + Me.gbxStuBasisContData.Text = "ENT StuBasis Contactor Data" + ' + 'lblTelNo + ' + Me.lblTelNo.Font = New System.Drawing.Font("Times New Roman", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.lblTelNo.Location = New System.Drawing.Point(24, 90) + Me.lblTelNo.Name = "lblTelNo" + Me.lblTelNo.Size = New System.Drawing.Size(86, 14) + Me.lblTelNo.TabIndex = 4 + Me.lblTelNo.Text = "TelNo" + Me.lblTelNo.TextAlign = System.Drawing.ContentAlignment.TopRight + ' + 'txtDescription + ' + Me.txtDescription.Font = New System.Drawing.Font("Times New Roman", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.txtDescription.Location = New System.Drawing.Point(120, 138) + Me.txtDescription.Name = "txtDescription" + Me.txtDescription.Size = New System.Drawing.Size(336, 108) + Me.txtDescription.TabIndex = 15 + Me.txtDescription.Text = "" + ' + 'lblDescription + ' + Me.lblDescription.Font = New System.Drawing.Font("Times New Roman", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.lblDescription.Location = New System.Drawing.Point(28, 138) + Me.lblDescription.Name = "lblDescription" + Me.lblDescription.Size = New System.Drawing.Size(86, 14) + Me.lblDescription.TabIndex = 14 + Me.lblDescription.Text = "Description" + Me.lblDescription.TextAlign = System.Drawing.ContentAlignment.TopRight + ' + 'lblStuBasisNo + ' + Me.lblStuBasisNo.Font = New System.Drawing.Font("Times New Roman", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.lblStuBasisNo.Location = New System.Drawing.Point(14, 29) + Me.lblStuBasisNo.Name = "lblStuBasisNo" + Me.lblStuBasisNo.Size = New System.Drawing.Size(96, 14) + Me.lblStuBasisNo.TabIndex = 0 + Me.lblStuBasisNo.Text = "StuBasis No" + Me.lblStuBasisNo.TextAlign = System.Drawing.ContentAlignment.TopRight + ' + 'lblTeacherName + ' + Me.lblTeacherName.Font = New System.Drawing.Font("Times New Roman", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.lblTeacherName.Location = New System.Drawing.Point(24, 59) + Me.lblTeacherName.Name = "lblTeacherName" + Me.lblTeacherName.Size = New System.Drawing.Size(86, 14) + Me.lblTeacherName.TabIndex = 2 + Me.lblTeacherName.Text = "Teacher Name" + Me.lblTeacherName.TextAlign = System.Drawing.ContentAlignment.TopRight + ' + 'txtStuBasisNo + ' + Me.txtStuBasisNo.Location = New System.Drawing.Point(120, 24) + Me.txtStuBasisNo.Name = "txtStuBasisNo" + Me.txtStuBasisNo.ReadOnly = True + Me.txtStuBasisNo.Size = New System.Drawing.Size(114, 22) + Me.txtStuBasisNo.TabIndex = 1 + Me.txtStuBasisNo.TabStop = False + ' + 'txtTeacherName + ' + Appearance1.BackColor = System.Drawing.Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(192, Byte), Integer)) + Me.txtTeacherName.Appearance = Appearance1 + Me.txtTeacherName.BackColor = System.Drawing.Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(192, Byte), Integer)) + Me.txtTeacherName.Location = New System.Drawing.Point(120, 56) + Me.txtTeacherName.Name = "txtTeacherName" + Me.txtTeacherName.Size = New System.Drawing.Size(160, 22) + Me.txtTeacherName.TabIndex = 3 + ' + 'txtTelNo + ' + Me.txtTelNo.Location = New System.Drawing.Point(120, 88) + Me.txtTelNo.Name = "txtTelNo" + Me.txtTelNo.Size = New System.Drawing.Size(114, 22) + Me.txtTelNo.TabIndex = 5 + ' + 'frmStuBasisContDef + ' + Me.ClientSize = New System.Drawing.Size(496, 446) + Me.Controls.Add(Me.gbxStuBasisContData) + Me.Font = New System.Drawing.Font("Times New Roman", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.Name = "frmStuBasisContDef" + Me.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide + Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen + Me.Text = "ENT StuBasis Contactor Define" + Me.Controls.SetChildIndex(Me.btnClose, 0) + Me.Controls.SetChildIndex(Me.btnConfirm, 0) + Me.Controls.SetChildIndex(Me.btnApply, 0) + Me.Controls.SetChildIndex(Me.gbxBasisData, 0) + Me.Controls.SetChildIndex(Me.gbxStuBasisContData, 0) + CType(Me.gbxBasisData, System.ComponentModel.ISupportInitialize).EndInit() + Me.gbxStuBasisContData.ResumeLayout(False) + Me.gbxStuBasisContData.PerformLayout() + CType(Me.txtStuBasisNo, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.txtTeacherName, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.txtTelNo, System.ComponentModel.ISupportInitialize).EndInit() + Me.ResumeLayout(False) + + End Sub + +#End Region + + Private Sub frmStuBasisContDef_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load + + Cursor.Current = Cursors.WaitCursor + + Select Case DefMode + Case 0 + Me.Text = Me.Text & "(ADD)" + Case 1 + Me.Text = Me.Text & "(EDIT)" + Case 2 + Me.Text = Me.Text & "(Copy)" + Case Else + Me.Text = Me.Text & "(Unknown)" + End Select + + '做為MainForm判斷是否重新LoadData的依據() + gReturnKeyValue = "" + + ' 2016 YF, wsENT.Url = LocalizeWebService(wsENT.Url.ToString) + ' 2016 YF, wsENT.EnableDecompression = True + If DefMode = 0 Or DefMode = 2 Then + SetCreateDate(Now) + SetCreator(gUserNo) + End If + If Not EditDataRow Is Nothing Then '修改 or Copy + txtStuBasisNo.Text = EditDataRow.Item("StuBasisNo").ToString + txtTeacherName.Text = EditDataRow.Item("ContactorName").ToString + txtTelNo.Text = EditDataRow.Item("TelNo").ToString + 'txtDescription是RichTextBox(Control, 因為TextBox無法正常顯示多行換行的資料) + txtDescription.Text = EditDataRow.Item("Description").ToString + If DefMode = 1 Then + If (Not IsDBNull(EditDataRow("Creator"))) Then + SetCreateDate(Convert.ToDateTime(EditDataRow.Item("CreateDate"))) + SetCreator(EditDataRow.Item("Creator").ToString) + End If + End If + End If + + If DefMode = 0 Then 'Add + txtStuBasisNo.Text = StuBasisNo + SetCreateDate(Now) + SetCreator(gUserNo) + ElseIf DefMode = 1 Then 'Edit + txtTeacherName.ReadOnly = True + SetReviseDate(Now) + SetReviser(gUserNo) + intDataStamp = EditDataRow.Item("DataStamp") + End If + + btnApplyEnabled = False + + '語系切換 + Call ExeChangeResource(Me, gLanguageMode) + ExeGroupControlPriv(Me, PrivFunNo) + + Cursor.Current = Cursors.Default + + End Sub + + Private Sub frmStuBasisContDef_Activated(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Activated + If DefMode = 0 Or DefMode = 2 Then + txtTeacherName.Focus() + Else + txtTelNo.Focus() + End If + End Sub + + Protected Overrides Sub btnConfirm_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) + + Cursor.Current = Cursors.WaitCursor + + If funAddorEdit(sender) < 0 Then Exit Sub + + Me.Close() + + Cursor.Current = Cursors.Default + + End Sub + + Protected Overrides Sub btnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) + Me.Close() + End Sub + + Protected Overrides Sub btnApply_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) + + Cursor.Current = Cursors.WaitCursor + + If funAddorEdit(sender) < 0 Then Exit Sub + + If DefMode = 0 Or DefMode = 2 Then + txtTeacherName.Focus() + Else + txtTelNo.Focus() + End If + + btnApplyEnabled = False + Cursor.Current = Cursors.Default + + End Sub + +#Region "Control KeyPress" + + Private Sub txtStuBasisNo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtStuBasisNo.Click + txtStuBasisNo.SelectAll() + End Sub + + Private Sub txtStuBasisNo_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtStuBasisNo.Enter + txtStuBasisNo.SelectAll() + End Sub + + Private Sub txtStuBasisNo_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtStuBasisNo.KeyPress + If e.KeyChar = Convert.ToChar(13) Then + SendKeys.Send("{TAB}") + End If + End Sub + + Private Sub txtStuBasisNo_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtStuBasisNo.TextChanged + btnApplyEnabled = True + End Sub + + Private Sub txtContactorName_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtTeacherName.Click + txtTeacherName.SelectAll() + End Sub + + Private Sub txtContactorName_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtTeacherName.Enter + txtTeacherName.SelectAll() + End Sub + + Private Sub txtContactorName_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtTeacherName.KeyPress + If e.KeyChar = Convert.ToChar(13) Then + SendKeys.Send("{TAB}") + End If + End Sub + + 'Private Sub txtContactorName_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtContactorName.Leave + 'xtContactorName.Text <> "" And txtEMail.Text = "" Then + ' txtEMail.Text = txtContactorName.Text & "@" + 'End If + ' txtContactorName.Text = UCase(txtContactorName.Text) + 'End Sub + + Private Sub txtContactorName_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtTeacherName.TextChanged + btnApplyEnabled = True + End Sub + + Private Sub txtTelNo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtTelNo.Click + txtTelNo.SelectAll() + End Sub + + Private Sub txtTelNo_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtTelNo.Enter + txtTelNo.SelectAll() + End Sub + + Private Sub txtTelNo_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtTelNo.KeyPress + If e.KeyChar = Convert.ToChar(13) Then + SendKeys.Send("{TAB}") + End If + End Sub + + Private Sub txtTelNo_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtTelNo.TextChanged + btnApplyEnabled = True + End Sub + + + Private Sub txtFaxNo_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) + If e.KeyChar = Convert.ToChar(13) Then + SendKeys.Send("{TAB}") + End If + End Sub + + Private Sub txtFaxNo_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) + btnApplyEnabled = True + End Sub + + + Private Sub txtTitle_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) + If e.KeyChar = Convert.ToChar(13) Then + SendKeys.Send("{TAB}") + End If + End Sub + + Private Sub txtTitle_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) + btnApplyEnabled = True + End Sub + + + Private Sub txtAddress_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) + If e.KeyChar = Convert.ToChar(13) Then + SendKeys.Send("{TAB}") + End If + End Sub + + Private Sub txtAddress_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) + btnApplyEnabled = True + End Sub + + Private Sub txtDescription_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtDescription.Click + txtDescription.SelectAll() + End Sub + + Private Sub txtDescription_Enter(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtDescription.Enter + txtDescription.SelectAll() + End Sub + + Private Sub txtDescription_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtDescription.KeyPress + If e.KeyChar = Convert.ToChar(13) Then + SendKeys.Send("{TAB}") + End If + End Sub + + Private Sub txtDescription_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtDescription.TextChanged + btnApplyEnabled = True + End Sub + +#End Region + +#Region "Others" + + Private Function funAddorEdit(sender As Object) As Integer + + funAddorEdit = -1 + + '****************************************************************************** + '1.基本檢查() + '****************************************************************************** + If txtStuBasisNo.Text = "" Then + iMESExceptionManager.ExceptionManager.iMESMsgBoxShowDialog(ChgTranslateName_Msg("0000-200001", "[%StuBasisNo%]"), MsgBoxStyle.Exclamation, Me.Text) + txtStuBasisNo.Focus() + Exit Function + End If + If txtTeacherName.Text = "" Then + iMESExceptionManager.ExceptionManager.iMESMsgBoxShowDialog(ChgTranslateName_Msg("0000-200001", "[%TeacherName%]"), MsgBoxStyle.Exclamation, Me.Text) + txtTeacherName.Focus() + Exit Function + End If + + '****************************************************************************** + '2.寫回資料庫() + '****************************************************************************** + Dim XmlDoc As New XmlDocument + + Try + strIdentity = CombineXMLIdentity(gComputerName, gUserNo, GetNow()) + strParameter = CombineXMLParameter("stubasisno", "StuBasisNo", "String", CInput(txtStuBasisNo.Text), "") + strParameter = strParameter & CombineXMLParameter("teachername", "teachername", "String", CInput(txtTeacherName.Text), "") + strParameter = strParameter & CombineXMLParameter("description", "Description", "String", CInput(txtDescription.Text), "") + + + If DefMode = 0 Or DefMode = 2 Then 'Add or Copy + strParameter += CombineXMLParameter("creator", "Creator", "String", gUserNo, "") + InXml = CombineXMLRequest(strIdentity, strParameter) + ' 2016 YF, OutXml = wsENT.AddStuBasisCont(InXml) + OutXml = InvokeSrv("SXS.ws_21685.AddStuBasisCont", InXml) + + Else 'Edit + ' 增加Datastamp + strParameter += CombineXMLParameter("datastamp", "Datastamp", "Integer", intDataStamp, "") + InXml = CombineXMLRequest(strIdentity, strParameter) + ' 2016 YF, OutXml = wsENT.EditStuBasisCont(InXml) + OutXml = InvokeSrv("SXS.ws_21685.EditStuBasisCont", InXml) + + End If + + XmlDoc.LoadXml(OutXml) + If ChkExecutionSuccess(XmlDoc) Then + gReturnKeyValue = txtTeacherName.Text + + funAddorEdit = 0 + If sender.Equals(btnApply) Then + intDataStamp += 1 + End If + Else + ExceptionManager.iMESShowDialog(GetExceptionCode(XmlDoc), GetExceptionSysMsg(XmlDoc), GetExceptionStack(XmlDoc)) + End If + + Catch ex As Exception + 'MsgBox("Unexpected Error. Add or Edit ENT StuBasis Contactor Failed!," & e1.Message, MsgBoxStyle.Exclamation) + ExceptionManager.iMESShowDialog(defWinErrCode, ex.Message, ex.StackTrace) + End Try + + XmlDoc = Nothing + + End Function +#End Region + + + Private Sub frmStuBasisContDef_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing + ' 2016 YF, If Not wsENT Is Nothing Then wsENT.Dispose() + End Sub +End Class + diff --git a/SRC/MESWin/SYS1/ENT_21685/frmSubcontractorDef.resx b/SRC/MESWin/SYS1/ENT_21685/frmSubcontractorDef.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/SRC/MESWin/SYS1/ENT_21685/frmSubcontractorDef.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/SRC/MESWin/SYS1/ENT_21685/frmSubcontractorDef.vb b/SRC/MESWin/SYS1/ENT_21685/frmSubcontractorDef.vb new file mode 100644 index 0000000..9ce4dff --- /dev/null +++ b/SRC/MESWin/SYS1/ENT_21685/frmSubcontractorDef.vb @@ -0,0 +1,482 @@ +Imports iMESExceptionManager + +Public Class frmStuBasisDef + + Inherits COM_Kit.frmDefTemplat + + '//Public Variables + Public EditDataRow As DataRow + Public DefMode As Integer = 0 '0. ADD, 1.Edit, 2. Copy + Public PrivFunNo As String = defString + + '//Web Service相關變數 + ' 2016 YF, Dim wsENT As New wsENT.wsENT + Dim InXml As String + Dim OutXml As String + + Dim strIdentity As String + Dim strParameter As String + Friend WithEvents Sex As Infragistics.Win.UltraWinEditors.UltraTextEditor + Friend WithEvents lblStudentSex As Label + Dim intDataStamp As Integer '紀錄DataStamp + +#Region " Windows Form Designer generated code " + + Public Sub New() + MyBase.New() + + 'This call is required by the Windows Form Designer. + InitializeComponent() + + 'Add any initialization after the InitializeComponent() call + + End Sub + + 'Form overrides dispose to clean up the component list. + Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing Then + If Not (components Is Nothing) Then + components.Dispose() + End If + End If + MyBase.Dispose(disposing) + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + Friend WithEvents txtDescription As System.Windows.Forms.RichTextBox + Friend WithEvents lblDescription As System.Windows.Forms.Label + Friend WithEvents lblStudentId As System.Windows.Forms.Label + Friend WithEvents lblStudentName As System.Windows.Forms.Label + Friend WithEvents lblSex As System.Windows.Forms.Label + Friend WithEvents gbxStudentData As System.Windows.Forms.GroupBox + Friend WithEvents txtStuBasisNo As Infragistics.Win.UltraWinEditors.UltraTextEditor + Friend WithEvents txtStuBasisName As Infragistics.Win.UltraWinEditors.UltraTextEditor + Friend WithEvents txtSex As Infragistics.Win.UltraWinEditors.UltraTextEditor + Private Sub InitializeComponent() + Dim Appearance1 As Infragistics.Win.Appearance = New Infragistics.Win.Appearance() + Dim Appearance2 As Infragistics.Win.Appearance = New Infragistics.Win.Appearance() + Dim Appearance3 As Infragistics.Win.Appearance = New Infragistics.Win.Appearance() + Me.gbxStudentData = New System.Windows.Forms.GroupBox() + Me.Sex = New Infragistics.Win.UltraWinEditors.UltraTextEditor() + Me.lblStudentSex = New System.Windows.Forms.Label() + Me.txtDescription = New System.Windows.Forms.RichTextBox() + Me.lblDescription = New System.Windows.Forms.Label() + Me.lblStudentId = New System.Windows.Forms.Label() + Me.lblStudentName = New System.Windows.Forms.Label() + Me.txtStuBasisNo = New Infragistics.Win.UltraWinEditors.UltraTextEditor() + Me.txtStuBasisName = New Infragistics.Win.UltraWinEditors.UltraTextEditor() + CType(Me.gbxBasisData, System.ComponentModel.ISupportInitialize).BeginInit() + Me.gbxStudentData.SuspendLayout() + CType(Me.Sex, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.txtStuBasisNo, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.txtStuBasisName, System.ComponentModel.ISupportInitialize).BeginInit() + Me.SuspendLayout() + ' + 'gbxBasisData + ' + Me.gbxBasisData.Location = New System.Drawing.Point(12, 257) + Me.gbxBasisData.Size = New System.Drawing.Size(512, 70) + ' + 'btnApply + ' + Me.btnApply.Location = New System.Drawing.Point(436, 336) + ' + 'btnConfirm + ' + Me.btnConfirm.Location = New System.Drawing.Point(248, 336) + ' + 'btnClose + ' + Me.btnClose.Location = New System.Drawing.Point(342, 336) + ' + 'gbxStudentData + ' + Me.gbxStudentData.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _ + Or System.Windows.Forms.AnchorStyles.Left) _ + Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.gbxStudentData.Controls.Add(Me.Sex) + Me.gbxStudentData.Controls.Add(Me.lblStudentSex) + Me.gbxStudentData.Controls.Add(Me.txtDescription) + Me.gbxStudentData.Controls.Add(Me.lblDescription) + Me.gbxStudentData.Controls.Add(Me.lblStudentId) + Me.gbxStudentData.Controls.Add(Me.lblStudentName) + Me.gbxStudentData.Controls.Add(Me.txtStuBasisNo) + Me.gbxStudentData.Controls.Add(Me.txtStuBasisName) + Me.gbxStudentData.Font = New System.Drawing.Font("Times New Roman", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.gbxStudentData.Location = New System.Drawing.Point(12, 8) + Me.gbxStudentData.Name = "gbxStudentData" + Me.gbxStudentData.Size = New System.Drawing.Size(512, 241) + Me.gbxStudentData.TabIndex = 7 + Me.gbxStudentData.TabStop = False + Me.gbxStudentData.Text = "Student Data" + ' + 'Sex + ' + Appearance1.BackColor = System.Drawing.Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(192, Byte), Integer)) + Me.Sex.Appearance = Appearance1 + Me.Sex.BackColor = System.Drawing.Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(192, Byte), Integer)) + Me.Sex.Location = New System.Drawing.Point(128, 88) + Me.Sex.Name = "Sex" + Me.Sex.Size = New System.Drawing.Size(154, 30) + Me.Sex.TabIndex = 15 + ' + 'lblStudentSex + ' + Me.lblStudentSex.Font = New System.Drawing.Font("Times New Roman", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.lblStudentSex.Location = New System.Drawing.Point(10, 88) + Me.lblStudentSex.Name = "lblStudentSex" + Me.lblStudentSex.Size = New System.Drawing.Size(112, 32) + Me.lblStudentSex.TabIndex = 14 + Me.lblStudentSex.Text = "Student Sex" + Me.lblStudentSex.TextAlign = System.Drawing.ContentAlignment.TopRight + ' + 'txtDescription + ' + Me.txtDescription.Font = New System.Drawing.Font("Times New Roman", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.txtDescription.Location = New System.Drawing.Point(126, 131) + Me.txtDescription.Name = "txtDescription" + Me.txtDescription.Size = New System.Drawing.Size(334, 67) + Me.txtDescription.TabIndex = 2 + Me.txtDescription.Text = "" + ' + 'lblDescription + ' + Me.lblDescription.Font = New System.Drawing.Font("Times New Roman", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.lblDescription.Location = New System.Drawing.Point(56, 131) + Me.lblDescription.Name = "lblDescription" + Me.lblDescription.Size = New System.Drawing.Size(64, 14) + Me.lblDescription.TabIndex = 13 + Me.lblDescription.Text = "Description" + Me.lblDescription.TextAlign = System.Drawing.ContentAlignment.TopRight + ' + 'lblStudentId + ' + Me.lblStudentId.Font = New System.Drawing.Font("Times New Roman", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.lblStudentId.Location = New System.Drawing.Point(24, 24) + Me.lblStudentId.Name = "lblStudentId" + Me.lblStudentId.Size = New System.Drawing.Size(96, 32) + Me.lblStudentId.TabIndex = 5 + Me.lblStudentId.Text = "Student ID" + Me.lblStudentId.TextAlign = System.Drawing.ContentAlignment.TopRight + ' + 'lblStudentName + ' + Me.lblStudentName.Font = New System.Drawing.Font("Times New Roman", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.lblStudentName.Location = New System.Drawing.Point(8, 56) + Me.lblStudentName.Name = "lblStudentName" + Me.lblStudentName.Size = New System.Drawing.Size(112, 32) + Me.lblStudentName.TabIndex = 9 + Me.lblStudentName.Text = "Student Name" + Me.lblStudentName.TextAlign = System.Drawing.ContentAlignment.TopRight + ' + 'txtStuBasisNo + ' + Appearance2.BackColor = System.Drawing.Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(192, Byte), Integer)) + Me.txtStuBasisNo.Appearance = Appearance2 + Me.txtStuBasisNo.BackColor = System.Drawing.Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(192, Byte), Integer)) + Me.txtStuBasisNo.Location = New System.Drawing.Point(128, 24) + Me.txtStuBasisNo.Name = "txtStuBasisNo" + Me.txtStuBasisNo.Size = New System.Drawing.Size(152, 30) + Me.txtStuBasisNo.TabIndex = 0 + ' + 'txtStuBasisName + ' + Appearance3.BackColor = System.Drawing.Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(192, Byte), Integer)) + Me.txtStuBasisName.Appearance = Appearance3 + Me.txtStuBasisName.BackColor = System.Drawing.Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(192, Byte), Integer)) + Me.txtStuBasisName.Location = New System.Drawing.Point(128, 55) + Me.txtStuBasisName.Name = "txtStuBasisName" + Me.txtStuBasisName.Size = New System.Drawing.Size(152, 30) + Me.txtStuBasisName.TabIndex = 1 + ' + 'frmStuBasisDef + ' + Me.ClientSize = New System.Drawing.Size(536, 381) + Me.Controls.Add(Me.gbxStudentData) + Me.Font = New System.Drawing.Font("Times New Roman", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.Name = "frmStuBasisDef" + Me.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide + Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen + Me.Text = "ENT Student Define" + Me.Controls.SetChildIndex(Me.btnClose, 0) + Me.Controls.SetChildIndex(Me.btnConfirm, 0) + Me.Controls.SetChildIndex(Me.btnApply, 0) + Me.Controls.SetChildIndex(Me.gbxBasisData, 0) + Me.Controls.SetChildIndex(Me.gbxStudentData, 0) + CType(Me.gbxBasisData, System.ComponentModel.ISupportInitialize).EndInit() + Me.gbxStudentData.ResumeLayout(False) + Me.gbxStudentData.PerformLayout() + CType(Me.Sex, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.txtStuBasisNo, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.txtStuBasisName, System.ComponentModel.ISupportInitialize).EndInit() + Me.ResumeLayout(False) + + End Sub + +#End Region + + Private Sub frmStuBasisDef_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load + + Cursor.Current = Cursors.WaitCursor + + Select Case DefMode + Case 0 + Me.Text = Me.Text & "(ADD)" + Case 1 + Me.Text = Me.Text & "(EDIT)" + Case 2 + Me.Text = Me.Text & "(Copy)" + Case Else + Me.Text = Me.Text & "(Unknown)" + End Select + + '做為MainForm判斷是否重新LoadData的依據 + gReturnKeyValue = "" + + ' 2016 YF, wsENT.Url = LocalizeWebService(wsENT.Url.ToString) + ' 2016 YF, wsENT.EnableDecompression = True + + If Not EditDataRow Is Nothing Then + txtStuBasisNo.Text = EditDataRow.Item("StuBasisNo").ToString + txtStuBasisName.Text = EditDataRow.Item("StuBasisName").ToString + 'txtDescription是RichTextBox Control,因為TextBox無法正常顯示多行換行的資料 + txtDescription.Text = EditDataRow.Item("Description").ToString + End If + + If DefMode = 0 Or DefMode = 2 Then 'Add or Copy + SetCreator(gUserNo) + SetCreateDate(Now) + ElseIf DefMode = 1 Then 'Edit + txtStuBasisNo.ReadOnly = True + SetCreator(EditDataRow.Item("Creator").ToString) + SetCreateDate(Convert.ToDateTime(EditDataRow.Item("CreateDate"))) + SetReviser(gUserNo) + SetReviseDate(Now) + intDataStamp = EditDataRow.Item("DataStamp") + End If + + btnApplyEnabled = False + + '語系切換 + Call ExeChangeResource(Me, gLanguageMode) + ExeGroupControlPriv(Me, PrivFunNo) + + Cursor.Current = Cursors.Default + + End Sub + + Private Sub frmStuBasisDef_Activated(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Activated + If DefMode = 0 Or DefMode = 2 Then + txtStuBasisNo.Focus() + Else + txtStuBasisName.Focus() + End If + End Sub + + Protected Overrides Sub btnConfirm_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnConfirm.Click + Try + ' 调用funAddorEdit函数并将sender作为参数传递 + Dim result As Integer = funAddorEdit(sender) + + ' 根据需要处理结果 + If result = 0 Then + ' 函数成功执行 + Me.Close() + Else + ' 函数遇到错误或验证失败 + End If + Catch ex As Exception + ' 处理意外错误 + ExceptionManager.iMESShowDialog(defWinErrCode, ex.Message, ex.StackTrace) + End Try + + End Sub + + + Protected Overrides Sub btnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) + Me.Close() + End Sub + + Protected Overrides Sub btnApply_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) + + Cursor.Current = Cursors.WaitCursor + + If funAddorEdit(sender) < 0 Then Exit Sub + + If DefMode = 0 Or DefMode = 2 Then + txtStuBasisNo.Focus() + Else + txtStuBasisName.Focus() + + End If + + Cursor.Current = Cursors.Default + btnApplyEnabled = False + + End Sub + + Private Sub frmStuBasisDef_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing + ' 2016 YF, If Not wsENT Is Nothing Then wsENT.Dispose() + End Sub + +#Region "Control KeyPress" + + Private Sub txtStuBasisNo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtStuBasisNo.Click + txtStuBasisNo.SelectAll() + End Sub + + Private Sub txtStuBasisNo_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtStuBasisNo.Enter + txtStuBasisNo.SelectAll() + End Sub + + Private Sub txtStuBasisNo_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtStuBasisNo.KeyPress + If e.KeyChar = Convert.ToChar(13) Then + SendKeys.Send("{TAB}") + End If + End Sub + + Private Sub txtStuBasisNo_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtStuBasisNo.Leave + txtStuBasisNo.Text = UCase(txtStuBasisNo.Text) + End Sub + + Private Sub txtStuBasisNo_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtStuBasisNo.TextChanged + btnApplyEnabled = True + End Sub + + Private Sub txtStuBasisName_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtStuBasisName.Click + txtStuBasisName.SelectAll() + End Sub + + Private Sub txtStuBasisName_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtStuBasisName.Enter + txtStuBasisName.SelectAll() + End Sub + + Private Sub txtStuBasisName_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtStuBasisName.KeyPress + If e.KeyChar = Convert.ToChar(13) Then + SendKeys.Send("{TAB}") + End If + End Sub + + Private Sub txtStuBasisName_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtStuBasisName.TextChanged + btnApplyEnabled = True + End Sub + + Private Sub txtDescription_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtDescription.Click + txtDescription.SelectAll() + End Sub + + Private Sub txtDescription_Enter(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtDescription.Enter + txtDescription.SelectAll() + End Sub + + Private Sub txtDescription_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtDescription.TextChanged + btnApplyEnabled = True + End Sub + +#End Region + +#Region "Others" + + Private Function funAddorEdit(sender As Object) As Integer + + funAddorEdit = -1 + + '****************************************************************************** + '1.基本檢查 + '****************************************************************************** + If txtStuBasisNo.Text = "" Then + iMESExceptionManager.ExceptionManager.iMESMsgBoxShowDialog(ChgTranslateName_Msg("0000-200001", "[%StuBasisNo%]"), MsgBoxStyle.Exclamation, Me.Text) + txtStuBasisNo.Focus() + Exit Function + End If + + If txtStuBasisName.Text = "" Then + iMESExceptionManager.ExceptionManager.iMESMsgBoxShowDialog(ChgTranslateName_Msg("0000-200001", "[%StuBasisName%]"), MsgBoxStyle.Exclamation, Me.Text) + txtStuBasisName.Focus() + Exit Function + End If + + If Sex.Text = "" Then + iMESExceptionManager.ExceptionManager.iMESMsgBoxShowDialog(ChgTranslateName_Msg("0000-200001", "[%Sex%]"), MsgBoxStyle.Exclamation, Me.Text) + Sex.Focus() + Exit Function + End If + + '2. + '****************************************************************************** + '寫回資料庫 + '****************************************************************************** + Dim XmlDoc As New XmlDocument + + Try + strIdentity = CombineXMLIdentity(gComputerName, gUserNo, GetNow()) + strParameter = CombineXMLParameter("stubasisno", "StuBasisNo", "String", CInput(txtStuBasisNo.Text), "") + strParameter = strParameter & CombineXMLParameter("stubasisname", "StuBasisName", "String", CInput(txtStuBasisName.Text), "") + strParameter = strParameter & CombineXMLParameter("sex", "Sex", "String", CInput(Sex.Text), "") + strParameter = strParameter & CombineXMLParameter("description", "Description", "String", CInput(txtDescription.Text), "") + + If DefMode = 0 Or DefMode = 2 Then 'Add or Copy + strParameter = strParameter & CombineXMLParameter("creator", "Creator", "String", gUserNo, "") + strParameter = strParameter & CombineXMLParameter("createdate", "CreateDate", "DateTime", Format(Now, "yyyy/MM/dd HH:mm:ss"), "") + InXml = CombineXMLRequest(strIdentity, strParameter) + + ' 2016 YF, OutXml = ws_21685.AddStuBasis(InXml) + OutXml = InvokeSrv("SXS.ws_21685.AddStuBasis", InXml) + + Else + '修改 + strParameter = strParameter & CombineXMLParameter("issuestate", "IssueState", "String", EditDataRow.Item("IssueState").ToString, "") + ' 增加Datastamp + strParameter += CombineXMLParameter("datastamp", "Datastamp", "Integer", intDataStamp, "") + InXml = CombineXMLRequest(strIdentity, strParameter) + + ' 2016 YF, OutXml = wsENT.EditStuBasis(InXml) + OutXml = InvokeSrv("SXS.ws_21685.EditStuBasis", InXml) + + End If + + XmlDoc.LoadXml(OutXml) + If ChkExecutionSuccess(XmlDoc) Then + gReturnKeyValue = txtStuBasisNo.Text + + funAddorEdit = 0 + If sender.Equals(btnApply) Then + intDataStamp += 1 + End If + Else + ExceptionManager.iMESShowDialog(GetExceptionCode(XmlDoc), GetExceptionSysMsg(XmlDoc), GetExceptionStack(XmlDoc)) + End If + + Catch ex As Exception + 'MsgBox("Unexpected Error. Add or Edit ENT StuBasis Failed!," & e1.Message, MsgBoxStyle.Exclamation) + ExceptionManager.iMESShowDialog(defWinErrCode, ex.Message, ex.StackTrace) + End Try + + XmlDoc = Nothing + + End Function + + Private Sub lblStuBasisNo_Click(sender As Object, e As EventArgs) Handles lblStudentId.Click + + End Sub + + Private Sub lblDescription_Click(sender As Object, e As EventArgs) Handles lblDescription.Click + + End Sub + + Private Sub UltraTextEditor1_ValueChanged(sender As Object, e As EventArgs) Handles Sex.ValueChanged + + End Sub + + + + +#End Region + +End Class + diff --git a/SRC/MESWin/SYS1/ENT_21685/iMES.snk b/SRC/MESWin/SYS1/ENT_21685/iMES.snk new file mode 100644 index 0000000..4206cdc Binary files /dev/null and b/SRC/MESWin/SYS1/ENT_21685/iMES.snk differ diff --git a/SRC/MEStc_SXS/MEStc_SXS.csproj b/SRC/MEStc_SXS/MEStc_SXS.csproj index 0854ab1..6ef9b0f 100644 --- a/SRC/MEStc_SXS/MEStc_SXS.csproj +++ b/SRC/MEStc_SXS/MEStc_SXS.csproj @@ -13,7 +13,7 @@ MEStc_SXS 512 Windows - v4.6.2 + v4.7.2 SAK SAK SAK @@ -114,6 +114,7 @@ + diff --git a/SRC/MEStc_SXS/MEStc_SXS.csproj.user b/SRC/MEStc_SXS/MEStc_SXS.csproj.user new file mode 100644 index 0000000..6e4223f --- /dev/null +++ b/SRC/MEStc_SXS/MEStc_SXS.csproj.user @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/SRC/MEStc_SXS/Properties/BuildIncrementVersionInfo.cs b/SRC/MEStc_SXS/Properties/BuildIncrementVersionInfo.cs index 99be341..8c4e437 100644 --- a/SRC/MEStc_SXS/Properties/BuildIncrementVersionInfo.cs +++ b/SRC/MEStc_SXS/Properties/BuildIncrementVersionInfo.cs @@ -1 +1 @@ -[assembly: System.Reflection.AssemblyFileVersion("6.0.5.40115")] +[assembly: System.Reflection.AssemblyFileVersion("6.0.5.40117")] diff --git a/SRC/MEStc_SXS/tc_21685/clsENT_21685.cs b/SRC/MEStc_SXS/tc_21685/clsENT_21685.cs new file mode 100644 index 0000000..af7215c --- /dev/null +++ b/SRC/MEStc_SXS/tc_21685/clsENT_21685.cs @@ -0,0 +1,938 @@ +using iMESCore.Settings; +using Microsoft.VisualBasic; +using Microsoft.VisualBasic.CompilerServices; +using System; +using System.Collections.Generic; +using System.Data; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using static iMESCore.Base.iMESComSubroutine; +using static iMESCore.Base.iMESComXML; +using static iMESCore.Base.iMESConst; +using static iMESCore.DataBase.iMESSql; +namespace MEStc_SXS +{ + public class clsENT_21685 : IDisposable + { + /*不使用modXX,不再使用OleDb + * 資料庫相關(建立連線/讀取資料/異動資料),使用data_access_service.dll + * 設定檔相關,使用iMESAppSetting + * Xml相關,使用iMESComXML.dll + * 常數相關,使用iMESConst.dll + * 簡易副程式,使用iMESComSubroutine.dll + */ + + + private AppSettings objSetting = new AppSettings(); + private string strConnectionString; // Connection string + private string strDataBaseType; // DataBase Type:oracle, mysql, access + private string strMQType; // MessageQueue Type:TIBCO, MQSeries, MSMQ + private bool disposed = false; // To detect redundant calls + private string strSQL = ""; + private string strSQLAddField; + private string strSQLAddValue; + + #region --- Initial Object --- + + public clsENT_21685() + { + // Get database type + strDataBaseType = objSetting.GetDataBaseType(); + // Get connection string + strConnectionString = objSetting.GetConnectionString(strDataBaseType); + // Get Message Queue Type + strMQType = objSetting.GetMQType(); + } + + #endregion + + #region --- Property --- + + // //Property-------------------------------------------------------------------------------------------------------------------------------- + public string ConnectionString + { + get + { + return strConnectionString; + } + } + + public string DataBaseType + { + get + { + return strDataBaseType; + } + } + + public string MQType + { + get + { + return strMQType; + } + } + + // 2003/03/22,sammi. + // 因TC可能呼叫KC,在整個Function中,必須要使用同一個Reverse物件,如此在產生AddReverseUpdateContent的資料時,ReverseOrder才不會重覆. + // 若KC再往下呼叫UD,則必須將Reverse物件傳遞予UD. + //public object ReverseObj + //{ + // get + // { + // //return objReverse; + // // ReverseObj = objReverse + // } + //} + + + #endregion + + #region IDisposable Support + private bool disposedValue; // 偵測多餘的呼叫 + + // IDisposable + protected virtual void Dispose(bool disposing) + { + if (!disposedValue) + { + if (disposing) + { + // TODO: 處置 Managed 狀態 (Managed 物件)。 + } + + // TODO: 釋放 Unmanaged 資源 (Unmanaged 物件) 並覆寫下面的 Finalize()。 + // TODO: 將大型欄位設定為 null。 + } + disposedValue = true; + } + + // TODO: 只有當上面的 Dispose(ByVal disposing As Boolean) 有可釋放 Unmanaged 資源的程式碼時,才覆寫 Finalize()。 + // Protected Overrides Sub Finalize() + // ' 請勿變更此程式碼。在上面的 Dispose(ByVal disposing As Boolean) 中輸入清除程式碼。 + // Dispose(False) + // MyBase.Finalize() + // End Sub + + // 由 Visual Basic 新增此程式碼以正確實作可處置的模式。 + public void Dispose() + { + // 請勿變更此程式碼。在以上的 Dispose 置入清除程式碼 (ByVal 視為布林值處置)。 + Dispose(true); + GC.SuppressFinalize(this); + } + #endregion + + #region --- StuBasis 外包商 --- + + + public string AddStuBasis(string StuBasisNo, string StuBasisName, string Sex, string Description = defString, string Creator = defString, DateTime CreateDate = default(DateTime), string AdditionalXml = "") + { + string AddStuBasisRet = default(string); + // 此 Function 將新增一筆資料 + // 傳入值: 各欄位新增值 + // 傳回值: success(成功), fail(失敗) + + if (CreateDate == defDateTime) + CreateDate = DateTime.Now; + + try + { + strSQLAddField = "Insert into tblStuBasis_21685 (StuBasisNo, StuBasisName, Sex, IssueState"; + strSQLAddValue = " Values ('" + StuBasisNo + "','" + StuBasisName + "','" + Sex + "', 0"; + + if ((Description ?? "") != defString) + { + strSQLAddField += ",Description"; + strSQLAddValue += ",'" + Description + "'"; + } + if ((Creator ?? "") != defString) + { + strSQLAddField += ",Creator"; + strSQLAddValue += ",'" + Creator + "'"; + } + + if (CreateDate != defDateTime) + { + strSQLAddField += ",CreateDate"; + strSQLAddValue += ", To_Date('" + Strings.Format(Conversions.ToDate(CreateDate), "yyyy/MM/dd H:mm:ss") + "','YYYY/MM/DD HH24:MI:SS')"; + } + + if (string.IsNullOrEmpty(AdditionalXml)) + { + // 當沒有額外的欄位時,直接給定strSQL + strSQL = strSQLAddField + ")" + strSQLAddValue + ")"; + } + + else + { + // 加上additional的field & value 後傳回 + strSQL = SeparateAddXML_Add(ref strSQLAddField, ref strSQLAddValue, AdditionalXml); + + } + + // //執行SQL指令 + ExecuteSQLNoneQuery(Conversions.ToString(DataBaseType), strConnectionString, ref strSQL); + + // //Return success + AddStuBasisRet = "success"; + } + + catch (Exception e1) + { + AddStuBasisRet = "fail"; + // 發生錯誤時丟回本身的Function Name及系統錯誤訊息 + throw; + + } // New Exception("kcENT.AddStuBasis: " & e1.Message) + + return AddStuBasisRet; + + } + + public string EditStuBasis(string StuBasisNo, string StuBasisName = defString, string Sex = defString, string Description = defString, string AdditionalXml = "", int DataStamp = defInteger, string Reviser = defString, DateTime ReviseDate = default(DateTime)) + { + string EditStuBasisRet = default(string); + // 此 Function 將修改一筆資料 + // 傳入值: 各欄位修改值 + // 傳回值: success(成功), fail(失敗) + + try + { + // 先給定strSQL一定有的欄位 + strSQL = "Update tblStuBasis_21685 Set "; + + if ((StuBasisName ?? "") != defString) + { + strSQL += "StuBasisName = '" + StuBasisName + "',"; + } + if ((Description ?? "") != defString) + { + strSQL += "Description = '" + Description + "',"; + } + if ((Sex ?? "") != defString) + { + strSQL += "Sex = '" + Sex + "',"; + } + + if (Reviser != defString) + strSQL = strSQL + "Reviser = '" + Reviser + "',"; + + if (ReviseDate != defDateTime) + strSQL = strSQL + "ReviseDate = To_Date('" + Strings.Format(ReviseDate, "yyyy/MM/dd H:mm:ss") + "','YYYY/MM/DD HH24:MI:SS'),"; + + if (DataStamp != defInteger) + strSQL = strSQL + "DataStamp = DataStamp + 1 ,"; + + // 有額外的欄位時再Append進原來的strSQL中 + if (!string.IsNullOrEmpty(AdditionalXml)) + { + // 加上additional的field & value + strSQL += SeparateAddXML_Edit(AdditionalXml); + } + + // 去除strSQL中最後一個 "," + if (Strings.InStr(1, strSQL, ",") != 0) // 表示有要修改的欄位 + { + if (Strings.Right(strSQL, 1) == ",") + { + strSQL = Strings.Mid(strSQL, 1, Strings.Len(strSQL) - 1); + } + + strSQL += " Where StuBasisNo ='" + StuBasisNo + "'"; + strSQL = strSQL + " And DataStamp = '" + DataStamp + "'"; + + // 有額外的條件式時再Append進原來的strSQL中 + if (!string.IsNullOrEmpty(AdditionalXml)) + { + // 加上additional的condition + strSQL += SeparateAddXML_Condition(AdditionalXml); + } + + // 呼叫執行SQL指令 + ExecuteSQLNoneQuery(Conversions.ToString(DataBaseType), strConnectionString, ref strSQL, 1, true); + } + + // //Return success + EditStuBasisRet = "success"; + } + + catch (Exception e1) + { + EditStuBasisRet = "fail"; + // 發生錯誤時丟回本身的Function Name及系統錯誤訊息 + throw; + + } // New Exception("kcENT.EditStuBasis: " & e1.Message) + + return EditStuBasisRet; + + } + public string DelStuBasis(string StuBasisNo, string AdditionalXml = "") + { + string DelStuBasisRet = default(string); + // 此 Function 將刪除資料 + // 傳入值: 刪除的索引值 + // 傳回值: success(成功), fail(失敗) + var CollectionSQL = new Collection(); + + try + { + // 1. 刪除Contactor + // strSQL = "Delete From tblENTStuBasisCont " + "Where StuBasisNo='" + StuBasisNo + "'"; + // CollectionSQL.Add(strSQL); + + // 2. 刪除主檔 + strSQL = "Delete From tblStuBasis_21685 " + " Where StuBasisNo ='" + StuBasisNo + "'"; + + if (!string.IsNullOrEmpty(AdditionalXml)) + { + // 加上additional的condition + strSQL += SeparateAddXML_Condition(AdditionalXml); + } + + CollectionSQL.Add(strSQL); + + // 呼叫執行SQL指令 + ExecuteSQLNoneQuery_UPD(Conversions.ToString(DataBaseType), strConnectionString, CollectionSQL); + + // //Return success + DelStuBasisRet = "success"; + } + + catch (Exception e1) + { + DelStuBasisRet = "fail"; + // 發生錯誤時丟回本身的Function Name及系統錯誤訊息 + throw; + + } // New Exception("kcENT.DelStuBasis: " & e1.Message) + + return DelStuBasisRet; + + } + + public string LoadStuBasis(string StuBasisNo = defString, int IssueState = defInteger, string AdditionalXml = "") + { + string LoadStuBasisRet = default(string); + // 此 Function 將資料以XML方式取出 + // 傳入值: 索引值 + // 傳回值: XML(成功), fail(失敗) + + var dsENT = default(DataSet); + IDbConnection cnnTemp = null; + + try + { + // //Create connection + cnnTemp = CreateConnection(strConnectionString); + + strSQL = "Select * From tblStuBasis_21685 Where StuBasisNo Is Not Null"; + + if ((StuBasisNo ?? "") != defString) + { + strSQL += " And StuBasisNo = '" + StuBasisNo + "'"; + } + if (IssueState != defInteger) + { + strSQL += " And IssueState = " + IssueState; + } + + if (!string.IsNullOrEmpty(AdditionalXml)) + { + // 加上additional的condition + strSQL += SeparateAddXML_Condition(AdditionalXml); + } + + // //Select data + dsENT = new DataSet(); + ExecuteSQLQuery_Adapter(strSQL, dsENT, "tblStuBasis_21685", cnnTemp); + + // //Combine return value + LoadStuBasisRet = CombineXMLReturnValue("loadStuBasis", "tblStuBasis_21685", "DataSet", FormatXMLSchema(dsENT.GetXmlSchema()), dsENT.GetXml(), ""); + } + + catch (Exception e1) + { + LoadStuBasisRet = "fail"; + throw; + } // New Exception("kcENT.LoadStuBasis: " & e1.Message) + + finally + { + CloseConnection(cnnTemp); + if (dsENT != null) + { + dsENT.Dispose(); + } + + } + + return LoadStuBasisRet; + + } + + public DataSet ShowStuBasis(string StuBasisNo = defString, int IssueState = defInteger, string AdditionalXml = "") + { + DataSet ShowStuBasisRet = default(DataSet); + // 此 Function 將資料以 Dataset 方式取出 + // 傳入值: 索引值 + // 傳回值: Dataset(成功), Nothing(失敗) + + var dsENT = default(DataSet); + IDbConnection cnnTemp = null; + + try + { + // //Create connection + cnnTemp = CreateConnection(strConnectionString); + + strSQL = "Select * From tblENTStuBasis Where StuBasisNo Is Not Null"; + + if ((StuBasisNo ?? "") != defString) + { + strSQL += " And StuBasisNo = '" + StuBasisNo + "'"; + } + if (IssueState != defInteger) + { + strSQL += " And IssueState = " + IssueState; + } + + if (!string.IsNullOrEmpty(AdditionalXml)) + { + // 加上additional的condition + strSQL += SeparateAddXML_Condition(AdditionalXml); + } + + // //Select data + dsENT = new DataSet(); + ExecuteSQLQuery_Adapter(strSQL, dsENT, "tblENTStuBasis", cnnTemp); + + // //Return data + ShowStuBasisRet = dsENT; + } + + catch (Exception e1) + { + ShowStuBasisRet = null; + throw; + } // New Exception("kcENT.ShowStuBasis: " & e1.Message) + + finally + { + CloseConnection(cnnTemp); + if (dsENT != null) + { + dsENT.Dispose(); + } + + } + + return ShowStuBasisRet; + + } + + public DataRow GetStuBasis(string StuBasisNo = defString, int IssueState = defInteger, string AdditionalXml = "") + { + DataRow GetStuBasisRet = default(DataRow); + // 此 Function 將資料以 DataRow 方式取出 + // 傳入值: 索引值 + // 傳回值: DataRow(成功), Nothing(失敗) + + var dsENT = default(DataSet); + IDbConnection cnnTemp = null; + + try + { + // //Create connection + cnnTemp = CreateConnection(strConnectionString); + + strSQL = "Select * From tblENTStuBasis Where StuBasisNo Is Not Null"; + + if ((StuBasisNo ?? "") != defString) + { + strSQL += " And StuBasisNo = '" + StuBasisNo + "'"; + } + if (IssueState != defInteger) + { + strSQL += " And IssueState = " + IssueState; + } + + if (!string.IsNullOrEmpty(AdditionalXml)) + { + // 加上additional的condition + strSQL += SeparateAddXML_Condition(AdditionalXml); + } + + // //Select data + dsENT = new DataSet(); + ExecuteSQLQuery_Adapter(strSQL, dsENT, "tblENTStuBasis", cnnTemp); + + // //Return data + if (dsENT.Tables[0].Rows.Count > 0) + { + GetStuBasisRet = dsENT.Tables[0].Rows[0]; + } + else + { + GetStuBasisRet = dsENT.Tables[0].NewRow(); + } + } + catch (Exception e1) + { + GetStuBasisRet = null; + throw; + } // New Exception("kcENT.GetStuBasis: " & e1.Message) + + finally + { + CloseConnection(cnnTemp); + if (dsENT != null) + { + dsENT.Dispose(); + } + + } + + return GetStuBasisRet; + + } + public string SetStuBasisIssueState(string StuBasisNo, int IssueState, int DataStamp = defInteger, string Reviser = defString, DateTime ReviseDate = default(DateTime)) + { + string SetStuBasisIssueStateRet = default(string); + // 此 Function 將修改IssueState欄位的值 + // 傳入值: IssueState修改後的值及VendorNo + // 傳回值: success(成功), fail(失敗) + + try + { + // 先給定strSQL一定有的欄位 + strSQL = "Update tblENTStuBasis Set IssueState = " + IssueState + ","; + + if (Reviser != defString) + strSQL = strSQL + "Reviser = '" + Reviser + "',"; + + if (ReviseDate != defDateTime) + strSQL = strSQL + "ReviseDate = To_Date('" + Strings.Format(ReviseDate, "yyyy/MM/dd H:mm:ss") + "','YYYY/MM/DD HH24:MI:SS'),"; + + if (DataStamp != defInteger) + strSQL = strSQL + "DataStamp = DataStamp + 1 ,"; + + if (Strings.InStr(1, strSQL, ",") != 0) // 表示有要修改的欄位 + { + if (Strings.Right(strSQL, 1) == ",") + { + strSQL = Strings.Mid(strSQL, 1, Strings.Len(strSQL) - 1); + } + + strSQL = strSQL + " Where StuBasisNo ='" + StuBasisNo + "'"; + strSQL = strSQL + " And DataStamp = '" + DataStamp + "'"; + + // 呼叫執行SQL指令 + ExecuteSQLNoneQuery(Conversions.ToString(DataBaseType), strConnectionString, ref strSQL, 1, true); + } + + // //Return success + SetStuBasisIssueStateRet = "success"; + } + + catch (Exception e1) + { + SetStuBasisIssueStateRet = "fail"; + // 發生錯誤時丟回本身的Function Name及系統錯誤訊息 + throw; + + } // New Exception("kcENT.SetStuBasisIssueState: " & e1.Message) + + return SetStuBasisIssueStateRet; + + } + + + public string AddStuBasisCont(string StuBasisNo, string TeacherName,string Description = defString, string AdditionalXml = "", string Creator = defString, DateTime CreateDate = default(DateTime)) + { + string AddStuBasisContRet = default(string); + // 此 Function 將新增一筆資料 + // 傳入值: 各欄位新增值 + // 傳回值: success(成功), fail(失敗) + + try + { + strSQLAddField = "Insert into tblENTStuBasisCont (StuBasisNo, ContactorName"; + strSQLAddValue = " Values ('" + StuBasisNo + "','" + TeacherName + "'"; + + if ((Description ?? "") != defString) + { + strSQLAddField += ",Description"; + strSQLAddValue += ",'" + Description + "'"; + } + if (Creator != defString) + { + strSQLAddField = strSQLAddField + ",Creator"; + strSQLAddValue = strSQLAddValue + ",'" + Creator + "'"; + } + if (CreateDate != defDateTime) + { + strSQLAddField = strSQLAddField + ",CreateDate"; + strSQLAddValue = strSQLAddValue + ", To_Date('" + Strings.Format(CreateDate, "yyyy/MM/dd HH:mm:ss") + "','YYYY/MM/DD HH24:MI:SS')"; + } + + if (string.IsNullOrEmpty(AdditionalXml)) + { + // 當沒有額外的欄位時,直接給定strSQL + strSQL = strSQLAddField + ")" + strSQLAddValue + ")"; + } + + else + { + // 加上additional的field & value 後傳回 + strSQL = SeparateAddXML_Add(ref strSQLAddField, ref strSQLAddValue, AdditionalXml); + + } + + // //執行SQL指令 + ExecuteSQLNoneQuery(Conversions.ToString(DataBaseType), strConnectionString, ref strSQL); + + // //Return success + AddStuBasisContRet = "success"; + } + + catch (Exception e1) + { + AddStuBasisContRet = "fail"; + // 發生錯誤時丟回本身的Function Name及系統錯誤訊息 + throw; + + } // New Exception("kcENT.AddStuBasisCont: " & e1.Message) + + return AddStuBasisContRet; + + } + + + public string EditStuBasisCont(string StuBasisNo, string ContactorName, string TelNo = defString, string FaxNo = defString, string Title = defString, string Address = defString, string EMail = defString, string Description = defString, string AdditionalXml = "", int DataStamp = defInteger, string Reviser = defString, DateTime ReviseDate = default(DateTime)) + { + string EditStuBasisContRet = default(string); + + // 此 Function 將修改一筆資料 + // 傳入值: 各欄位修改值 + // 傳回值: success(成功), fail(失敗) + + try + { + // 先給定strSQL一定有的欄位 + strSQL = "Update tblENTStuBasisCont Set "; + + if ((TelNo ?? "") != defString) + { + strSQL += "TelNo = '" + TelNo + "',"; + } + if ((FaxNo ?? "") != defString) + { + strSQL += "FaxNo = '" + FaxNo + "',"; + } + if ((Title ?? "") != defString) + { + strSQL += "Title = '" + Title + "',"; + } + if ((Address ?? "") != defString) + { + strSQL += "Address = '" + Address + "',"; + } + if ((EMail ?? "") != defString) + { + strSQL += "EMail = '" + EMail + "',"; + } + if ((Description ?? "") != defString) + { + strSQL += "Description = '" + Description + "',"; + } + + if (Reviser != defString) + strSQL = strSQL + "Reviser = '" + Reviser + "',"; + + if (ReviseDate != defDateTime) + strSQL = strSQL + "ReviseDate = To_Date('" + Strings.Format(ReviseDate, "yyyy/MM/dd H:mm:ss") + "','YYYY/MM/DD HH24:MI:SS'),"; + + if (DataStamp != defInteger) + strSQL = strSQL + "DataStamp = DataStamp + 1 ,"; + + // 有額外的欄位時再Append進原來的strSQL中 + if (!string.IsNullOrEmpty(AdditionalXml)) + { + // 加上additional的field & value + strSQL += SeparateAddXML_Edit(AdditionalXml); + } + + // 去除strSQL中最後一個 "," + if (Strings.InStr(1, strSQL, ",") != 0) // 表示有要修改的欄位 + { + if (Strings.Right(strSQL, 1) == ",") + { + strSQL = Strings.Mid(strSQL, 1, Strings.Len(strSQL) - 1); + } + + strSQL += " Where StuBasisNo = '" + StuBasisNo + "'" + " And ContactorName ='" + ContactorName + "'"; + strSQL = strSQL + " And DataStamp = '" + DataStamp + "'"; + + // 有額外的條件式時再Append進原來的strSQL中 + if (!string.IsNullOrEmpty(AdditionalXml)) + { + // 加上additional的condition + strSQL += SeparateAddXML_Condition(AdditionalXml); + } + + // 呼叫執行SQL指令 + ExecuteSQLNoneQuery(Conversions.ToString(DataBaseType), strConnectionString, ref strSQL, 1, true); + } + + // //Return success + EditStuBasisContRet = "success"; + } + + catch (Exception e1) + { + EditStuBasisContRet = "fail"; + // 發生錯誤時丟回本身的Function Name及系統錯誤訊息 + throw; + + } // New Exception("kcENT.EditStuBasisCont: " & e1.Message) + + return EditStuBasisContRet; + + } + + public string DelStuBasisCont(string StuBasisNo, string ContactorName = defString, string AdditionalXml = "") + { + string DelStuBasisContRet = default(string); + // 此 Function 將刪除資料 + // 傳入值: 刪除的索引值 + // 傳回值: success(成功), fail(失敗) + + try + { + strSQL = "Delete From tblENTStuBasisCont " + " Where StuBasisNo='" + StuBasisNo + "'"; + + if ((ContactorName ?? "") != defString) + { + strSQL += " And ContactorName = '" + ContactorName + "'"; + } + + if (!string.IsNullOrEmpty(AdditionalXml)) + { + // 加上additional的condition + strSQL += SeparateAddXML_Condition(AdditionalXml); + } + + // 呼叫執行SQL指令 + ExecuteSQLNoneQuery(Conversions.ToString(DataBaseType), strConnectionString, ref strSQL); + + // //Return success + DelStuBasisContRet = "success"; + } + + catch (Exception e1) + { + DelStuBasisContRet = "fail"; + // 發生錯誤時丟回本身的Function Name及系統錯誤訊息 + throw; + + } // New Exception("kcENT.DelStuBasisCont: " & e1.Message) + + return DelStuBasisContRet; + + } + + public string LoadStuBasisCont(string StuBasisNo = defString, string TeacherName = defString, string AdditionalXml = "") + { + string LoadStuBasisContRet = default(string); + // 此 Function 將資料以XML方式取出 + // 傳入值: 索引值 + // 傳回值: XML(成功), fail(失敗) + + var dsENT = default(DataSet); + IDbConnection cnnTemp = null; + + try + { + // //Create connection + cnnTemp = CreateConnection(strConnectionString); + + strSQL = "Select * From tblTeaBasis_21685 Where StuBasisNo Is Not Null"; + + // 有傳入StuBasisNo表示只取該StuBasisNo之資料 + if ((StuBasisNo ?? "") != defString) + { + strSQL += " And StuBasisNo = '" + StuBasisNo + "'"; + } + if ((TeacherName ?? "") != defString) + { + strSQL += " And TeacherName = '" + TeacherName + "'"; + } + + if (!string.IsNullOrEmpty(AdditionalXml)) + { + // 加上additional的condition + strSQL += SeparateAddXML_Condition(AdditionalXml); + } + + // //Select data + dsENT = new DataSet(); + ExecuteSQLQuery_Adapter(strSQL, dsENT, "tblTeaBasis_21685", cnnTemp); + + // //Combine return value + LoadStuBasisContRet = CombineXMLReturnValue("loadStuBasiscont", "tblTeaBasis_21685", "DataSet", FormatXMLSchema(dsENT.GetXmlSchema()), dsENT.GetXml(), ""); + } + + catch (Exception e1) + { + LoadStuBasisContRet = "fail"; + throw; + } // New Exception("kcENT.LoadStuBasisCont: " & e1.Message) + + finally + { + CloseConnection(cnnTemp); + if (dsENT != null) + { + dsENT.Dispose(); + } + + } + + return LoadStuBasisContRet; + + } + + public DataSet ShowStuBasisCont(string StuBasisNo = defString, string ContactorName = defString, string AdditionalXml = "") + { + DataSet ShowStuBasisContRet = default(DataSet); + // 此 Function 將資料以 Dataset 方式取出 + // 傳入值: 索引值 + // 傳回值: Dataset(成功), Nothing(失敗) + + + var dsENT = default(DataSet); + IDbConnection cnnTemp = null; + + try + { + // //Create connection + cnnTemp = CreateConnection(strConnectionString); + + strSQL = "Select * From tblENTStuBasisCont Where StuBasisNo Is Not Null"; + if ((StuBasisNo ?? "") != defString) + { + strSQL += " And StuBasisNo = '" + StuBasisNo + "'"; + } + if ((ContactorName ?? "") != defString) + { + strSQL += " And ContactorName = '" + ContactorName + "'"; + } + + if (!string.IsNullOrEmpty(AdditionalXml)) + { + // 加上additional的condition + strSQL += SeparateAddXML_Condition(AdditionalXml); + } + + // //Select data + dsENT = new DataSet(); + ExecuteSQLQuery_Adapter(strSQL, dsENT, "tblENTStuBasisCont", cnnTemp); + + // //Return data + ShowStuBasisContRet = dsENT; + } + + catch (Exception e1) + { + ShowStuBasisContRet = null; + throw; + } // New Exception("kcENT.ShowStuBasisCont: " & e1.Message) + + finally + { + CloseConnection(cnnTemp); + if (dsENT != null) + { + dsENT.Dispose(); + } + + } + + return ShowStuBasisContRet; + + } + + public DataRow GetStuBasisCont(string StuBasisNo = defString, string ContactorName = defString, string AdditionalXml = "") + { + DataRow GetStuBasisContRet = default(DataRow); + // 此 Function 將資料以 DataRow 方式取出 + // 傳入值: 索引值 + // 傳回值: DataRow(成功), Nothing(失敗) + + + var dsENT = default(DataSet); + IDbConnection cnnTemp = null; + + try + { + // //Create connection + cnnTemp = CreateConnection(strConnectionString); + + strSQL = "Select * From tblENTStuBasisCont Where StuBasisNo Is Not Null"; + if ((StuBasisNo ?? "") != defString) + { + strSQL += " And StuBasisNo = '" + StuBasisNo + "'"; + } + if ((ContactorName ?? "") != defString) + { + strSQL += " And ContactorName = '" + ContactorName + "'"; + } + + if (!string.IsNullOrEmpty(AdditionalXml)) + { + // 加上additional的condition + strSQL += SeparateAddXML_Condition(AdditionalXml); + } + + // //Select data + dsENT = new DataSet(); + ExecuteSQLQuery_Adapter(strSQL, dsENT, "tblENTStuBasisCont", cnnTemp); + + // //Return data + if (dsENT.Tables[0].Rows.Count > 0) + { + GetStuBasisContRet = dsENT.Tables[0].Rows[0]; + } + else + { + GetStuBasisContRet = dsENT.Tables[0].NewRow(); + } + } + catch (Exception e1) + { + GetStuBasisContRet = null; + throw; + } // New Exception("kcENT.GetStuBasisCont: " & e1.Message) + + finally + { + CloseConnection(cnnTemp); + if (dsENT != null) + { + dsENT.Dispose(); + } + + } + + return GetStuBasisContRet; + + } + + + + #endregion + } +} diff --git a/SRC/wsSXS/Properties/BuildIncrementVersionInfo.cs b/SRC/wsSXS/Properties/BuildIncrementVersionInfo.cs index 99be341..8c4e437 100644 --- a/SRC/wsSXS/Properties/BuildIncrementVersionInfo.cs +++ b/SRC/wsSXS/Properties/BuildIncrementVersionInfo.cs @@ -1 +1 @@ -[assembly: System.Reflection.AssemblyFileVersion("6.0.5.40115")] +[assembly: System.Reflection.AssemblyFileVersion("6.0.5.40117")] diff --git a/SRC/wsSXS/wsSXS.csproj b/SRC/wsSXS/wsSXS.csproj index 1c0f518..a46a084 100644 --- a/SRC/wsSXS/wsSXS.csproj +++ b/SRC/wsSXS/wsSXS.csproj @@ -10,7 +10,7 @@ wsSXS 512 Windows - v4.6.2 + v4.7.2 SAK SAK @@ -147,6 +147,7 @@ + diff --git a/SRC/wsSXS/wxENT_21685/ws_21685.cs b/SRC/wsSXS/wxENT_21685/ws_21685.cs new file mode 100644 index 0000000..c2b12eb --- /dev/null +++ b/SRC/wsSXS/wxENT_21685/ws_21685.cs @@ -0,0 +1,1076 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System; +using System.Data; +using System.Web.Services; +using Microsoft.VisualBasic; +using Microsoft.VisualBasic.CompilerServices; +using static iMESCore.Base.iMESComXML; +using static iMESCore.Base.iMESConst; +using static iMESCore.Base.iMESComSubroutine; +namespace wsSXS +{ + public class ws_21685 + { + private MEStc_SXS .clsENT_21685 objENT = new MEStc_SXS.clsENT_21685(); + private kcSYS.clsSYSUserLog objSYS = new kcSYS.clsSYSUserLog(); // 宣告Sys的物件 + //private kcBasis_UPD.clsBasis_UPD objBasis = new kcBasis_UPD.clsBasis_UPD(); //主檔優化 + //private kcBasis_Query.clsBasis_Query objQuery = new kcBasis_Query.clsBasis_Query(); //主檔優化 + private System.Xml.XmlDocument xmlDoc = new System.Xml.XmlDocument(); // 用以讀取Xml字串 + private DateTime ArriveTime; // 送達時間 + private string strIdentity; // Identity XML字串 + private string strReturnValue; // ReturnValue XML字串 + private string strException; // Exception XML字串 + private string strResult; // Result XML字串 + private string strMessage; // Message XML字串 + private iMESCore.Settings.AppSettings objSetting = new iMESCore.Settings.AppSettings(); + private string strResourceDir = "Resources"; + + public ws_21685() + { + try + { + strResourceDir = System.IO.Path.Combine("wsUpdateResource", objSetting["ResourceDir"].ToString()); + } + catch (Exception) + { } + } + + #region --- tblStuBasis_21685 学生信息 --- + + [WebMethod(Description = "Load StuBasis Data")] + public string LoadStuBasis(string InXml) + { + string LoadStuBasisRet = default(string); + + // 先給預設值,以判斷是否有傳入該參數 + string StuBasisNo = defString; + int IssueState = 2; + + ArriveTime = DateTime.Now; + string AdditionalXml = ""; + try + { + // 讀取InXml字串 + xmlDoc.LoadXml(InXml); + // 組Identity字串 + strIdentity = CombineXMLIdentity(Environment.MachineName, GetXMLCurUserNo(xmlDoc), Conversions.ToString(ArriveTime)); + + // 判斷是否有傳入StuBasis,若有,表示要依StuBasis查詢 + if (xmlDoc.DocumentElement.GetElementsByTagName("StuBasisNo").Count > 0) + { + if (xmlDoc.GetElementsByTagName("StuBasisNo").Item(0).SelectNodes("value").Count > 0) + { + StuBasisNo = xmlDoc.DocumentElement.GetElementsByTagName("StuBasisNo").Item(0).SelectNodes("value").Item(0).InnerText; + } + } + // 判斷是否有傳入IssueState,若有,表示要依IssueState查詢 + if (xmlDoc.DocumentElement.GetElementsByTagName("issuestate").Count > 0) + { + if (xmlDoc.GetElementsByTagName("issuestate").Item(0).SelectNodes("value").Count > 0) + { + IssueState = Conversions.ToInteger(xmlDoc.DocumentElement.GetElementsByTagName("issuestate").Item(0).SelectNodes("value").Item(0).InnerText); + } + } + + // 呼叫副程式處理查詢條件與Additional格式 + AdditionalXml = CombineXMLQueryAdditional(xmlDoc); + + // 呼叫Dll執行 + strReturnValue = objENT.LoadStuBasis(StuBasisNo, IssueState, AdditionalXml); + strException = ""; + strResult = "success"; + } + + catch (iMESException.MESException ex) + { + strReturnValue = ""; + strException = CombineXMLException(Conversions.ToString(ex.ErrorCode), TranslateMsg(ex.Message, GetXMLLanguageMode(xmlDoc), strResourceDir), "Show StuBasis Failed!!", ex.StackTrace); + strResult = "fail"; + } + + catch (Exception ex) + { + strReturnValue = ""; + strException = CombineXMLException(defWSErrCode, ex.Message, "Show StuBasis Failed!!", ex.StackTrace); + strResult = "fail"; + } + + finally + { + // 將各部份之XML字串組起來並傳出 + LoadStuBasisRet = CombineXMLResponse(strIdentity, strReturnValue, strException, strResult, ""); + + } + + return LoadStuBasisRet; + + } + + [WebMethod(Description = "Add StuBasis data")] + public string AddStuBasis(string InXml) + { + string AddStuBasisRet = default(string); + + // 先給預設值,以判斷是否有傳入該參數 + var StuBasisNo = default(string); + string StuBasisName = defString; + string Sex = defString; + string Description = defString; + string Creator = defString; + + ArriveTime = DateTime.Now; + + try + { + // 讀取InXml字串 + xmlDoc.LoadXml(InXml); + + // 組Identity字串 + strIdentity = CombineXMLIdentity(Environment.MachineName, GetXMLCurUserNo(xmlDoc), Conversions.ToString(ArriveTime)); + + // 開始解譯InXml字串 + // StuBasis一定要傳入 + if (xmlDoc.DocumentElement.GetElementsByTagName("stubasisno").Count > 0) + { + if (xmlDoc.GetElementsByTagName("stubasisno").Item(0).SelectNodes("value").Count > 0) + { + StuBasisNo = xmlDoc.DocumentElement.GetElementsByTagName("stubasisno").Item(0).SelectNodes("value").Item(0).InnerText; + } + else + { + throw new iMESException.MESException("0000-200002", "StuBasisNo Not Found!"); + } + } + else + { + throw new iMESException.MESException("0000-200002", "StuBasisNo Not Found!"); + } + if (xmlDoc.DocumentElement.GetElementsByTagName("stubasisname").Count > 0) + { + if (xmlDoc.GetElementsByTagName("stubasisname").Item(0).SelectNodes("value").Count > 0) + { + StuBasisName = xmlDoc.DocumentElement.GetElementsByTagName("stubasisname").Item(0).SelectNodes("value").Item(0).InnerText; + } + else + { + throw new iMESException.MESException("0000-200002", "StuBasisName Not Found!"); + } + } + else + { + throw new iMESException.MESException("0000-200002", "StuBasisName Not Found!"); + } + // Sex + if (xmlDoc.DocumentElement.GetElementsByTagName("sex").Count > 0) + { + if (xmlDoc.GetElementsByTagName("sex").Item(0).SelectNodes("value").Count > 0) + { + Sex = xmlDoc.DocumentElement.GetElementsByTagName("sex").Item(0).SelectNodes("value").Item(0).InnerText; + } + else + { + throw new iMESException.MESException("0000-200002", "Sex Not Found!"); + } + } + else + { + throw new iMESException.MESException("0000-200002", "Sex Not Found!"); + } + // Description + if (xmlDoc.DocumentElement.GetElementsByTagName("description").Count > 0) + { + if (xmlDoc.GetElementsByTagName("description").Item(0).SelectNodes("value").Count > 0) + { + Description = xmlDoc.DocumentElement.GetElementsByTagName("description").Item(0).SelectNodes("value").Item(0).InnerText; + } + } + // Creator + if (xmlDoc.DocumentElement.GetElementsByTagName("creator").Count > 0) + { + if (xmlDoc.GetElementsByTagName("creator").Item(0).SelectNodes("value").Count > 0) + { + Creator = xmlDoc.DocumentElement.GetElementsByTagName("creator").Item(0).SelectNodes("value").Item(0).InnerText; + } + } + + // 呼叫Dll執行新增資料 + objENT.AddStuBasis(StuBasisNo, StuBasisName, Sex, Description, Creator); + + strException = ""; + strResult = "success"; + + objSYS.AddEventLog("wsENT", GetXMLCurUserNo(xmlDoc), "StuBasisNo", StuBasisNo, DateTime.Now, "AddStuBasis"); + } + + catch (iMESException.MESException ex) + { + strException = CombineXMLException(Conversions.ToString(ex.ErrorCode), TranslateMsg(ex.Message, GetXMLLanguageMode(xmlDoc), strResourceDir), "Add StuBasis failed!", ex.StackTrace); + + strResult = "fail"; + + objSYS.AddErrorLog_ErrorCode("wsENT", GetXMLCurUserNo(xmlDoc), "StuBasisNo", StuBasisNo, DateTime.Now, strException, ComputerName: GetXMLCurComputer(xmlDoc), ErrorCode: Conversions.ToString(ex.ErrorCode)); + } + + catch (Exception ex) + { + strException = CombineXMLException(defWSErrCode, ex.Message, "Add StuBasis failed!", ex.StackTrace); + + strResult = "fail"; + + objSYS.AddErrorLog_ErrorCode("wsENT", GetXMLCurUserNo(xmlDoc), "StuBasisNo", StuBasisNo, DateTime.Now, strException, ComputerName: GetXMLCurComputer(xmlDoc), ErrorCode: defWSErrCode); + } + + finally + { + // 將各部份之XML字串組起來並傳出 + AddStuBasisRet = CombineXMLResponse(strIdentity, "", strException, strResult, ""); + + } + + return AddStuBasisRet; + + } + + [WebMethod(Description = "Edit Specified StuBasis Data")] + public string EditStuBasis(string InXml) + { + string EditStuBasisRet = default(string); + + // 參數先給預設值,以判斷是否有傳入該參數 + var StuBasisNo = default(string); + int IssueState = defInteger; + string StuBasisName = defString; + string Description = defString; + string Sex = defString; + int DataStamp = defInteger; + string AdditionalXml = ""; + + ArriveTime = DateTime.Now; + + try + { + // 讀取InXml字串 + xmlDoc.LoadXml(InXml); + // 組Identity字串 + strIdentity = CombineXMLIdentity(Environment.MachineName, GetXMLCurUserNo(xmlDoc), Conversions.ToString(ArriveTime)); + + // 開始解譯InXml字串 + // StuBasis一定要傳入 + if (xmlDoc.DocumentElement.GetElementsByTagName("stubasisno").Count > 0) + { + if (xmlDoc.GetElementsByTagName("stubasisno").Item(0).SelectNodes("value").Count > 0) + { + StuBasisNo = xmlDoc.DocumentElement.GetElementsByTagName("stubasisno").Item(0).SelectNodes("value").Item(0).InnerText; + } + else + { + throw new iMESException.MESException("0000-200002", "StuBasisNo Not Found!"); + } + } + else + { + throw new iMESException.MESException("0000-200002", "StuBasisNo Not Found!"); + } + // IssueState一定要傳入 + if (xmlDoc.DocumentElement.GetElementsByTagName("issuestate").Count > 0) + { + if (xmlDoc.GetElementsByTagName("issuestate").Item(0).SelectNodes("value").Count > 0) + { + IssueState = Conversions.ToInteger(xmlDoc.DocumentElement.GetElementsByTagName("issuestate").Item(0).SelectNodes("value").Item(0).InnerText); + } + else + { + throw new iMESException.MESException("0000-200002", "[%IssueState%]"); + } + } + else + { + throw new iMESException.MESException("0000-200002", "[%IssueState%]"); + } + // StuBasisName不可空白 + if (xmlDoc.DocumentElement.GetElementsByTagName("stubasisname").Count > 0) + { + if (xmlDoc.GetElementsByTagName("stubasisname").Item(0).SelectNodes("value").Count > 0) + { + StuBasisName = xmlDoc.DocumentElement.GetElementsByTagName("stubasisname").Item(0).SelectNodes("value").Item(0).InnerText; + if (string.IsNullOrEmpty(StuBasisName)) + { + throw new iMESException.MESException("0000-200001", "StuBasisName is empty!"); + } + } + } + // Sex + if (xmlDoc.DocumentElement.GetElementsByTagName("sex").Count > 0) + { + if (xmlDoc.GetElementsByTagName("sex").Item(0).SelectNodes("value").Count > 0) + { + Sex = xmlDoc.DocumentElement.GetElementsByTagName("sex").Item(0).SelectNodes("value").Item(0).InnerText; + if (string.IsNullOrEmpty(StuBasisName)) + { + throw new iMESException.MESException("0000-200001", "Sex is empty!"); + } + } + } + // Description + if (xmlDoc.DocumentElement.GetElementsByTagName("description").Count > 0) + { + if (xmlDoc.GetElementsByTagName("description").Item(0).SelectNodes("value").Count > 0) + { + Description = xmlDoc.DocumentElement.GetElementsByTagName("description").Item(0).SelectNodes("value").Item(0).InnerText; + } + } + + // AdditionalXml + GetXMLTagValue(ref AdditionalXml, xmlDoc, "additionalxml"); + + // DataStamp + GetXMLTagValue(ref DataStamp, xmlDoc, "datastamp", true); + + if (IssueState == 0) // Unfrozen時才可修改 + { + // 有修改欄位值時 + if ((StuBasisName ?? "") != defString | (Description ?? "") != defString) + { + // 呼叫Dll執行修改 + objENT.EditStuBasis(StuBasisNo, StuBasisName,Sex, Description, AdditionalXml, DataStamp: DataStamp, Reviser: GetXMLCurUserNo(xmlDoc), ReviseDate: ArriveTime); + } + } + + strException = ""; + strResult = "success"; + + objSYS.AddEventLog("wsENT", GetXMLCurUserNo(xmlDoc), "StuBasisNo", StuBasisNo, DateTime.Now, "EditStuBasis"); + } + + catch (iMESException.MESException ex) + { + strException = CombineXMLException(Conversions.ToString(ex.ErrorCode), TranslateMsg(ex.Message, GetXMLLanguageMode(xmlDoc), strResourceDir), "Edit StuBasis failed!", ex.StackTrace); + + strResult = "fail"; + + objSYS.AddErrorLog_ErrorCode("wsENT", GetXMLCurUserNo(xmlDoc), "StuBasisNo", StuBasisNo, DateTime.Now, strException, ComputerName: GetXMLCurComputer(xmlDoc), ErrorCode: Conversions.ToString(ex.ErrorCode)); + } + + catch (Exception ex) + { + strException = CombineXMLException(defWSErrCode, ex.Message, "Edit StuBasis failed!", ex.StackTrace); + + strResult = "fail"; + + objSYS.AddErrorLog_ErrorCode("wsENT", GetXMLCurUserNo(xmlDoc), "StuBasisNo", StuBasisNo, DateTime.Now, strException, ComputerName: GetXMLCurComputer(xmlDoc), ErrorCode: defWSErrCode); + } + + finally + { + // 將各部份之XML字串組起來並傳出 + EditStuBasisRet = CombineXMLResponse(strIdentity, "", strException, strResult, ""); + } + + return EditStuBasisRet; + + } + + [WebMethod(Description = "Delete StuBasis By Specified StuBasis")] + public string DelStuBasis(string InXml) + { + string DelStuBasisRet = default(string); + + var StuBasisNo = default(string); + int IssueState; + string strDelState; // 寫入tblSysEventLog中的訊息,0:未簽核刪除,2:已簽核刪除,-1:不使用刪除 + int DataStamp = defInteger; + + ArriveTime = DateTime.Now; + + try + { + // 讀取InXml字串 + xmlDoc.LoadXml(InXml); + // 組Identity字串 + strIdentity = CombineXMLIdentity(Environment.MachineName, GetXMLCurUserNo(xmlDoc), Conversions.ToString(ArriveTime)); + + // 開始解譯InXml字串 + // StuBasis一定要傳入 + if (xmlDoc.DocumentElement.GetElementsByTagName("stubasisno").Count > 0) + { + if (xmlDoc.GetElementsByTagName("stubasisno").Item(0).SelectNodes("value").Count > 0) + { + StuBasisNo = xmlDoc.DocumentElement.GetElementsByTagName("stubasisno").Item(0).SelectNodes("value").Item(0).InnerText; + } + else + { + throw new iMESException.MESException("0000-200002", "StuBasisNo Not Found!"); + } + } + else + { + throw new iMESException.MESException("0000-200002", "StuBasisNo Not Found!"); + } + // IssueState一定要傳入 + if (xmlDoc.DocumentElement.GetElementsByTagName("issuestate").Count > 0) + { + if (xmlDoc.GetElementsByTagName("issuestate").Item(0).SelectNodes("value").Count > 0) + { + IssueState = Conversions.ToInteger(xmlDoc.DocumentElement.GetElementsByTagName("issuestate").Item(0).SelectNodes("value").Item(0).InnerText); + } + else + { + throw new iMESException.MESException("0000-200002", "[%IssueState%]"); + } + } + else + { + throw new iMESException.MESException("0000-200002", "[%IssueState%]"); + } + + // DataStamp + GetXMLTagValue(ref DataStamp, xmlDoc, "datastamp", true); + + switch (IssueState) + { + case 0: + { + objENT.DelStuBasis(StuBasisNo); + strDelState = "未簽核刪除"; + break; + } + case 2: + { + objENT.SetStuBasisIssueState(StuBasisNo, -1, DataStamp: DataStamp, Reviser: GetXMLCurUserNo(xmlDoc), ReviseDate: ArriveTime); + strDelState = "已簽核刪除"; + break; + } + case -1: + { + objENT.DelStuBasis(StuBasisNo); + strDelState = "不使用刪除"; + break; + } + + default: + { + throw new iMESException.MESException("0000-200021", "[%IssueState%]"); + } + } + + strException = ""; + strResult = "success"; + + objSYS.AddEventLog("wsENT", GetXMLCurUserNo(xmlDoc), "StuBasisNo", StuBasisNo, DateTime.Now, "DelStuBasis:" + strDelState); + } + + catch (iMESException.MESException ex) + { + strException = CombineXMLException(Conversions.ToString(ex.ErrorCode), TranslateMsg(ex.Message, GetXMLLanguageMode(xmlDoc), strResourceDir), "Delete StuBasis failed!", ex.StackTrace); + + strResult = "fail"; + + objSYS.AddErrorLog_ErrorCode("wsENT", GetXMLCurUserNo(xmlDoc), "StuBasisNo", StuBasisNo, DateTime.Now, strException, ComputerName: GetXMLCurComputer(xmlDoc), ErrorCode: Conversions.ToString(ex.ErrorCode)); + } + + catch (Exception ex) + { + strException = CombineXMLException(defWSErrCode, ex.Message, "Delete StuBasis failed!", ex.StackTrace); + + strResult = "fail"; + + objSYS.AddErrorLog_ErrorCode("wsENT", GetXMLCurUserNo(xmlDoc), "StuBasisNo", StuBasisNo, DateTime.Now, strException, ComputerName: GetXMLCurComputer(xmlDoc), ErrorCode: defWSErrCode); + } + + finally + { + DelStuBasisRet = CombineXMLResponse(strIdentity, "", strException, strResult, ""); + + } + + return DelStuBasisRet; + + } + + [WebMethod(Description = "Approve Specified StuBasis Data")] + public string ApproveStuBasis(string InXml) + { + string ApproveStuBasisRet = default(string); + + string IssueNo = "SUBCONTRACTOR BASIS"; // 簽核編號:SUBCONTRACTOR BASIS.若找不到,表示直接將狀態改為Active. + var StuBasisNo = default(string); + int IssueState; + var objIssue = new kcISSUE.clsIssue(); + DataRow IssueDR; + int DataStamp = defInteger; + + ArriveTime = DateTime.Now; + + try + { + // 讀取InXml字串 + xmlDoc.LoadXml(InXml); + // 組Identity字串 + strIdentity = CombineXMLIdentity(Environment.MachineName, GetXMLCurUserNo(xmlDoc), Conversions.ToString(ArriveTime)); + + // 開始解譯InXml字串 + // StuBasis一定要傳入 + if (xmlDoc.DocumentElement.GetElementsByTagName("subcontractorno").Count > 0) + { + if (xmlDoc.GetElementsByTagName("subcontractorno").Item(0).SelectNodes("value").Count > 0) + { + StuBasisNo = xmlDoc.DocumentElement.GetElementsByTagName("subcontractorno").Item(0).SelectNodes("value").Item(0).InnerText; + } + else + { + throw new iMESException.MESException("0000-200002", "StuBasisNo Not Found!"); + } + } + else + { + throw new iMESException.MESException("0000-200002", "StuBasisNo Not Found!"); + } + // IssueState一定要傳入 + if (xmlDoc.DocumentElement.GetElementsByTagName("issuestate").Count > 0) + { + if (xmlDoc.GetElementsByTagName("issuestate").Item(0).SelectNodes("value").Count > 0) + { + IssueState = Conversions.ToInteger(xmlDoc.DocumentElement.GetElementsByTagName("issuestate").Item(0).SelectNodes("value").Item(0).InnerText); + } + else + { + throw new iMESException.MESException("0000-200002", "[%IssueState%]"); + } + } + else + { + throw new iMESException.MESException("0000-200002", "[%IssueState%]"); + } + + // DataStamp + GetXMLTagValue(ref DataStamp, xmlDoc, "datastamp", true); + + if (IssueState == 0) // 當狀態為Unfrozen時才作 + { + // 去IssueManagement中找核准的方式 + IssueDR = objIssue.GetIssueJobMap(IssueNo); + + // 找不到表示bypass直接核准 + if (IssueDR["JobNo"] is DBNull) + { + // 直接核准 + objENT.SetStuBasisIssueState(StuBasisNo, 2, DataStamp: DataStamp, Reviser: GetXMLCurUserNo(xmlDoc), ReviseDate: ArriveTime); + objSYS.AddEventLog("wsENT", GetXMLCurUserNo(xmlDoc), "StuBasisNo", StuBasisNo, DateTime.Now, "ApproveStuBasis"); + } + + else + { + // 檢查JobNo是否有定義Detail檔,沒有Detail檔則直接核准 + DataRow tmpDR; + tmpDR = objIssue.GetIssueJobDetail(Conversions.ToString(IssueDR["JobNo"])); + if (tmpDR["JobNo"] is DBNull) + { + objENT.SetStuBasisIssueState(StuBasisNo, 2, DataStamp: DataStamp, Reviser: GetXMLCurUserNo(xmlDoc), ReviseDate: ArriveTime); + objSYS.AddEventLog("wsENT", GetXMLCurUserNo(xmlDoc), "StuBasisNo", StuBasisNo, DateTime.Now, "ApproveStuBasis"); + } + + else + { + // 將狀態改為Pending,且應以找到的JobNo來進入簽核 + // 填入簽核現況檔之Initial + var ApproveSQL = new Collection(); + var RejectSQL = new Collection(); + string tmpSQL; + string IssueSubject; + string IssueMasterNo; + + // 核准後應將狀態改為Active + tmpSQL = "Update tblENTStuBasis Set IssueState = 2 Where StuBasisNo = '" + StuBasisNo + "'"; + ApproveSQL.Add(tmpSQL); + // 退回則應將狀態回復到Unfrozen + tmpSQL = "Update tblENTStuBasis Set IssueState = 0 Where StuBasisNo = '" + StuBasisNo + "'"; + RejectSQL.Add(tmpSQL); + + // Creator未傳入表示以目前的User + string Creator; + if (xmlDoc.DocumentElement.GetElementsByTagName("creator").Count > 0) + { + if (xmlDoc.GetElementsByTagName("creator").Item(0).SelectNodes("value").Count > 0) + { + Creator = xmlDoc.DocumentElement.GetElementsByTagName("creator").Item(0).SelectNodes("value").Item(0).InnerText; + } + else + { + Creator = GetXMLCurUserNo(xmlDoc); + } + } + else + { + Creator = GetXMLCurUserNo(xmlDoc); + } + + IssueSubject = "StuBasisNo: " + StuBasisNo; + IssueMasterNo = objIssue.InitIssueMasterNo(); + // 此筆資料進入Issue流程 + objIssue.StartIssueProcess(IssueMasterNo, ApproveSQL, RejectSQL, IssueNo, IssueDR["JobNo"].ToString(), IssueSubject, Creator); + // 將狀態改為Pending + objENT.SetStuBasisIssueState(StuBasisNo, 1, DataStamp: DataStamp, Reviser: GetXMLCurUserNo(xmlDoc), ReviseDate: ArriveTime); + + objSYS.AddEventLog("wsENT", GetXMLCurUserNo(xmlDoc), "StuBasisNo", StuBasisNo, DateTime.Now, "ApproveStuBasis"); + + // 發Email給JobSerialNo=1之負責群組 + objIssue.SendEmailToFirstGroup(IssueMasterNo, IssueSubject); + } + } + } + strException = ""; + strResult = "success"; + } + + + catch (iMESException.MESException ex) + { + strException = CombineXMLException(Conversions.ToString(ex.ErrorCode), TranslateMsg(ex.Message, GetXMLLanguageMode(xmlDoc), strResourceDir), "Approve StuBasis failed!", ex.StackTrace); + + strResult = "fail"; + + objSYS.AddErrorLog_ErrorCode("wsENT", GetXMLCurUserNo(xmlDoc), "StuBasisNo", StuBasisNo, DateTime.Now, strException, ComputerName: GetXMLCurComputer(xmlDoc), ErrorCode: Conversions.ToString(ex.ErrorCode)); + } + + catch (Exception ex) + { + strException = CombineXMLException(defWSErrCode, ex.Message, "Approve StuBasis failed!", ex.StackTrace); + + strResult = "fail"; + + objSYS.AddErrorLog_ErrorCode("wsENT", GetXMLCurUserNo(xmlDoc), "StuBasisNo", StuBasisNo, DateTime.Now, strException, ComputerName: GetXMLCurComputer(xmlDoc), ErrorCode: defWSErrCode); + } + + finally + { + // 將各部份之XML字串組起來並傳出 + ApproveStuBasisRet = CombineXMLResponse(strIdentity, "", strException, strResult, ""); + } + + return ApproveStuBasisRet; + + } + + // StuBasis Contactor + [WebMethod(Description = "Load StuBasis Contactor Data")] + public string LoadStuBasisCont(string InXml) + { + string LoadStuBasisContRet = default(string); + + // 先給預設值,以判斷是否有傳入該參數 + string StuBasisNo = defString; + string TeacherName = defString; + + ArriveTime = DateTime.Now; + + try + { + // 讀取InXml字串 + xmlDoc.LoadXml(InXml); + // 組Identity字串 + strIdentity = CombineXMLIdentity(Environment.MachineName, GetXMLCurUserNo(xmlDoc), Conversions.ToString(ArriveTime)); + + // 判斷是否有傳入StuBasisNo,若有,表示要依StuBasisNo查詢 + if (xmlDoc.DocumentElement.GetElementsByTagName("stubasisno").Count > 0) + { + if (xmlDoc.GetElementsByTagName("stubasisno").Item(0).SelectNodes("value").Count > 0) + { + StuBasisNo = xmlDoc.DocumentElement.GetElementsByTagName("stubasisno").Item(0).SelectNodes("value").Item(0).InnerText; + } + } + if (xmlDoc.DocumentElement.GetElementsByTagName("teachername").Count > 0) + { + if (xmlDoc.GetElementsByTagName("teachername").Item(0).SelectNodes("value").Count > 0) + { + TeacherName = xmlDoc.DocumentElement.GetElementsByTagName("teachername").Item(0).SelectNodes("value").Item(0).InnerText; + } + } + + // 呼叫Dll執行 + strReturnValue = objENT.LoadStuBasisCont(StuBasisNo, TeacherName); + strException = ""; + strResult = "success"; + } + + catch (iMESException.MESException ex) + { + strReturnValue = ""; + strException = CombineXMLException(Conversions.ToString(ex.ErrorCode), TranslateMsg(ex.Message, GetXMLLanguageMode(xmlDoc), strResourceDir), "Show StuBasis Contactor Failed!!", ex.StackTrace); + strResult = "fail"; + } + + catch (Exception ex) + { + strReturnValue = ""; + strException = CombineXMLException(defWSErrCode, ex.Message, "Show StuBasis Contactor Failed!!", ex.StackTrace); + strResult = "fail"; + } + + finally + { + // 將各部份之XML字串組起來並傳出 + LoadStuBasisContRet = CombineXMLResponse(strIdentity, strReturnValue, strException, strResult, ""); + + } + + return LoadStuBasisContRet; + + } + + [WebMethod(Description = "Add StuBasis Contactor data")] + public string AddStuBasisCont(string InXml) + { + string AddStuBasisContRet = default(string); + // 先給預設值,以判斷是否有傳入該參數 + var StuBasisNo = default(string); + var TeacherName = default(string); + string TelNo = defString; + string Description = defString; + string AdditionalXml = ""; + + ArriveTime = DateTime.Now; + + try + { + // 讀取InXml字串 + xmlDoc.LoadXml(InXml); + + // 組Identity字串 + strIdentity = CombineXMLIdentity(Environment.MachineName, GetXMLCurUserNo(xmlDoc), Conversions.ToString(ArriveTime)); + + // 開始解譯InXml字串 + // StuBasisNo一定要傳入 + if (xmlDoc.DocumentElement.GetElementsByTagName("stubasisno").Count > 0) + { + if (xmlDoc.GetElementsByTagName("stubasisno").Item(0).SelectNodes("value").Count > 0) + { + StuBasisNo = xmlDoc.DocumentElement.GetElementsByTagName("stubasisno").Item(0).SelectNodes("value").Item(0).InnerText; + } + else + { + throw new iMESException.MESException("0000-200002", "StuBasisNo Not Found!"); + } + } + else + { + throw new iMESException.MESException("0000-200002", "StuBasisNo Not Found!"); + } + // ContactorName一定要傳入 + if (xmlDoc.DocumentElement.GetElementsByTagName("teachername").Count > 0) + { + if (xmlDoc.GetElementsByTagName("teachername").Item(0).SelectNodes("value").Count > 0) + { + TeacherName = xmlDoc.DocumentElement.GetElementsByTagName("teachername").Item(0).SelectNodes("value").Item(0).InnerText; + } + else + { + throw new iMESException.MESException("0000-200002", "TeacherName Not Found!"); + } + } + else + { + throw new iMESException.MESException("0000-200002", "ContactorName Not Found!"); + } + // TelNo + if (xmlDoc.DocumentElement.GetElementsByTagName("telno").Count > 0) + { + if (xmlDoc.GetElementsByTagName("telno").Item(0).SelectNodes("value").Count > 0) + { + TelNo = xmlDoc.DocumentElement.GetElementsByTagName("telno").Item(0).SelectNodes("value").Item(0).InnerText; + } + } + // Description + if (xmlDoc.DocumentElement.GetElementsByTagName("description").Count > 0) + { + if (xmlDoc.GetElementsByTagName("description").Item(0).SelectNodes("value").Count > 0) + { + Description = xmlDoc.DocumentElement.GetElementsByTagName("description").Item(0).SelectNodes("value").Item(0).InnerText; + } + } + // AdditionalXml + GetXMLTagValue(ref AdditionalXml, xmlDoc, "additionalxml"); + + + // 呼叫Dll執行新增資料 + objENT.AddStuBasisCont(StuBasisNo, TelNo, Description, AdditionalXml, GetXMLCurUserNo(xmlDoc), ArriveTime); + + strException = ""; + strResult = "success"; + + objSYS.AddEventLog("wsENT", GetXMLCurUserNo(xmlDoc), "StuBasisNo", StuBasisNo, DateTime.Now, "AddStuBasisContactor ContactorName:" + TeacherName); + } + + catch (iMESException.MESException ex) + { + strException = CombineXMLException(Conversions.ToString(ex.ErrorCode), TranslateMsg(ex.Message, GetXMLLanguageMode(xmlDoc), strResourceDir), "Add StuBasisContactor Data failed, ContactorName:" + TeacherName, ex.StackTrace); + + strResult = "fail"; + + objSYS.AddErrorLog_ErrorCode("wsENT", GetXMLCurUserNo(xmlDoc), "StuBasisNo", StuBasisNo, DateTime.Now, strException, ComputerName: GetXMLCurComputer(xmlDoc), ErrorCode: Conversions.ToString(ex.ErrorCode)); + } + + catch (Exception ex) + { + strException = CombineXMLException(defWSErrCode, ex.Message, "Add StuBasisContactor Data failed, ContactorName:" + TeacherName, ex.StackTrace); + + strResult = "fail"; + + objSYS.AddErrorLog_ErrorCode("wsENT", GetXMLCurUserNo(xmlDoc), "StuBasisNo", StuBasisNo, DateTime.Now, strException, ComputerName: GetXMLCurComputer(xmlDoc), ErrorCode: defWSErrCode); + } + + finally + { + // 將各部份之XML字串組起來並傳出 + AddStuBasisContRet = CombineXMLResponse(strIdentity, "", strException, strResult, ""); + + } + + return AddStuBasisContRet; + + } + + [WebMethod(Description = "Edit Specified StuBasis Contactor Data")] + public string EditStuBasisCont(string InXml) + { + string EditStuBasisContRet = default(string); + // 先給預設值,以判斷是否有傳入該參數 + var StuBasisNo = default(string); + var ContactorName = default(string); + string TelNo = defString; + string FaxNo = defString; + string Title = defString; + string Address = defString; + string EMail = defString; + string Description = defString; + + int DataStamp = defInteger; + string AdditionalXml = ""; + + ArriveTime = DateTime.Now; + + try + { + // 讀取InXml字串 + xmlDoc.LoadXml(InXml); + // 組Identity字串 + strIdentity = CombineXMLIdentity(Environment.MachineName, GetXMLCurUserNo(xmlDoc), Conversions.ToString(ArriveTime)); + + // 開始解譯InXml字串 + // StuBasisNo一定要傳入 + if (xmlDoc.DocumentElement.GetElementsByTagName("subcontractorno").Count > 0) + { + if (xmlDoc.GetElementsByTagName("subcontractorno").Item(0).SelectNodes("value").Count > 0) + { + StuBasisNo = xmlDoc.DocumentElement.GetElementsByTagName("subcontractorno").Item(0).SelectNodes("value").Item(0).InnerText; + } + else + { + throw new iMESException.MESException("0000-200002", "StuBasisNo Not Found!"); + } + } + else + { + throw new iMESException.MESException("0000-200002", "StuBasisNo Not Found!"); + } + // ContactorName一定要傳入 + if (xmlDoc.DocumentElement.GetElementsByTagName("contactorname").Count > 0) + { + if (xmlDoc.GetElementsByTagName("contactorname").Item(0).SelectNodes("value").Count > 0) + { + ContactorName = xmlDoc.DocumentElement.GetElementsByTagName("contactorname").Item(0).SelectNodes("value").Item(0).InnerText; + } + else + { + throw new iMESException.MESException("0000-200002", "ContactorName Not Found!"); + } + } + else + { + throw new iMESException.MESException("0000-200002", "ContactorName Not Found!"); + } + // TelNo + if (xmlDoc.DocumentElement.GetElementsByTagName("telno").Count > 0) + { + if (xmlDoc.GetElementsByTagName("telno").Item(0).SelectNodes("value").Count > 0) + { + TelNo = xmlDoc.DocumentElement.GetElementsByTagName("telno").Item(0).SelectNodes("value").Item(0).InnerText; + } + } + // FaxNo + if (xmlDoc.DocumentElement.GetElementsByTagName("faxno").Count > 0) + { + if (xmlDoc.GetElementsByTagName("faxno").Item(0).SelectNodes("value").Count > 0) + { + FaxNo = xmlDoc.DocumentElement.GetElementsByTagName("faxno").Item(0).SelectNodes("value").Item(0).InnerText; + } + } + // Title + if (xmlDoc.DocumentElement.GetElementsByTagName("title").Count > 0) + { + if (xmlDoc.GetElementsByTagName("title").Item(0).SelectNodes("value").Count > 0) + { + Title = xmlDoc.DocumentElement.GetElementsByTagName("title").Item(0).SelectNodes("value").Item(0).InnerText; + } + } + // Address + if (xmlDoc.DocumentElement.GetElementsByTagName("address").Count > 0) + { + if (xmlDoc.GetElementsByTagName("address").Item(0).SelectNodes("value").Count > 0) + { + Address = xmlDoc.DocumentElement.GetElementsByTagName("address").Item(0).SelectNodes("value").Item(0).InnerText; + } + } + // EMail + if (xmlDoc.DocumentElement.GetElementsByTagName("email").Count > 0) + { + if (xmlDoc.GetElementsByTagName("email").Item(0).SelectNodes("value").Count > 0) + { + EMail = xmlDoc.DocumentElement.GetElementsByTagName("email").Item(0).SelectNodes("value").Item(0).InnerText; + } + } + // Description + if (xmlDoc.DocumentElement.GetElementsByTagName("description").Count > 0) + { + if (xmlDoc.GetElementsByTagName("description").Item(0).SelectNodes("value").Count > 0) + { + Description = xmlDoc.DocumentElement.GetElementsByTagName("description").Item(0).SelectNodes("value").Item(0).InnerText; + } + } + + // AdditionalXml + GetXMLTagValue(ref AdditionalXml, xmlDoc, "additionalxml"); + + // DataStamp + GetXMLTagValue(ref DataStamp, xmlDoc, "datastamp", true); + + // If IssueState = 0 Then 'Unfrozen時才可修改 + // 有修改欄位值時 + if ((TelNo ?? "") != defString | (FaxNo ?? "") != defString | (Title ?? "") != defString | (Address ?? "") != defString | (EMail ?? "") != defString | (Description ?? "") != defString) + { + // 呼叫Dll執行修改 + objENT.EditStuBasisCont(StuBasisNo, ContactorName, TelNo, FaxNo, Title, Address, EMail, Description, AdditionalXml, DataStamp: DataStamp, Reviser: GetXMLCurUserNo(xmlDoc), ReviseDate: ArriveTime); + } + // End If + + strException = ""; + strResult = "success"; + + objSYS.AddEventLog("wsENT", GetXMLCurUserNo(xmlDoc), "StuBasisNo", StuBasisNo, DateTime.Now, "EditStuBasisContactor ContactorName:" + ContactorName); + } + + catch (iMESException.MESException ex) + { + strException = CombineXMLException(Conversions.ToString(ex.ErrorCode), TranslateMsg(ex.Message, GetXMLLanguageMode(xmlDoc), strResourceDir), "Edit StuBasisContactor Data failed, ContactorName:" + ContactorName, ex.StackTrace); + + strResult = "fail"; + + objSYS.AddErrorLog_ErrorCode("wsENT", GetXMLCurUserNo(xmlDoc), "StuBasisNo", StuBasisNo, DateTime.Now, strException, ComputerName: GetXMLCurComputer(xmlDoc), ErrorCode: Conversions.ToString(ex.ErrorCode)); + } + + catch (Exception ex) + { + strException = CombineXMLException(defWSErrCode, ex.Message, "Edit StuBasisContactor Data failed, ContactorName:" + ContactorName, ex.StackTrace); + + strResult = "fail"; + + objSYS.AddErrorLog_ErrorCode("wsENT", GetXMLCurUserNo(xmlDoc), "StuBasisNo", StuBasisNo, DateTime.Now, strException, ComputerName: GetXMLCurComputer(xmlDoc), ErrorCode: defWSErrCode); + } + + finally + { + // 將各部份之XML字串組起來並傳出 + EditStuBasisContRet = CombineXMLResponse(strIdentity, "", strException, strResult, ""); + + } + + return EditStuBasisContRet; + + } + + [WebMethod(Description = "Delete StuBasis Contactor By Specified StuBasisNo and ContactorName")] + public string DelStuBasisCont(string InXml) + { + string DelStuBasisContRet = default(string); + + var StuBasisNo = default(string); + string ContactorName = defString; // 沒有傳入表示要刪除指定StuBasis的所有Contactor + + ArriveTime = DateTime.Now; + + try + { + // 讀取InXml字串 + xmlDoc.LoadXml(InXml); + // 組Identity字串 + strIdentity = CombineXMLIdentity(Environment.MachineName, GetXMLCurUserNo(xmlDoc), Conversions.ToString(ArriveTime)); + + // 開始解譯InXml字串 + // StuBasisNo一定要傳入 + if (xmlDoc.DocumentElement.GetElementsByTagName("subcontractorno").Count > 0) + { + if (xmlDoc.GetElementsByTagName("subcontractorno").Item(0).SelectNodes("value").Count > 0) + { + StuBasisNo = xmlDoc.DocumentElement.GetElementsByTagName("subcontractorno").Item(0).SelectNodes("value").Item(0).InnerText; + } + else + { + throw new iMESException.MESException("0000-200002", "StuBasisNo Not Found!"); + } + } + else + { + throw new iMESException.MESException("0000-200002", "StuBasisNo Not Found!"); + } + // ContactorName一定要傳入 + if (xmlDoc.DocumentElement.GetElementsByTagName("contactorname").Count > 0) + { + if (xmlDoc.GetElementsByTagName("contactorname").Item(0).SelectNodes("value").Count > 0) + { + ContactorName = xmlDoc.DocumentElement.GetElementsByTagName("contactorname").Item(0).SelectNodes("value").Item(0).InnerText; + } + } + + objENT.DelStuBasisCont(StuBasisNo, ContactorName); + + strException = ""; + strResult = "success"; + + objSYS.AddEventLog("wsENT", GetXMLCurUserNo(xmlDoc), "StuBasisNo", StuBasisNo, DateTime.Now, "DelStuBasisContactor ContactorName:" + ContactorName); + } + + catch (iMESException.MESException ex) + { + strException = CombineXMLException(Conversions.ToString(ex.ErrorCode), TranslateMsg(ex.Message, GetXMLLanguageMode(xmlDoc), strResourceDir), "Del StuBasisContactor Data failed, ContactorName:" + ContactorName, ex.StackTrace); + + strResult = "fail"; + + objSYS.AddErrorLog_ErrorCode("wsENT", GetXMLCurUserNo(xmlDoc), "StuBasisNo", StuBasisNo, DateTime.Now, strException, ComputerName: GetXMLCurComputer(xmlDoc), ErrorCode: Conversions.ToString(ex.ErrorCode)); + } + + catch (Exception ex) + { + strException = CombineXMLException(defWSErrCode, ex.Message, "Del StuBasisContactor Data failed, ContactorName:" + ContactorName, ex.StackTrace); + + strResult = "fail"; + + objSYS.AddErrorLog_ErrorCode("wsENT", GetXMLCurUserNo(xmlDoc), "StuBasisNo", StuBasisNo, DateTime.Now, strException, ComputerName: GetXMLCurComputer(xmlDoc), ErrorCode: defWSErrCode); + } + + finally + { + DelStuBasisContRet = CombineXMLResponse(strIdentity, "", strException, strResult, ""); + + } + + return DelStuBasisContRet; + + } + + + #endregion + } +}