Imports iMESExceptionManager Public Class frmStudentContDef Inherits COM_Kit.frmDefTemplat '//Public Variables Public EditDataRow As DataRow Public DefMode As Integer = 0 '0. ADD, 1.Edit, 2. Copy Public StudentNo 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 Friend WithEvents lblAddress As System.Windows.Forms.Label Friend WithEvents lblEMail As System.Windows.Forms.Label Friend WithEvents lblTitle As System.Windows.Forms.Label Friend WithEvents lblFaxNo As System.Windows.Forms.Label Friend WithEvents lblTelNo As System.Windows.Forms.Label Friend WithEvents lblParentName As System.Windows.Forms.Label Friend WithEvents lblStudentNo As System.Windows.Forms.Label Friend WithEvents gbxStudentContData As System.Windows.Forms.GroupBox Friend WithEvents txtStudentNo As Infragistics.Win.UltraWinEditors.UltraTextEditor Friend WithEvents txtParentName As Infragistics.Win.UltraWinEditors.UltraTextEditor Friend WithEvents txtFaxNo As Infragistics.Win.UltraWinEditors.UltraTextEditor Friend WithEvents txtTelNo As Infragistics.Win.UltraWinEditors.UltraTextEditor Friend WithEvents txtEMail As Infragistics.Win.UltraWinEditors.UltraTextEditor Friend WithEvents txtTitle As Infragistics.Win.UltraWinEditors.UltraTextEditor Friend WithEvents txtAddress As Infragistics.Win.UltraWinEditors.UltraTextEditor Private Sub InitializeComponent() Dim Appearance1 As Infragistics.Win.Appearance = New Infragistics.Win.Appearance() Me.gbxStudentContData = New System.Windows.Forms.GroupBox() Me.txtAddress = New Infragistics.Win.UltraWinEditors.UltraTextEditor() Me.txtEMail = New Infragistics.Win.UltraWinEditors.UltraTextEditor() Me.txtTitle = New Infragistics.Win.UltraWinEditors.UltraTextEditor() Me.txtFaxNo = New Infragistics.Win.UltraWinEditors.UltraTextEditor() Me.lblAddress = New System.Windows.Forms.Label() Me.lblEMail = New System.Windows.Forms.Label() Me.lblTitle = New System.Windows.Forms.Label() Me.lblFaxNo = New System.Windows.Forms.Label() Me.lblTelNo = New System.Windows.Forms.Label() Me.lblStudentNo = New System.Windows.Forms.Label() Me.lblParentName = New System.Windows.Forms.Label() Me.txtStudentNo = New Infragistics.Win.UltraWinEditors.UltraTextEditor() Me.txtParentName = New Infragistics.Win.UltraWinEditors.UltraTextEditor() Me.txtTelNo = New Infragistics.Win.UltraWinEditors.UltraTextEditor() CType(Me.gbxBasisData, System.ComponentModel.ISupportInitialize).BeginInit() Me.gbxStudentContData.SuspendLayout() CType(Me.txtAddress, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.txtEMail, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.txtTitle, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.txtFaxNo, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.txtStudentNo, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.txtParentName, 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) ' 'gbxStudentContData ' Me.gbxStudentContData.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.gbxStudentContData.Controls.Add(Me.txtAddress) Me.gbxStudentContData.Controls.Add(Me.txtEMail) Me.gbxStudentContData.Controls.Add(Me.txtTitle) Me.gbxStudentContData.Controls.Add(Me.txtFaxNo) Me.gbxStudentContData.Controls.Add(Me.lblAddress) Me.gbxStudentContData.Controls.Add(Me.lblEMail) Me.gbxStudentContData.Controls.Add(Me.lblTitle) Me.gbxStudentContData.Controls.Add(Me.lblFaxNo) Me.gbxStudentContData.Controls.Add(Me.lblTelNo) Me.gbxStudentContData.Controls.Add(Me.lblStudentNo) Me.gbxStudentContData.Controls.Add(Me.lblParentName) Me.gbxStudentContData.Controls.Add(Me.txtStudentNo) Me.gbxStudentContData.Controls.Add(Me.txtParentName) Me.gbxStudentContData.Controls.Add(Me.txtTelNo) Me.gbxStudentContData.Font = New System.Drawing.Font("Times New Roman", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.gbxStudentContData.Location = New System.Drawing.Point(15, 8) Me.gbxStudentContData.Name = "gbxStudentContData" Me.gbxStudentContData.Size = New System.Drawing.Size(469, 306) Me.gbxStudentContData.TabIndex = 0 Me.gbxStudentContData.TabStop = False Me.gbxStudentContData.Text = "ENT Student Data" ' 'txtAddress ' Me.txtAddress.Location = New System.Drawing.Point(120, 152) Me.txtAddress.Name = "txtAddress" Me.txtAddress.Size = New System.Drawing.Size(336, 22) Me.txtAddress.TabIndex = 13 ' 'txtEMail ' Me.txtEMail.Location = New System.Drawing.Point(320, 120) Me.txtEMail.Name = "txtEMail" Me.txtEMail.Size = New System.Drawing.Size(136, 22) Me.txtEMail.TabIndex = 11 ' 'txtTitle ' Me.txtTitle.Location = New System.Drawing.Point(120, 120) Me.txtTitle.Name = "txtTitle" Me.txtTitle.Size = New System.Drawing.Size(114, 22) Me.txtTitle.TabIndex = 9 ' 'txtFaxNo ' Me.txtFaxNo.Location = New System.Drawing.Point(320, 88) Me.txtFaxNo.Name = "txtFaxNo" Me.txtFaxNo.Size = New System.Drawing.Size(136, 22) Me.txtFaxNo.TabIndex = 7 ' 'lblAddress ' Me.lblAddress.Font = New System.Drawing.Font("Times New Roman", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.lblAddress.Location = New System.Drawing.Point(24, 154) Me.lblAddress.Name = "lblAddress" Me.lblAddress.Size = New System.Drawing.Size(86, 14) Me.lblAddress.TabIndex = 12 Me.lblAddress.Text = "Address" Me.lblAddress.TextAlign = System.Drawing.ContentAlignment.TopRight ' 'lblEMail ' Me.lblEMail.Font = New System.Drawing.Font("Times New Roman", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.lblEMail.Location = New System.Drawing.Point(248, 123) Me.lblEMail.Name = "lblEMail" Me.lblEMail.Size = New System.Drawing.Size(64, 14) Me.lblEMail.TabIndex = 10 Me.lblEMail.Text = "EMail" Me.lblEMail.TextAlign = System.Drawing.ContentAlignment.TopRight ' 'lblTitle ' Me.lblTitle.Font = New System.Drawing.Font("Times New Roman", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.lblTitle.Location = New System.Drawing.Point(24, 121) Me.lblTitle.Name = "lblTitle" Me.lblTitle.Size = New System.Drawing.Size(86, 14) Me.lblTitle.TabIndex = 8 Me.lblTitle.Text = "Title" Me.lblTitle.TextAlign = System.Drawing.ContentAlignment.TopRight ' 'lblFaxNo ' Me.lblFaxNo.Font = New System.Drawing.Font("Times New Roman", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.lblFaxNo.Location = New System.Drawing.Point(248, 90) Me.lblFaxNo.Name = "lblFaxNo" Me.lblFaxNo.Size = New System.Drawing.Size(64, 14) Me.lblFaxNo.TabIndex = 6 Me.lblFaxNo.Text = "FaxNo" Me.lblFaxNo.TextAlign = System.Drawing.ContentAlignment.TopRight ' '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 ' 'lblStudentNo ' Me.lblStudentNo.Font = New System.Drawing.Font("Times New Roman", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.lblStudentNo.Location = New System.Drawing.Point(14, 29) Me.lblStudentNo.Name = "lblStudentNo" Me.lblStudentNo.Size = New System.Drawing.Size(96, 14) Me.lblStudentNo.TabIndex = 0 Me.lblStudentNo.Text = "Student No" Me.lblStudentNo.TextAlign = System.Drawing.ContentAlignment.TopRight ' 'lblParentName ' Me.lblParentName.Font = New System.Drawing.Font("Times New Roman", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.lblParentName.Location = New System.Drawing.Point(24, 59) Me.lblParentName.Name = "lblParentName" Me.lblParentName.Size = New System.Drawing.Size(86, 14) Me.lblParentName.TabIndex = 2 Me.lblParentName.Text = "Parent Name" Me.lblParentName.TextAlign = System.Drawing.ContentAlignment.TopRight ' 'txtStudentNo ' Me.txtStudentNo.Location = New System.Drawing.Point(120, 24) Me.txtStudentNo.Name = "txtStudentNo" Me.txtStudentNo.ReadOnly = True Me.txtStudentNo.Size = New System.Drawing.Size(114, 22) Me.txtStudentNo.TabIndex = 1 Me.txtStudentNo.TabStop = False ' 'txtParentName ' Appearance1.BackColor = System.Drawing.Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(192, Byte), Integer)) Me.txtParentName.Appearance = Appearance1 Me.txtParentName.BackColor = System.Drawing.Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(192, Byte), Integer)) Me.txtParentName.Location = New System.Drawing.Point(120, 56) Me.txtParentName.Name = "txtParentName" Me.txtParentName.Size = New System.Drawing.Size(160, 22) Me.txtParentName.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 ' 'frmStudentContDef ' Me.ClientSize = New System.Drawing.Size(496, 446) Me.Controls.Add(Me.gbxStudentContData) Me.Font = New System.Drawing.Font("Times New Roman", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.Name = "frmStudentContDef" 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.gbxStudentContData, 0) CType(Me.gbxBasisData, System.ComponentModel.ISupportInitialize).EndInit() Me.gbxStudentContData.ResumeLayout(False) Me.gbxStudentContData.PerformLayout() CType(Me.txtAddress, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.txtEMail, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.txtTitle, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.txtFaxNo, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.txtStudentNo, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.txtParentName, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.txtTelNo, System.ComponentModel.ISupportInitialize).EndInit() Me.ResumeLayout(False) End Sub #End Region Private Sub frmStudentContDef_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 txtStudentNo.Text = EditDataRow.Item("StudentNo").ToString txtParentName.Text = EditDataRow.Item("ParentName").ToString txtTelNo.Text = EditDataRow.Item("TelNo").ToString txtFaxNo.Text = EditDataRow.Item("FaxNo").ToString txtTitle.Text = EditDataRow.Item("Title").ToString txtAddress.Text = EditDataRow.Item("Address").ToString txtEMail.Text = EditDataRow.Item("EMail").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 txtStudentNo.Text = StudentNo SetCreateDate(Now) SetCreator(gUserNo) ElseIf DefMode = 1 Then 'Edit txtParentName.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 frmStudentContDef_Activated(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Activated If DefMode = 0 Or DefMode = 2 Then txtParentName.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 txtParentName.Focus() Else txtTelNo.Focus() End If txtEMail.Text = "" btnApplyEnabled = False Cursor.Current = Cursors.Default End Sub #Region "Control KeyPress" Private Sub txtStudentNo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtStudentNo.Click txtStudentNo.SelectAll() End Sub Private Sub txtStudentNo_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtStudentNo.Enter txtStudentNo.SelectAll() End Sub Private Sub txtStudentNo_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtStudentNo.KeyPress If e.KeyChar = Convert.ToChar(13) Then SendKeys.Send("{TAB}") End If End Sub Private Sub txtStudentNo_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtStudentNo.TextChanged btnApplyEnabled = True End Sub Private Sub txtParentName_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtParentName.Click txtParentName.SelectAll() End Sub Private Sub txtParentName_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtParentName.Enter txtParentName.SelectAll() End Sub Private Sub txtParentName_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtParentName.KeyPress If e.KeyChar = Convert.ToChar(13) Then SendKeys.Send("{TAB}") End If End Sub Private Sub txtParentName_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtParentName.Leave If txtParentName.Text <> "" And txtEMail.Text = "" Then txtEMail.Text = txtParentName.Text & "@" End If txtParentName.Text = UCase(txtParentName.Text) End Sub Private Sub txtParentName_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtParentName.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_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtFaxNo.Click txtFaxNo.SelectAll() End Sub Private Sub txtFaxNo_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtFaxNo.Enter txtFaxNo.SelectAll() End Sub Private Sub txtFaxNo_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtFaxNo.KeyPress 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) Handles txtFaxNo.TextChanged btnApplyEnabled = True End Sub Private Sub txtTitle_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtTitle.Click txtTitle.SelectAll() End Sub Private Sub txtTitle_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtTitle.Enter txtTitle.SelectAll() End Sub Private Sub txtTitle_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtTitle.KeyPress 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) Handles txtTitle.TextChanged btnApplyEnabled = True End Sub Private Sub txtEMail_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtEMail.Click txtEMail.SelectAll() End Sub Private Sub txtEMail_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtEMail.Enter txtEMail.SelectAll() End Sub Private Sub txtEMail_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtEMail.KeyPress If e.KeyChar = Convert.ToChar(13) Then SendKeys.Send("{TAB}") End If End Sub Private Sub txtEMail_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtEMail.TextChanged btnApplyEnabled = True End Sub Private Sub txtAddress_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtAddress.Click txtAddress.SelectAll() End Sub Private Sub txtAddress_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtAddress.Enter txtAddress.SelectAll() End Sub Private Sub txtAddress_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtAddress.KeyPress 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) Handles txtAddress.TextChanged btnApplyEnabled = True End Sub 'Private Sub txtDescription_Click(ByVal sender As Object, ByVal e As System.EventArgs) ' txtDescription.SelectAll() 'End Sub 'Private Sub txtDescription_Enter(ByVal sender As Object, ByVal e As System.EventArgs) ' txtDescription.SelectAll() 'End Sub 'Private Sub txtDescription_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) ' 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) ' btnApplyEnabled = True 'End Sub #End Region #Region "Others" Private Function funAddorEdit(sender As Object) As Integer funAddorEdit = -1 '****************************************************************************** '1.基本檢查() '****************************************************************************** If txtStudentNo.Text = "" Then iMESExceptionManager.ExceptionManager.iMESMsgBoxShowDialog(ChgTranslateName_Msg("0000-200001", "[%StudentNo%]"), MsgBoxStyle.Exclamation, Me.Text) txtStudentNo.Focus() Exit Function End If If txtParentName.Text = "" Then iMESExceptionManager.ExceptionManager.iMESMsgBoxShowDialog(ChgTranslateName_Msg("0000-200001", "[%ParentName%]"), MsgBoxStyle.Exclamation, Me.Text) txtParentName.Focus() Exit Function End If '****************************************************************************** '2.寫回資料庫() '****************************************************************************** Dim XmlDoc As New XmlDocument Try strIdentity = CombineXMLIdentity(gComputerName, gUserNo, GetNow()) strParameter = CombineXMLParameter("studentno", "studentNo", "string", CInput(txtStudentNo.Text), "") strParameter = strParameter & CombineXMLParameter("parentname", "parentname", "string", CInput(txtParentName.Text), "") strParameter = strParameter & CombineXMLParameter("telno", "telno", "string", txtTelNo.Text, "") strParameter = strParameter & CombineXMLParameter("faxno", "faxNo", "string", txtFaxNo.Text, "") strParameter = strParameter & CombineXMLParameter("title", "title", "string", CInput(txtTitle.Text), "") strParameter = strParameter & CombineXMLParameter("address", "address", "string", CInput(txtAddress.Text), "") strParameter = strParameter & CombineXMLParameter("email", "email", "string", CInput(txtEMail.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.AddStudentCont(InXml) OutXml = InvokeSrv("SXS.wsENT_21684.AddStudentCont", InXml) Else 'Edit ' 增加Datastamp strParameter += CombineXMLParameter("datastamp", "datastamp", "integer", intDataStamp, "") InXml = CombineXMLRequest(strIdentity, strParameter) ' 2016 YF, OutXml = wsENT.EditStudentCont(InXml) OutXml = InvokeSrv("SXS.wsENT_21684.EditStudentCont", InXml) End If XmlDoc.LoadXml(OutXml) If ChkExecutionSuccess(XmlDoc) Then gReturnKeyValue = txtParentName.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 Student Parent Failed!," & e1.Message, MsgBoxStyle.Exclamation) ExceptionManager.iMESShowDialog(defWinErrCode, ex.Message, ex.StackTrace) End Try XmlDoc = Nothing End Function #End Region Private Sub frmStudentContDef_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 Private Sub btnConfirm_Click_1(sender As Object, e As EventArgs) Handles btnConfirm.Click End Sub End Class