1083 lines
48 KiB
C#
1083 lines
48 KiB
C#
![]() |
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 wsENT_21684
|
|||
|
{
|
|||
|
private MEStc_SXS.clsENT21684 objENT = new MEStc_SXS.clsENT21684();
|
|||
|
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 wsENT_21684()
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
strResourceDir = System.IO.Path.Combine("wsUpdateResource", objSetting["ResourceDir"].ToString());
|
|||
|
}
|
|||
|
catch (Exception)
|
|||
|
{ }
|
|||
|
}
|
|||
|
|
|||
|
#region --- Student 外包商 ---
|
|||
|
|
|||
|
[WebMethod(Description = "Load Student Data")]
|
|||
|
public string LoadStudent(string InXml)
|
|||
|
{
|
|||
|
string LoadStudentRet = default(string);
|
|||
|
|
|||
|
// 先給預設值,以判斷是否有傳入該參數
|
|||
|
string StudentNo = defString;
|
|||
|
int IssueState = 2;
|
|||
|
|
|||
|
ArriveTime = DateTime.Now;
|
|||
|
string AdditionalXml = "";
|
|||
|
try
|
|||
|
{
|
|||
|
// 讀取InXml字串
|
|||
|
xmlDoc.LoadXml(InXml);
|
|||
|
// 組Identity字串
|
|||
|
strIdentity = CombineXMLIdentity(Environment.MachineName, GetXMLCurUserNo(xmlDoc), Conversions.ToString(ArriveTime));
|
|||
|
|
|||
|
// 判斷是否有傳入Student,若有,表示要依Student查詢
|
|||
|
if (xmlDoc.DocumentElement.GetElementsByTagName("Studentno").Count > 0)
|
|||
|
{
|
|||
|
if (xmlDoc.GetElementsByTagName("Studentno").Item(0).SelectNodes("value").Count > 0)
|
|||
|
{
|
|||
|
StudentNo = xmlDoc.DocumentElement.GetElementsByTagName("Studentno").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.LoadStudent(StudentNo, IssueState, AdditionalXml);
|
|||
|
strException = "";
|
|||
|
strResult = "success";
|
|||
|
}
|
|||
|
|
|||
|
catch (iMESException.MESException ex)
|
|||
|
{
|
|||
|
strReturnValue = "";
|
|||
|
strException = CombineXMLException(Conversions.ToString(ex.ErrorCode), TranslateMsg(ex.Message, GetXMLLanguageMode(xmlDoc), strResourceDir), "Show Student Failed!!", ex.StackTrace);
|
|||
|
strResult = "fail";
|
|||
|
}
|
|||
|
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
strReturnValue = "";
|
|||
|
strException = CombineXMLException(defWSErrCode, ex.Message, "Show Student Failed!!", ex.StackTrace);
|
|||
|
strResult = "fail";
|
|||
|
}
|
|||
|
|
|||
|
finally
|
|||
|
{
|
|||
|
// 將各部份之XML字串組起來並傳出
|
|||
|
LoadStudentRet = CombineXMLResponse(strIdentity, strReturnValue, strException, strResult, "");
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
return LoadStudentRet;
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
[WebMethod(Description = "Add Student data")]
|
|||
|
public string AddStudent(string InXml)
|
|||
|
{
|
|||
|
string AddStudentRet = default(string);
|
|||
|
|
|||
|
// 先給預設值,以判斷是否有傳入該參數
|
|||
|
var StudentNo = default(string);
|
|||
|
string StudentName;
|
|||
|
string Score = defString;
|
|||
|
string Creator = defString;
|
|||
|
|
|||
|
ArriveTime = DateTime.Now;
|
|||
|
|
|||
|
try
|
|||
|
{
|
|||
|
// 讀取InXml字串
|
|||
|
xmlDoc.LoadXml(InXml);
|
|||
|
|
|||
|
// 組Identity字串
|
|||
|
strIdentity = CombineXMLIdentity(Environment.MachineName, GetXMLCurUserNo(xmlDoc), Conversions.ToString(ArriveTime));
|
|||
|
|
|||
|
// 開始解譯InXml字串
|
|||
|
// Student一定要傳入
|
|||
|
if (xmlDoc.DocumentElement.GetElementsByTagName("studentno").Count > 0)
|
|||
|
{
|
|||
|
if (xmlDoc.GetElementsByTagName("studentno").Item(0).SelectNodes("value").Count > 0)
|
|||
|
{
|
|||
|
StudentNo = xmlDoc.DocumentElement.GetElementsByTagName("studentno").Item(0).SelectNodes("value").Item(0).InnerText;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
throw new iMESException.MESException("0000-200002", "StudentNo Not Found!");
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
throw new iMESException.MESException("0000-200002", "StudentNo Not Found!");
|
|||
|
}
|
|||
|
if (xmlDoc.DocumentElement.GetElementsByTagName("studentname").Count > 0)
|
|||
|
{
|
|||
|
if (xmlDoc.GetElementsByTagName("studentname").Item(0).SelectNodes("value").Count > 0)
|
|||
|
{
|
|||
|
StudentName = xmlDoc.DocumentElement.GetElementsByTagName("studentname").Item(0).SelectNodes("value").Item(0).InnerText;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
throw new iMESException.MESException("0000-200002", "StudentName Not Found!");
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
throw new iMESException.MESException("0000-200002", "StudentName Not Found!");
|
|||
|
}
|
|||
|
// Score
|
|||
|
if (xmlDoc.DocumentElement.GetElementsByTagName("score").Count > 0)
|
|||
|
{
|
|||
|
if (xmlDoc.GetElementsByTagName("score").Item(0).SelectNodes("value").Count > 0)
|
|||
|
{
|
|||
|
Score = xmlDoc.DocumentElement.GetElementsByTagName("score").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.AddStudent(StudentNo, StudentName, Score, Creator);
|
|||
|
|
|||
|
strException = "";
|
|||
|
strResult = "success";
|
|||
|
|
|||
|
objSYS.AddEventLog("wsENT_21684", GetXMLCurUserNo(xmlDoc), "StudentNo", StudentNo, DateTime.Now, "AddStudent");
|
|||
|
}
|
|||
|
|
|||
|
catch (iMESException.MESException ex)
|
|||
|
{
|
|||
|
strException = CombineXMLException(Conversions.ToString(ex.ErrorCode), TranslateMsg(ex.Message, GetXMLLanguageMode(xmlDoc), strResourceDir), "Add Student failed!", ex.StackTrace);
|
|||
|
|
|||
|
strResult = "fail";
|
|||
|
|
|||
|
objSYS.AddErrorLog_ErrorCode("wsENT", GetXMLCurUserNo(xmlDoc), "StudentNo", StudentNo, DateTime.Now, strException, ComputerName: GetXMLCurComputer(xmlDoc), ErrorCode: Conversions.ToString(ex.ErrorCode));
|
|||
|
}
|
|||
|
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
strException = CombineXMLException(defWSErrCode, ex.Message, "Add Student failed!", ex.StackTrace);
|
|||
|
|
|||
|
strResult = "fail";
|
|||
|
|
|||
|
objSYS.AddErrorLog_ErrorCode("wsENT", GetXMLCurUserNo(xmlDoc), "StudentNo", StudentNo, DateTime.Now, strException, ComputerName: GetXMLCurComputer(xmlDoc), ErrorCode: defWSErrCode);
|
|||
|
}
|
|||
|
|
|||
|
finally
|
|||
|
{
|
|||
|
// 將各部份之XML字串組起來並傳出
|
|||
|
AddStudentRet = CombineXMLResponse(strIdentity, "", strException, strResult, "");
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
return AddStudentRet;
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
[WebMethod(Description = "Edit Specified Student Data")]
|
|||
|
public string EditStudent(string InXml)
|
|||
|
{
|
|||
|
string EditStudentRet = default(string);
|
|||
|
|
|||
|
// 參數先給預設值,以判斷是否有傳入該參數
|
|||
|
var StudentNo = default(string);
|
|||
|
int IssueState = defInteger;
|
|||
|
string StudentName = defString;
|
|||
|
string Score = 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字串
|
|||
|
// Student一定要傳入
|
|||
|
if (xmlDoc.DocumentElement.GetElementsByTagName("studentno").Count > 0)
|
|||
|
{
|
|||
|
if (xmlDoc.GetElementsByTagName("studentno").Item(0).SelectNodes("value").Count > 0)
|
|||
|
{
|
|||
|
StudentNo = xmlDoc.DocumentElement.GetElementsByTagName("studentno").Item(0).SelectNodes("value").Item(0).InnerText;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
throw new iMESException.MESException("0000-200002", "StudentNo Not Found!");
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
throw new iMESException.MESException("0000-200002", "StudentNo 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%]");
|
|||
|
}
|
|||
|
// StudentName不可空白
|
|||
|
if (xmlDoc.DocumentElement.GetElementsByTagName("studentname").Count > 0)
|
|||
|
{
|
|||
|
if (xmlDoc.GetElementsByTagName("studentname").Item(0).SelectNodes("value").Count > 0)
|
|||
|
{
|
|||
|
StudentName = xmlDoc.DocumentElement.GetElementsByTagName("studentname").Item(0).SelectNodes("value").Item(0).InnerText;
|
|||
|
if (string.IsNullOrEmpty(StudentName))
|
|||
|
{
|
|||
|
throw new iMESException.MESException("0000-200001", "StudentName is empty!");
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
// Description
|
|||
|
if (xmlDoc.DocumentElement.GetElementsByTagName("score").Count > 0)
|
|||
|
{
|
|||
|
if (xmlDoc.GetElementsByTagName("score").Item(0).SelectNodes("value").Count > 0)
|
|||
|
{
|
|||
|
Score = xmlDoc.DocumentElement.GetElementsByTagName("score").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 ((StudentName ?? "") != defString | (Score ?? "") != defString)
|
|||
|
{
|
|||
|
// 呼叫Dll執行修改
|
|||
|
objENT.EditStudent(StudentNo, StudentName, Score, AdditionalXml, DataStamp: DataStamp, Reviser: GetXMLCurUserNo(xmlDoc), ReviseDate: ArriveTime);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
strException = "";
|
|||
|
strResult = "success";
|
|||
|
|
|||
|
objSYS.AddEventLog("wsENT_21684", GetXMLCurUserNo(xmlDoc), "StudentNo", StudentNo, DateTime.Now, "EditStudent");
|
|||
|
}
|
|||
|
|
|||
|
catch (iMESException.MESException ex)
|
|||
|
{
|
|||
|
strException = CombineXMLException(Conversions.ToString(ex.ErrorCode), TranslateMsg(ex.Message, GetXMLLanguageMode(xmlDoc), strResourceDir), "Edit Student failed!", ex.StackTrace);
|
|||
|
|
|||
|
strResult = "fail";
|
|||
|
|
|||
|
objSYS.AddErrorLog_ErrorCode("wsENT_21684", GetXMLCurUserNo(xmlDoc), "StudentNo", StudentNo, DateTime.Now, strException, ComputerName: GetXMLCurComputer(xmlDoc), ErrorCode: Conversions.ToString(ex.ErrorCode));
|
|||
|
}
|
|||
|
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
strException = CombineXMLException(defWSErrCode, ex.Message, "Edit Student failed!", ex.StackTrace);
|
|||
|
|
|||
|
strResult = "fail";
|
|||
|
|
|||
|
objSYS.AddErrorLog_ErrorCode("wsENT_21684", GetXMLCurUserNo(xmlDoc), "StudentNo", StudentNo, DateTime.Now, strException, ComputerName: GetXMLCurComputer(xmlDoc), ErrorCode: defWSErrCode);
|
|||
|
}
|
|||
|
|
|||
|
finally
|
|||
|
{
|
|||
|
// 將各部份之XML字串組起來並傳出
|
|||
|
EditStudentRet = CombineXMLResponse(strIdentity, "", strException, strResult, "");
|
|||
|
}
|
|||
|
|
|||
|
return EditStudentRet;
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
[WebMethod(Description = "Delete Student By Specified Student")]
|
|||
|
public string DelStudent(string InXml)
|
|||
|
{
|
|||
|
string DelStudentRet = default(string);
|
|||
|
|
|||
|
var StudentNo = 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字串
|
|||
|
// Student一定要傳入
|
|||
|
if (xmlDoc.DocumentElement.GetElementsByTagName("studentno").Count > 0)
|
|||
|
{
|
|||
|
if (xmlDoc.GetElementsByTagName("studentno").Item(0).SelectNodes("value").Count > 0)
|
|||
|
{
|
|||
|
StudentNo = xmlDoc.DocumentElement.GetElementsByTagName("studentno").Item(0).SelectNodes("value").Item(0).InnerText;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
throw new iMESException.MESException("0000-200002", "StudentNo Not Found!");
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
throw new iMESException.MESException("0000-200002", "StudentNo 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.DelStudent(StudentNo);
|
|||
|
strDelState = "未簽核刪除";
|
|||
|
break;
|
|||
|
}
|
|||
|
case 2:
|
|||
|
{
|
|||
|
objENT.SetStudentIssueState(StudentNo, -1, DataStamp: DataStamp, Reviser: GetXMLCurUserNo(xmlDoc), ReviseDate: ArriveTime);
|
|||
|
strDelState = "已簽核刪除";
|
|||
|
break;
|
|||
|
}
|
|||
|
case -1:
|
|||
|
{
|
|||
|
objENT.DelStudent(StudentNo);
|
|||
|
strDelState = "不使用刪除";
|
|||
|
break;
|
|||
|
}
|
|||
|
|
|||
|
default:
|
|||
|
{
|
|||
|
throw new iMESException.MESException("0000-200021", "[%IssueState%]");
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
strException = "";
|
|||
|
strResult = "success";
|
|||
|
|
|||
|
objSYS.AddEventLog("wsENT_21684", GetXMLCurUserNo(xmlDoc), "StudentNo", StudentNo, DateTime.Now, "DelStudent:" + strDelState);
|
|||
|
}
|
|||
|
|
|||
|
catch (iMESException.MESException ex)
|
|||
|
{
|
|||
|
strException = CombineXMLException(Conversions.ToString(ex.ErrorCode), TranslateMsg(ex.Message, GetXMLLanguageMode(xmlDoc), strResourceDir), "Delete Student failed!", ex.StackTrace);
|
|||
|
|
|||
|
strResult = "fail";
|
|||
|
|
|||
|
objSYS.AddErrorLog_ErrorCode("wsENT_21684", GetXMLCurUserNo(xmlDoc), "StudentNo", StudentNo, DateTime.Now, strException, ComputerName: GetXMLCurComputer(xmlDoc), ErrorCode: Conversions.ToString(ex.ErrorCode));
|
|||
|
}
|
|||
|
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
strException = CombineXMLException(defWSErrCode, ex.Message, "Delete Student failed!", ex.StackTrace);
|
|||
|
|
|||
|
strResult = "fail";
|
|||
|
|
|||
|
objSYS.AddErrorLog_ErrorCode("wsENT_21684", GetXMLCurUserNo(xmlDoc), "StudentNo", StudentNo, DateTime.Now, strException, ComputerName: GetXMLCurComputer(xmlDoc), ErrorCode: defWSErrCode);
|
|||
|
}
|
|||
|
|
|||
|
finally
|
|||
|
{
|
|||
|
DelStudentRet = CombineXMLResponse(strIdentity, "", strException, strResult, "");
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
return DelStudentRet;
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
[WebMethod(Description = "Approve Specified Student Data")]
|
|||
|
public string ApproveStudent(string InXml)
|
|||
|
{
|
|||
|
string ApproveStudentRet = default(string);
|
|||
|
|
|||
|
string IssueNo = "Student BASIS"; // 簽核編號:Student BASIS.若找不到,表示直接將狀態改為Active.
|
|||
|
var StudentNo = 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字串
|
|||
|
// Student一定要傳入
|
|||
|
if (xmlDoc.DocumentElement.GetElementsByTagName("studentno").Count > 0)
|
|||
|
{
|
|||
|
if (xmlDoc.GetElementsByTagName("studentno").Item(0).SelectNodes("value").Count > 0)
|
|||
|
{
|
|||
|
StudentNo = xmlDoc.DocumentElement.GetElementsByTagName("studentno").Item(0).SelectNodes("value").Item(0).InnerText;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
throw new iMESException.MESException("0000-200002", "StudentNo Not Found!");
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
throw new iMESException.MESException("0000-200002", "StudentNo 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.SetStudentIssueState(StudentNo, 2, DataStamp: DataStamp, Reviser: GetXMLCurUserNo(xmlDoc), ReviseDate: ArriveTime);
|
|||
|
objSYS.AddEventLog("wsENT_21684", GetXMLCurUserNo(xmlDoc), "StudentNo", StudentNo, DateTime.Now, "ApproveStudent");
|
|||
|
}
|
|||
|
|
|||
|
else
|
|||
|
{
|
|||
|
// 檢查JobNo是否有定義Detail檔,沒有Detail檔則直接核准
|
|||
|
DataRow tmpDR;
|
|||
|
tmpDR = objIssue.GetIssueJobDetail(Conversions.ToString(IssueDR["JobNo"]));
|
|||
|
if (tmpDR["JobNo"] is DBNull)
|
|||
|
{
|
|||
|
objENT.SetStudentIssueState(StudentNo, 2, DataStamp: DataStamp, Reviser: GetXMLCurUserNo(xmlDoc), ReviseDate: ArriveTime);
|
|||
|
objSYS.AddEventLog("wsENT_21684", GetXMLCurUserNo(xmlDoc), "StudentNo", StudentNo, DateTime.Now, "ApproveStudent");
|
|||
|
}
|
|||
|
|
|||
|
else
|
|||
|
{
|
|||
|
// 將狀態改為Pending,且應以找到的JobNo來進入簽核
|
|||
|
// 填入簽核現況檔之Initial
|
|||
|
var ApproveSQL = new Collection();
|
|||
|
var RejectSQL = new Collection();
|
|||
|
string tmpSQL;
|
|||
|
string IssueSubject;
|
|||
|
string IssueMasterNo;
|
|||
|
|
|||
|
// 核准後應將狀態改為Active
|
|||
|
tmpSQL = "Update tblENTStudent Set IssueState = 2 Where StudentNo = '" + StudentNo + "'";
|
|||
|
ApproveSQL.Add(tmpSQL);
|
|||
|
// 退回則應將狀態回復到Unfrozen
|
|||
|
tmpSQL = "Update tblENTStudent Set IssueState = 0 Where StudentNo = '" + StudentNo + "'";
|
|||
|
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 = "StudentNo: " + StudentNo;
|
|||
|
IssueMasterNo = objIssue.InitIssueMasterNo();
|
|||
|
// 此筆資料進入Issue流程
|
|||
|
objIssue.StartIssueProcess(IssueMasterNo, ApproveSQL, RejectSQL, IssueNo, IssueDR["JobNo"].ToString(), IssueSubject, Creator);
|
|||
|
// 將狀態改為Pending
|
|||
|
objENT.SetStudentIssueState(StudentNo, 1, DataStamp: DataStamp, Reviser: GetXMLCurUserNo(xmlDoc), ReviseDate: ArriveTime);
|
|||
|
|
|||
|
objSYS.AddEventLog("wsENT_21684", GetXMLCurUserNo(xmlDoc), "StudentNo", StudentNo, DateTime.Now, "ApproveStudent");
|
|||
|
|
|||
|
// 發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 Student failed!", ex.StackTrace);
|
|||
|
|
|||
|
strResult = "fail";
|
|||
|
|
|||
|
objSYS.AddErrorLog_ErrorCode("wsENT_21684", GetXMLCurUserNo(xmlDoc), "StudentNo", StudentNo, DateTime.Now, strException, ComputerName: GetXMLCurComputer(xmlDoc), ErrorCode: Conversions.ToString(ex.ErrorCode));
|
|||
|
}
|
|||
|
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
strException = CombineXMLException(defWSErrCode, ex.Message, "Approve Student failed!", ex.StackTrace);
|
|||
|
|
|||
|
strResult = "fail";
|
|||
|
|
|||
|
objSYS.AddErrorLog_ErrorCode("wsENT_21684", GetXMLCurUserNo(xmlDoc), "StudentNo", StudentNo, DateTime.Now, strException, ComputerName: GetXMLCurComputer(xmlDoc), ErrorCode: defWSErrCode);
|
|||
|
}
|
|||
|
|
|||
|
finally
|
|||
|
{
|
|||
|
// 將各部份之XML字串組起來並傳出
|
|||
|
ApproveStudentRet = CombineXMLResponse(strIdentity, "", strException, strResult, "");
|
|||
|
}
|
|||
|
|
|||
|
return ApproveStudentRet;
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
// Student parent
|
|||
|
[WebMethod(Description = "Load Student parent Data")]
|
|||
|
public string LoadStudentCont(string InXml)
|
|||
|
{
|
|||
|
string LoadStudentContRet = default(string);
|
|||
|
|
|||
|
// 先給預設值,以判斷是否有傳入該參數
|
|||
|
string StudentNo = defString;
|
|||
|
string parentName = defString;
|
|||
|
|
|||
|
ArriveTime = DateTime.Now;
|
|||
|
|
|||
|
try
|
|||
|
{
|
|||
|
// 讀取InXml字串
|
|||
|
xmlDoc.LoadXml(InXml);
|
|||
|
// 組Identity字串
|
|||
|
strIdentity = CombineXMLIdentity(Environment.MachineName, GetXMLCurUserNo(xmlDoc), Conversions.ToString(ArriveTime));
|
|||
|
|
|||
|
// 判斷是否有傳入StudentNo,若有,表示要依StudentNo查詢
|
|||
|
if (xmlDoc.DocumentElement.GetElementsByTagName("studentno").Count > 0)
|
|||
|
{
|
|||
|
if (xmlDoc.GetElementsByTagName("studentno").Item(0).SelectNodes("value").Count > 0)
|
|||
|
{
|
|||
|
StudentNo = xmlDoc.DocumentElement.GetElementsByTagName("studentno").Item(0).SelectNodes("value").Item(0).InnerText;
|
|||
|
}
|
|||
|
}
|
|||
|
if (xmlDoc.DocumentElement.GetElementsByTagName("parentname").Count > 0)
|
|||
|
{
|
|||
|
if (xmlDoc.GetElementsByTagName("parentname").Item(0).SelectNodes("value").Count > 0)
|
|||
|
{
|
|||
|
parentName = xmlDoc.DocumentElement.GetElementsByTagName("parentname").Item(0).SelectNodes("value").Item(0).InnerText;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
// 呼叫Dll執行
|
|||
|
strReturnValue = objENT.LoadStudentCont(StudentNo, parentName);
|
|||
|
strException = "";
|
|||
|
strResult = "success";
|
|||
|
}
|
|||
|
|
|||
|
catch (iMESException.MESException ex)
|
|||
|
{
|
|||
|
strReturnValue = "";
|
|||
|
strException = CombineXMLException(Conversions.ToString(ex.ErrorCode), TranslateMsg(ex.Message, GetXMLLanguageMode(xmlDoc), strResourceDir), "Show Student parent Failed!!", ex.StackTrace);
|
|||
|
strResult = "fail";
|
|||
|
}
|
|||
|
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
strReturnValue = "";
|
|||
|
strException = CombineXMLException(defWSErrCode, ex.Message, "Show Student parent Failed!!", ex.StackTrace);
|
|||
|
strResult = "fail";
|
|||
|
}
|
|||
|
|
|||
|
finally
|
|||
|
{
|
|||
|
// 將各部份之XML字串組起來並傳出
|
|||
|
LoadStudentContRet = CombineXMLResponse(strIdentity, strReturnValue, strException, strResult, "");
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
return LoadStudentContRet;
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
[WebMethod(Description = "Add Student parent data")]
|
|||
|
public string AddStudentCont(string InXml)
|
|||
|
{
|
|||
|
string AddStudentContRet = default(string);
|
|||
|
// 先給預設值,以判斷是否有傳入該參數
|
|||
|
var StudentNo = default(string);
|
|||
|
var parentName = default(string);
|
|||
|
string TelNo = defString;
|
|||
|
string FaxNo = defString;
|
|||
|
string Title = defString;
|
|||
|
string Address = defString;
|
|||
|
string EMail = 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字串
|
|||
|
// StudentNo一定要傳入
|
|||
|
if (xmlDoc.DocumentElement.GetElementsByTagName("studentno").Count > 0)
|
|||
|
{
|
|||
|
if (xmlDoc.GetElementsByTagName("studentno").Item(0).SelectNodes("value").Count > 0)
|
|||
|
{
|
|||
|
StudentNo = xmlDoc.DocumentElement.GetElementsByTagName("studentno").Item(0).SelectNodes("value").Item(0).InnerText;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
throw new iMESException.MESException("0000-200002", "StudentNo Not Found!");
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
throw new iMESException.MESException("0000-200002", "StudentNo Not Found!");
|
|||
|
}
|
|||
|
// parentName一定要傳入
|
|||
|
if (xmlDoc.DocumentElement.GetElementsByTagName("parentname").Count > 0)
|
|||
|
{
|
|||
|
if (xmlDoc.GetElementsByTagName("parentname").Item(0).SelectNodes("value").Count > 0)
|
|||
|
{
|
|||
|
parentName = xmlDoc.DocumentElement.GetElementsByTagName("parentname").Item(0).SelectNodes("value").Item(0).InnerText;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
throw new iMESException.MESException("0000-200002", "parentName Not Found!");
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
throw new iMESException.MESException("0000-200002", "parentName 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");
|
|||
|
|
|||
|
|
|||
|
// 呼叫Dll執行新增資料
|
|||
|
objENT.AddStudentCont(StudentNo, parentName, TelNo, FaxNo, Title, Address, EMail, Description, AdditionalXml, GetXMLCurUserNo(xmlDoc), ArriveTime);
|
|||
|
|
|||
|
strException = "";
|
|||
|
strResult = "success";
|
|||
|
|
|||
|
objSYS.AddEventLog("wsENT_21684", GetXMLCurUserNo(xmlDoc), "StudentNo", StudentNo, DateTime.Now, "AddStudentparent parentName:" + parentName);
|
|||
|
}
|
|||
|
|
|||
|
catch (iMESException.MESException ex)
|
|||
|
{
|
|||
|
strException = CombineXMLException(Conversions.ToString(ex.ErrorCode), TranslateMsg(ex.Message, GetXMLLanguageMode(xmlDoc), strResourceDir), "Add Studentparent Data failed, parentName:" + parentName, ex.StackTrace);
|
|||
|
|
|||
|
strResult = "fail";
|
|||
|
|
|||
|
objSYS.AddErrorLog_ErrorCode("wsENT_21684", GetXMLCurUserNo(xmlDoc), "StudentNo", StudentNo, DateTime.Now, strException, ComputerName: GetXMLCurComputer(xmlDoc), ErrorCode: Conversions.ToString(ex.ErrorCode));
|
|||
|
}
|
|||
|
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
strException = CombineXMLException(defWSErrCode, ex.Message, "Add Studentparent Data failed, parentName:" + parentName, ex.StackTrace);
|
|||
|
|
|||
|
strResult = "fail";
|
|||
|
|
|||
|
objSYS.AddErrorLog_ErrorCode("wsENT_21684", GetXMLCurUserNo(xmlDoc), "StudentNo", StudentNo, DateTime.Now, strException, ComputerName: GetXMLCurComputer(xmlDoc), ErrorCode: defWSErrCode);
|
|||
|
}
|
|||
|
|
|||
|
finally
|
|||
|
{
|
|||
|
// 將各部份之XML字串組起來並傳出
|
|||
|
AddStudentContRet = CombineXMLResponse(strIdentity, "", strException, strResult, "");
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
return AddStudentContRet;
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
[WebMethod(Description = "Edit Specified Student parent Data")]
|
|||
|
public string EditStudentCont(string InXml)
|
|||
|
{
|
|||
|
string EditStudentContRet = default(string);
|
|||
|
// 先給預設值,以判斷是否有傳入該參數
|
|||
|
var StudentNo = default(string);
|
|||
|
var parentName = 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字串
|
|||
|
// StudentNo一定要傳入
|
|||
|
if (xmlDoc.DocumentElement.GetElementsByTagName("studentno").Count > 0)
|
|||
|
{
|
|||
|
if (xmlDoc.GetElementsByTagName("studentno").Item(0).SelectNodes("value").Count > 0)
|
|||
|
{
|
|||
|
StudentNo = xmlDoc.DocumentElement.GetElementsByTagName("studentno").Item(0).SelectNodes("value").Item(0).InnerText;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
throw new iMESException.MESException("0000-200002", "StudentNo Not Found!");
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
throw new iMESException.MESException("0000-200002", "StudentNo Not Found!");
|
|||
|
}
|
|||
|
// parentName一定要傳入
|
|||
|
if (xmlDoc.DocumentElement.GetElementsByTagName("parentname").Count > 0)
|
|||
|
{
|
|||
|
if (xmlDoc.GetElementsByTagName("parentname").Item(0).SelectNodes("value").Count > 0)
|
|||
|
{
|
|||
|
parentName = xmlDoc.DocumentElement.GetElementsByTagName("parentname").Item(0).SelectNodes("value").Item(0).InnerText;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
throw new iMESException.MESException("0000-200002", "parentName Not Found!");
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
throw new iMESException.MESException("0000-200002", "parentName 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)
|
|||
|
{
|
|||
|
// 呼叫Dll執行修改
|
|||
|
objENT.EditStudentCont(StudentNo, parentName, TelNo, FaxNo, Title, Address, EMail, AdditionalXml, DataStamp: DataStamp, Reviser: GetXMLCurUserNo(xmlDoc), ReviseDate: ArriveTime);
|
|||
|
}
|
|||
|
// End If
|
|||
|
|
|||
|
strException = "";
|
|||
|
strResult = "success";
|
|||
|
|
|||
|
objSYS.AddEventLog("wsENT_21684", GetXMLCurUserNo(xmlDoc), "StudentNo", StudentNo, DateTime.Now, "EditStudentparent parentName:" + parentName);
|
|||
|
}
|
|||
|
|
|||
|
catch (iMESException.MESException ex)
|
|||
|
{
|
|||
|
strException = CombineXMLException(Conversions.ToString(ex.ErrorCode), TranslateMsg(ex.Message, GetXMLLanguageMode(xmlDoc), strResourceDir), "Edit Studentparent Data failed, parentName:" + parentName, ex.StackTrace);
|
|||
|
|
|||
|
strResult = "fail";
|
|||
|
|
|||
|
objSYS.AddErrorLog_ErrorCode("wsENT_21684", GetXMLCurUserNo(xmlDoc), "StudentNo", StudentNo, DateTime.Now, strException, ComputerName: GetXMLCurComputer(xmlDoc), ErrorCode: Conversions.ToString(ex.ErrorCode));
|
|||
|
}
|
|||
|
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
strException = CombineXMLException(defWSErrCode, ex.Message, "Edit Studentparent Data failed, parentName:" + parentName, ex.StackTrace);
|
|||
|
|
|||
|
strResult = "fail";
|
|||
|
|
|||
|
objSYS.AddErrorLog_ErrorCode("wsENT_21684", GetXMLCurUserNo(xmlDoc), "StudentNo", StudentNo, DateTime.Now, strException, ComputerName: GetXMLCurComputer(xmlDoc), ErrorCode: defWSErrCode);
|
|||
|
}
|
|||
|
|
|||
|
finally
|
|||
|
{
|
|||
|
// 將各部份之XML字串組起來並傳出
|
|||
|
EditStudentContRet = CombineXMLResponse(strIdentity, "", strException, strResult, "");
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
return EditStudentContRet;
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
[WebMethod(Description = "Delete Student parent By Specified StudentNo and parentName")]
|
|||
|
public string DelStudentCont(string InXml)
|
|||
|
{
|
|||
|
string DelStudentContRet = default(string);
|
|||
|
|
|||
|
var StudentNo = default(string);
|
|||
|
string parentName = defString; // 沒有傳入表示要刪除指定Student的所有parent
|
|||
|
|
|||
|
ArriveTime = DateTime.Now;
|
|||
|
|
|||
|
try
|
|||
|
{
|
|||
|
// 讀取InXml字串
|
|||
|
xmlDoc.LoadXml(InXml);
|
|||
|
// 組Identity字串
|
|||
|
strIdentity = CombineXMLIdentity(Environment.MachineName, GetXMLCurUserNo(xmlDoc), Conversions.ToString(ArriveTime));
|
|||
|
|
|||
|
// 開始解譯InXml字串
|
|||
|
// StudentNo一定要傳入
|
|||
|
if (xmlDoc.DocumentElement.GetElementsByTagName("studentno").Count > 0)
|
|||
|
{
|
|||
|
if (xmlDoc.GetElementsByTagName("studentno").Item(0).SelectNodes("value").Count > 0)
|
|||
|
{
|
|||
|
StudentNo = xmlDoc.DocumentElement.GetElementsByTagName("studentno").Item(0).SelectNodes("value").Item(0).InnerText;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
throw new iMESException.MESException("0000-200002", "StudentNo Not Found!");
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
throw new iMESException.MESException("0000-200002", "StudentNo Not Found!");
|
|||
|
}
|
|||
|
// parentName一定要傳入
|
|||
|
if (xmlDoc.DocumentElement.GetElementsByTagName("parentname").Count > 0)
|
|||
|
{
|
|||
|
if (xmlDoc.GetElementsByTagName("parentname").Item(0).SelectNodes("value").Count > 0)
|
|||
|
{
|
|||
|
parentName = xmlDoc.DocumentElement.GetElementsByTagName("parentname").Item(0).SelectNodes("value").Item(0).InnerText;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
objENT.DelStudentCont(StudentNo, parentName);
|
|||
|
|
|||
|
strException = "";
|
|||
|
strResult = "success";
|
|||
|
|
|||
|
objSYS.AddEventLog("wsENT_21684", GetXMLCurUserNo(xmlDoc), "StudentNo", StudentNo, DateTime.Now, "DelStudentparent parentName:" + parentName);
|
|||
|
}
|
|||
|
|
|||
|
catch (iMESException.MESException ex)
|
|||
|
{
|
|||
|
strException = CombineXMLException(Conversions.ToString(ex.ErrorCode), TranslateMsg(ex.Message, GetXMLLanguageMode(xmlDoc), strResourceDir), "Del Studentparent Data failed, parentName:" + parentName, ex.StackTrace);
|
|||
|
|
|||
|
strResult = "fail";
|
|||
|
|
|||
|
objSYS.AddErrorLog_ErrorCode("wsENT_21684", GetXMLCurUserNo(xmlDoc), "StudentNo", StudentNo, DateTime.Now, strException, ComputerName: GetXMLCurComputer(xmlDoc), ErrorCode: Conversions.ToString(ex.ErrorCode));
|
|||
|
}
|
|||
|
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
strException = CombineXMLException(defWSErrCode, ex.Message, "Del Studentparent Data failed, parentName:" + parentName, ex.StackTrace);
|
|||
|
|
|||
|
strResult = "fail";
|
|||
|
|
|||
|
objSYS.AddErrorLog_ErrorCode("wsENT_21684", GetXMLCurUserNo(xmlDoc), "StudentNo", StudentNo, DateTime.Now, strException, ComputerName: GetXMLCurComputer(xmlDoc), ErrorCode: defWSErrCode);
|
|||
|
}
|
|||
|
|
|||
|
finally
|
|||
|
{
|
|||
|
DelStudentContRet = CombineXMLResponse(strIdentity, "", strException, strResult, "");
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
return DelStudentContRet;
|
|||
|
|
|||
|
}
|
|||
|
#endregion
|
|||
|
}
|
|||
|
}
|