| | |
| | |
|
| | | using System.Data.OracleClient;
|
| | | using CCSTrace.CCS.Domain;
|
| | | using NLog;
|
| | |
|
| | | namespace CCSTrace.CCS
|
| | | {
|
| | | public class FinishEvent
|
| | | {
|
| | | private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
| | |
|
| | | private bool _upLevel;
|
| | | private int _originCaseStatus = 0;
|
| | | private Object.EventRecord _mEventRec = null;
|
| | | private RecordLog _pLog;
|
| | | private OracleConnection _connectionTpc;
|
| | | private OracleTransaction _transaction;
|
| | |
|
| | |
| | | {
|
| | | }
|
| | |
|
| | | public bool Finish(int mKind, Object.EventRecord mRecord, OracleConnection conn, OracleTransaction trx, RecordLog log)
|
| | | public bool Finish(int mKind, Object.EventRecord mRecord, OracleConnection conn, OracleTransaction trx)
|
| | | {
|
| | | _mEventRec = mRecord;
|
| | | _pLog = log;
|
| | | _connectionTpc = conn;
|
| | | _transaction = trx;
|
| | |
|
| | | _pLog.Info("進行OMS資料更新程序...");
|
| | | Logger.Info("進行OMS資料更新程序...");
|
| | | if (mRecord.ParentId== 0)
|
| | | { // Original Case
|
| | | if (!(ProcessSingalCase(mRecord)))
|
| | | {
|
| | | return false;
|
| | | }
|
| | | _pLog.Info("更新eos.events成功!");
|
| | | Logger.Info("更新eos.events成功!");
|
| | | }
|
| | | else
|
| | | { // Child Case
|
| | |
| | | {
|
| | | return false;
|
| | | }
|
| | | _pLog.Info("更新eos.events成功!");
|
| | | Logger.Info("更新eos.events成功!");
|
| | | }
|
| | |
|
| | | // inert into eos.eventrecord && eos.eventrecord_ex
|
| | |
| | | {
|
| | | if (command.ExecuteNonQuery() <= 0)
|
| | | {
|
| | | _pLog.Error("儲存資料時發生錯誤: 無法更新eos.eventrecord");
|
| | | Logger.Error("儲存資料時發生錯誤: 無法更新eos.eventrecord");
|
| | | command.Dispose();
|
| | | return false;
|
| | | }
|
| | |
| | | command.CommandText = mRecord.LocateEquipment.GetSqlStmt();
|
| | | if (command.ExecuteNonQuery() <= 0)
|
| | | {
|
| | | _pLog.Error("儲存資料時發生錯誤: 無法更新eos.eventrecord_ex");
|
| | | Logger.Error("儲存資料時發生錯誤: 無法更新eos.eventrecord_ex");
|
| | | command.Dispose();
|
| | | return false;
|
| | | }
|
| | |
| | | {
|
| | | if (!SetVisualCustomer(mRecord))
|
| | | {
|
| | | _pLog.Error("新增影響用戶資料錯誤.");
|
| | | Logger.Error("新增影響用戶資料錯誤.");
|
| | | return false;
|
| | | }
|
| | | _pLog.Info("新增影響用戶成功!");
|
| | | Logger.Info("新增影響用戶成功!");
|
| | | }
|
| | |
|
| | | _upLevel = false; /* 判斷交辦案件是否升級為母案件 */
|
| | |
|
| | | if (!(UpdateImportCase(mRecord)))
|
| | | {
|
| | | _pLog.Error("處理案件等級變更時發生錯誤.");
|
| | | Logger.Error("處理案件等級變更時發生錯誤.");
|
| | | return false;
|
| | | }
|
| | | _pLog.Info("處理案件等級變更成功!");
|
| | | Logger.Info("處理案件等級變更成功!");
|
| | |
|
| | | if (!(UpdateRecuseOrder(mRecord)))
|
| | | {
|
| | | _pLog.Error("新增搶修順序資料時發生錯誤.");
|
| | | Logger.Error("新增搶修順序資料時發生錯誤.");
|
| | | return false;
|
| | | }
|
| | | _pLog.Info("新增搶修順序成功!");
|
| | | Logger.Info("新增搶修順序成功!");
|
| | |
|
| | | if (mKind == GlobalVariable.CaseTypeChanged)
|
| | | {
|
| | | if (!DeleteOldCase(mRecord))
|
| | | {
|
| | | _pLog.Error("案件轉換發生錯誤");
|
| | | Logger.Error("案件轉換發生錯誤");
|
| | | return false;
|
| | | }
|
| | | _pLog.Info("案件轉換成功!");
|
| | | Logger.Info("案件轉換成功!");
|
| | | }
|
| | |
|
| | | if (!SaveCustomerTel(mRecord))
|
| | | {
|
| | | _pLog.Error("無法將用戶電話回存回資料庫.");
|
| | | Logger.Error("無法將用戶電話回存回資料庫.");
|
| | | return false;
|
| | | }
|
| | | _pLog.Info("將用戶電話回存回資料庫成功!");
|
| | | Logger.Info("將用戶電話回存回資料庫成功!");
|
| | | }
|
| | | else if (mKind == GlobalVariable.NoMeter)
|
| | | {
|
| | | string sqlStmt;
|
| | | sqlStmt = "INSERT INTO EOS.RESCUE_ORDER SELECT " + mRecord.CaseId+ ",999,COUNT(*) + 1,'',"
|
| | | + mRecord.LocateEquipment.GetDsufid() + " FROM EOS.RESCUE_ORDER WHERE DSUFID = "
|
| | | + mRecord.LocateEquipment.GetDsufid();
|
| | | var sqlStmt = "INSERT INTO EOS.RESCUE_ORDER SELECT " + mRecord.CaseId+ ",999,COUNT(*) + 1,'',"
|
| | | + mRecord.LocateEquipment.GetDsufid() + " FROM EOS.RESCUE_ORDER WHERE DSUFID = "
|
| | | + mRecord.LocateEquipment.GetDsufid();
|
| | |
|
| | | command1 = new OracleCommand(sqlStmt, _connectionTpc, _transaction);
|
| | | if (command1.ExecuteNonQuery() <= 0)
|
| | | {
|
| | | _pLog.Error("新增搶修順序資料時發生錯誤.");
|
| | | Logger.Error("新增搶修順序資料時發生錯誤.");
|
| | | command1.Dispose();
|
| | | return false;
|
| | | }
|
| | | command1.Dispose();
|
| | | _pLog.Info("新增搶修順序成功!");
|
| | | Logger.Info("新增搶修順序成功!");
|
| | | }
|
| | |
|
| | | if (mRecord.ParentId== 0)
|
| | | {
|
| | | if (!InsertIntoSri(mRecord))
|
| | | {
|
| | | _pLog.Error("新增資料庫(OCSDB.SRI)錯誤.");
|
| | | Logger.Error("新增資料庫(OCSDB.SRI)錯誤.");
|
| | | return false;
|
| | | }
|
| | | _pLog.Info("新增資料庫(OCSDB.SRI)成功!");
|
| | | Logger.Info("新增資料庫(OCSDB.SRI)成功!");
|
| | | }
|
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | Logger.Warn(e, e.Message);
|
| | | command.Dispose();
|
| | |
|
| | | if (command1 != null)
|
| | | command1.Dispose();
|
| | | command1?.Dispose();
|
| | |
|
| | | throw e;
|
| | | throw;
|
| | | }
|
| | |
|
| | | /** COMMIT的動作須連外面CCS的資料都正確輸入完才作 */
|
| | |
| | |
|
| | | private bool ProcessSingalCase(Object.EventRecord mRecord)
|
| | | {
|
| | | string sqlStmt;
|
| | | bool result = false;
|
| | | sqlStmt = "INSERT INTO EOS.EVENTS VALUES(" + mRecord.CaseId+ "," + CCSCaseState.WaitForDespatch + ",1,"
|
| | | + GlobalVariable.OriginalCase + ",0)";
|
| | | var result = false;
|
| | | var sqlStmt = "INSERT INTO EOS.EVENTS VALUES(" + mRecord.CaseId+ "," + CCSCaseState.WaitForDespatch + ",1,"
|
| | | + GlobalVariable.OriginalCase + ",0)";
|
| | |
|
| | | OracleCommand command = new OracleCommand(sqlStmt, _connectionTpc, _transaction);
|
| | |
|
| | |
| | | if (command.ExecuteNonQuery() > 0)
|
| | | result = true;
|
| | | else
|
| | | _pLog.Error("儲存資料時發生錯誤: 無法insert eos.events");
|
| | | Logger.Error("儲存資料時發生錯誤: 無法insert eos.events");
|
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | _pLog.Error("儲存資料時發生錯誤: 無法insert eos.events. Error = " + e.Message);
|
| | | Console.WriteLine(e.StackTrace);
|
| | | Logger.Error(e, "儲存資料時發生錯誤: 無法insert eos.events. Error = " + e.Message);
|
| | | }
|
| | | finally
|
| | | {
|
| | |
| | |
|
| | | private bool ProcessMergeCase(Object.EventRecord mRecord)
|
| | | {
|
| | | string sqlStmt;
|
| | | // insert eos.events
|
| | | sqlStmt = "INSERT INTO EOS.EVENTS VALUES(" + mRecord.CaseId+ "," + CCSCaseState.WaitForDespatch + ",1,"
|
| | | + GlobalVariable.ChildCase + ",0)";
|
| | | var sqlStmt = "INSERT INTO EOS.EVENTS VALUES(" + mRecord.CaseId+ "," + CCSCaseState.WaitForDespatch + ",1,"
|
| | | + GlobalVariable.ChildCase + ",0)";
|
| | |
|
| | | OracleCommand command = new OracleCommand(sqlStmt, _connectionTpc, _transaction);
|
| | |
|
| | |
| | | {
|
| | | if (command.ExecuteNonQuery() <= 0)
|
| | | {
|
| | | _pLog.Error("儲存資料時發生錯誤: 無法insert eos.events");
|
| | | Logger.Error("儲存資料時發生錯誤: 無法insert eos.events");
|
| | | command.Dispose();
|
| | | return false;
|
| | | }
|
| | |
| | | command.CommandText = sqlStmt;
|
| | | if (command.ExecuteNonQuery() <= 0)
|
| | | {
|
| | | _pLog.Error("儲存資料時發生錯誤: 無法insert eos.mergecase");
|
| | | Logger.Error("儲存資料時發生錯誤: 無法insert eos.mergecase");
|
| | | command.Dispose();
|
| | | return false;
|
| | | }
|
| | |
| | | command.CommandText = sqlStmt;
|
| | | if (command.ExecuteNonQuery() <= 0)
|
| | | {
|
| | | _pLog.Error("儲存資料時發生錯誤: 無法更改母案件資料");
|
| | | Logger.Error("儲存資料時發生錯誤: 無法更改母案件資料");
|
| | | command.Dispose();
|
| | | return false;
|
| | | }
|
| | |
| | | command.CommandText = sqlStmt;
|
| | | if (command.ExecuteNonQuery() <= 0)
|
| | | {
|
| | | _pLog.Error("儲存資料時發生錯誤: 無法update eos.eventrecord(FSC,UFID)");
|
| | | Logger.Error("儲存資料時發生錯誤: 無法update eos.eventrecord(FSC,UFID)");
|
| | | command.Dispose();
|
| | | return false;
|
| | | }
|
| | |
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | _pLog.Error("儲存資料時發生錯誤: " + e.Message);
|
| | | Console.WriteLine(e.StackTrace);
|
| | | Logger.Error(e, "儲存資料時發生錯誤: " + e.Message);
|
| | | command.Dispose();
|
| | | return false;
|
| | | }
|
| | |
| | | }
|
| | | catch (Exception)
|
| | | {
|
| | | _pLog.Error("無法判斷用戶種類.");
|
| | | Logger.Error("無法判斷用戶種類.");
|
| | | return false;
|
| | | }
|
| | | finally
|
| | |
| | | }
|
| | | catch (Exception)
|
| | | {
|
| | | _pLog.Error("無法確認是否需重新修改原始母案件之影響用戶資料.");
|
| | | Logger.Error("無法確認是否需重新修改原始母案件之影響用戶資料.");
|
| | | return false;
|
| | | }
|
| | | finally
|
| | |
| | | command1.CommandText = sqlStmt;
|
| | | if (command1.ExecuteNonQuery() < 0)
|
| | | {
|
| | | _pLog.Error("無法刪除原始案件的既有用戶資料.");
|
| | | Logger.Error("無法刪除原始案件的既有用戶資料.");
|
| | | command1.Dispose();
|
| | | return false;
|
| | | }
|
| | |
| | | command1.CommandText = sqlStmt;
|
| | | if (command1.ExecuteNonQuery() <= 0)
|
| | | {
|
| | | _pLog.Error("無法將原始案件的影響用戶數改為變壓器的全部用戶.");
|
| | | Logger.Error("無法將原始案件的影響用戶數改為變壓器的全部用戶.");
|
| | | command1.Dispose();
|
| | | return false;
|
| | | }
|
| | |
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | _pLog.Error("無法更新原始案件影響用戶資料: " + e.Message);
|
| | | Console.WriteLine(e.StackTrace);
|
| | | command1.Dispose();
|
| | | Logger.Error(e, "無法更新原始案件影響用戶資料: " + e.Message);
|
| | | command1?.Dispose();
|
| | | return false;
|
| | | }
|
| | | }
|
| | |
| | | OracleCommand command2 = new OracleCommand(sqlStmt, _connectionTpc, _transaction);
|
| | | if (command2.ExecuteNonQuery() < 0)
|
| | | {
|
| | | _pLog.Error("無法新增新受理案件的影響用戶資料.");
|
| | | Logger.Error("無法新增新受理案件的影響用戶資料.");
|
| | | command2.Dispose();
|
| | | return false;
|
| | | }
|
| | |
| | |
|
| | | private bool UpdateImportCase(Object.EventRecord mRecord)
|
| | | {
|
| | | string sqlStmt;
|
| | |
|
| | | /* 該案件不為交辦案件 */
|
| | | if (mRecord.ImportCase!= GlobalVariable.IsImportCase)
|
| | | {
|
| | |
| | | }
|
| | |
|
| | | /* 若母案件已為交辦案件,則不需再作任何更動 */
|
| | | sqlStmt = "SELECT IMPORTCASE FROM EOS.EVENTRECORD WHERE CASEID = " + mRecord.ParentId;
|
| | | var sqlStmt = "SELECT IMPORTCASE FROM EOS.EVENTRECORD WHERE CASEID = " + mRecord.ParentId;
|
| | | OracleCommand command = new OracleCommand(sqlStmt, _connectionTpc, _transaction);
|
| | | OracleDataReader reader = command.ExecuteReader();
|
| | |
|
| | |
| | | return true;
|
| | | }
|
| | | }
|
| | | catch (Exception)
|
| | | catch (Exception e)
|
| | | {
|
| | | _pLog.Error("無法取得母案件之等級.");
|
| | | Logger.Error(e, "無法取得母案件之等級." + e.Message);
|
| | | return false;
|
| | | }
|
| | | finally
|
| | |
| | | OracleCommand command1 = new OracleCommand(sqlStmt, _connectionTpc, _transaction);
|
| | | if (command1.ExecuteNonQuery() <= 0)
|
| | | {
|
| | | _pLog.Error("無法將交辦案件改為母案件.");
|
| | | Logger.Error("無法將交辦案件改為母案件.");
|
| | | command1.Dispose();
|
| | | return false;
|
| | | }
|
| | |
| | | command1.CommandText = sqlStmt;
|
| | | if (command1.ExecuteNonQuery() <= 0)
|
| | | {
|
| | | _pLog.Error("無法將母案件改為子案件.");
|
| | | Logger.Error("無法將母案件改為子案件.");
|
| | | command1.Dispose();
|
| | | return false;
|
| | | }
|
| | |
| | | command1.CommandText = sqlStmt;
|
| | | if (command1.ExecuteNonQuery() <= 0)
|
| | | {
|
| | | _pLog.Error("無法將原先該母案件下的子案件都改掛在交辦案件下.");
|
| | | Logger.Error("無法將原先該母案件下的子案件都改掛在交辦案件下.");
|
| | | command1.Dispose();
|
| | | return false;
|
| | | }
|
| | |
| | | command1.CommandText = sqlStmt;
|
| | | if (command1.ExecuteNonQuery() <= 0)
|
| | | {
|
| | | _pLog.Error("無法將已INSERT入EOS.MERGECASE內的交辦案件資料改為原先母案件的資料(CaseID,AcceptNum).");
|
| | | Logger.Error("無法將已INSERT入EOS.MERGECASE內的交辦案件資料改為原先母案件的資料(CaseID,AcceptNum).");
|
| | | command1.Dispose();
|
| | | return false;
|
| | | }
|
| | |
| | |
|
| | | private bool UpdateOtherTable(int oldCaseId, int newCaseId, string newAcceptNum)
|
| | | {
|
| | | string sqlStmt;
|
| | |
|
| | | sqlStmt = "SELECT CASESTATUS FROM EOS.EVENTS WHERE CASEID = " + oldCaseId;
|
| | | var sqlStmt = "SELECT CASESTATUS FROM EOS.EVENTS WHERE CASEID = " + oldCaseId;
|
| | | OracleCommand command = new OracleCommand(sqlStmt, _connectionTpc, _transaction);
|
| | | OracleDataReader reader = command.ExecuteReader();
|
| | |
|
| | |
| | | switch (_originCaseStatus)
|
| | | {
|
| | | case 0:
|
| | | _pLog.Error("找不到原始母案件之案件狀態.");
|
| | | Logger.Error("找不到原始母案件之案件狀態.");
|
| | | command.Dispose();
|
| | | return false;
|
| | |
|
| | |
| | | command.CommandText = sqlStmt;
|
| | | if (command.ExecuteNonQuery() < 0)
|
| | | {
|
| | | _pLog.Error("無法更新EOS.EVENTDESPATCH.");
|
| | | Logger.Error("無法更新EOS.EVENTDESPATCH.");
|
| | | command.Dispose();
|
| | | return false;
|
| | | }
|
| | |
| | | command.CommandText = sqlStmt;
|
| | | if (command.ExecuteNonQuery() < 0)
|
| | | {
|
| | | _pLog.Error("無法更新EOS.EVENTS.");
|
| | | Logger.Error("無法更新EOS.EVENTS.");
|
| | | command.Dispose();
|
| | | return false;
|
| | | }
|
| | |
| | | command.CommandText = sqlStmt;
|
| | | if (command.ExecuteNonQuery() <= 0)
|
| | | {
|
| | | _pLog.Error("無法更新EOS.Events的CaseStatus.");
|
| | | Logger.Error("無法更新EOS.Events的CaseStatus.");
|
| | | command.Dispose();
|
| | | return false;
|
| | | }
|
| | |
| | | command.CommandText = sqlStmt;
|
| | | if (command.ExecuteNonQuery() < 0)
|
| | | {
|
| | | _pLog.Error("無法更新OCSDB.SRI.");
|
| | | Logger.Error("無法更新OCSDB.SRI.");
|
| | | command.Dispose();
|
| | | return false;
|
| | | }
|
| | |
| | | command.CommandText = sqlStmt;
|
| | | if (command.ExecuteNonQuery() < 0)
|
| | | {
|
| | | _pLog.Error("無法更新EOS.EVENTFACILITY.");
|
| | | Logger.Error("無法更新EOS.EVENTFACILITY.");
|
| | | command.Dispose();
|
| | | return false;
|
| | | }
|
| | |
| | | command.CommandText = sqlStmt;
|
| | | if (command.ExecuteNonQuery() < 0)
|
| | | {
|
| | | _pLog.Error("無法更新EOS.CRTAPOLOGY.");
|
| | | Logger.Error("無法更新EOS.CRTAPOLOGY.");
|
| | | command.Dispose();
|
| | | return false;
|
| | | }
|
| | |
| | | command.CommandText = sqlStmt;
|
| | | if (command.ExecuteNonQuery() < 0)
|
| | | {
|
| | | _pLog.Error("無法更新EOS.EVENTAFFECT.");
|
| | | Logger.Error("無法更新EOS.EVENTAFFECT.");
|
| | | command.Dispose();
|
| | | return false;
|
| | | }
|
| | |
| | | // SqlStmt = "UPDATE EOS.VOICE SET CASEID = " + NewCaseID + " WHERE CASEID = " + OldCaseID;
|
| | |
|
| | | // if (CCS.GlobalVariable.Conn.UpdateDB(SqlStmt) < 0) {
|
| | | // _PLog.error("無法更新EOS.VOICE.");
|
| | | // Logger.error("無法更新EOS.VOICE.");
|
| | | // return false;
|
| | | // }
|
| | |
|
| | |
| | | command.CommandText = sqlStmt;
|
| | | if (command.ExecuteNonQuery() < 0)
|
| | | {
|
| | | _pLog.Error("無法更新OCSDB.LOCKFEATURE");
|
| | | Logger.Error("無法更新OCSDB.LOCKFEATURE");
|
| | | command.Dispose();
|
| | | return false;
|
| | | }
|
| | |
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | _pLog.Error(e.Message);
|
| | | Console.WriteLine(e.StackTrace);
|
| | | Logger.Error(e, e.Message);
|
| | | reader.Close();
|
| | | command.Dispose();
|
| | | return false;
|
| | |
| | |
|
| | | private bool UpdateRecuseOrder(Object.EventRecord mRecord)
|
| | | {
|
| | | string sqlStmt;
|
| | | int rank = 999;
|
| | | int priority = 1;
|
| | | OracleCommand command = null;
|
| | |
| | |
|
| | | try
|
| | | {
|
| | | string sqlStmt;
|
| | | if (_upLevel)
|
| | | {
|
| | | /* 將原先母案件的編號改為新的母案件編號 */
|
| | |
| | | command = new OracleCommand(sqlStmt, _connectionTpc, _transaction);
|
| | | if (command.ExecuteNonQuery() <= 0)
|
| | | {
|
| | | _pLog.Error("無法更新EOS.RESCUE_ORDER: 無法將原先母案件的編號改為新的母案件編號.");
|
| | | Logger.Error("無法更新EOS.RESCUE_ORDER: 無法將原先母案件的編號改為新的母案件編號.");
|
| | | command.Dispose();
|
| | | return false;
|
| | | }
|
| | |
| | | command.CommandText = sqlStmt;
|
| | | if (command.ExecuteNonQuery() < 0)
|
| | | {
|
| | | _pLog.Error("無法更新EOS.RESCUE_ORDER舊的搶修號碼.");
|
| | | Logger.Error("無法更新EOS.RESCUE_ORDER舊的搶修號碼.");
|
| | | command.Dispose();
|
| | | return false;
|
| | | }
|
| | |
| | | command.CommandText = sqlStmt;
|
| | | if (command.ExecuteNonQuery() <= 0)
|
| | | {
|
| | | _pLog.Error("無法新增EOS.RESCUE_ORDER的資料");
|
| | | Logger.Error("無法新增EOS.RESCUE_ORDER的資料");
|
| | | command.Dispose();
|
| | | return false;
|
| | | }
|
| | |
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | _pLog.Error("Problems occue during updating eos.rescue_order: " + e.Message);
|
| | | Console.WriteLine(e.StackTrace);
|
| | | Logger.Error(e, "Problems occue during updating eos.rescue_order: " + e.Message);
|
| | |
|
| | | if (command != null)
|
| | | command.Dispose();
|
| | |
| | | {
|
| | | reader.Close();
|
| | | command.Dispose();
|
| | | _pLog.Error("無法找到原先舊的案件.");
|
| | | Logger.Error("無法找到原先舊的案件.");
|
| | | return false;
|
| | | }
|
| | |
|
| | |
| | | command.CommandText = sqlStmt;
|
| | | if (command.ExecuteNonQuery() <= 0)
|
| | | {
|
| | | _pLog.Error("刪除原先舊的案件的EOS.EVENTS發生錯誤.");
|
| | | Logger.Error("刪除原先舊的案件的EOS.EVENTS發生錯誤.");
|
| | | command.Dispose();
|
| | | return false;
|
| | | }
|
| | |
| | | command.CommandText = sqlStmt;
|
| | | if (command.ExecuteNonQuery() <= 0)
|
| | | {
|
| | | _pLog.Error("刪除原先舊的案件的EOS.EVENTRECORD發生錯誤.");
|
| | | Logger.Error("刪除原先舊的案件的EOS.EVENTRECORD發生錯誤.");
|
| | | command.Dispose();
|
| | | return false;
|
| | | }
|
| | |
| | | command.CommandText = sqlStmt;
|
| | | if (command.ExecuteNonQuery() <= 0)
|
| | | {
|
| | | _pLog.Error("刪除原先舊的案件的EOS.EVENTRECORD_EX發生錯誤.");
|
| | | Logger.Error("刪除原先舊的案件的EOS.EVENTRECORD_EX發生錯誤.");
|
| | | command.Dispose();
|
| | | return false;
|
| | | }
|
| | |
| | | command.CommandText = sqlStmt;
|
| | | if (command.ExecuteNonQuery() < 0)
|
| | | {
|
| | | _pLog.Error("刪除原先舊的案件的EOS.TMPAFFECTCUSTMS發生錯誤.");
|
| | | Logger.Error("刪除原先舊的案件的EOS.TMPAFFECTCUSTMS發生錯誤.");
|
| | | command.Dispose();
|
| | | return false;
|
| | | }
|
| | |
| | | switch (Convert.ToInt32(reader["COUNT"].ToString()))
|
| | | {
|
| | | case 0:
|
| | | _pLog.Error("無法找到原先母案件下掛的子案件.");
|
| | | Logger.Error("無法找到原先母案件下掛的子案件.");
|
| | | reader.Close();
|
| | | command.Dispose();
|
| | | return false;
|
| | |
| | | command.CommandText = sqlStmt;
|
| | | if (command.ExecuteNonQuery() <= 0)
|
| | | {
|
| | | _pLog.Error("無法更新原先子案件(要提升為母案件)的資料.");
|
| | | Logger.Error("無法更新原先子案件(要提升為母案件)的資料.");
|
| | | reader.Close();
|
| | | command.Dispose();
|
| | | return false;
|
| | |
| | | command.CommandText = sqlStmt;
|
| | | if (command.ExecuteNonQuery() < 0)
|
| | | {
|
| | | _pLog.Error("無法刪除原先子案件(要提升為母案件)EOS.TMPAFFECTYCUSTMS的資料.");
|
| | | Logger.Error("無法刪除原先子案件(要提升為母案件)EOS.TMPAFFECTYCUSTMS的資料.");
|
| | | reader.Close();
|
| | | command.Dispose();
|
| | | return false;
|
| | |
| | | command.CommandText = sqlStmt;
|
| | | if (command.ExecuteNonQuery() < 0)
|
| | | {
|
| | | _pLog.Error("無法更新EOS.EVENTS的資料.");
|
| | | Logger.Error("無法更新EOS.EVENTS的資料.");
|
| | | reader.Close();
|
| | | command.Dispose();
|
| | | return false;
|
| | |
| | | {
|
| | | reader.Close();
|
| | | command.Dispose();
|
| | | _pLog.Error("無法找到原先母案件下掛的子案件.");
|
| | | Logger.Error("無法找到原先母案件下掛的子案件.");
|
| | | return false;
|
| | | }
|
| | | }
|
| | |
| | | command.CommandText = sqlStmt;
|
| | | if (command.ExecuteNonQuery() <= 0)
|
| | | {
|
| | | _pLog.Error("刪除EOS.MERGECASE發生錯誤");
|
| | | Logger.Error("刪除EOS.MERGECASE發生錯誤");
|
| | | command.Dispose();
|
| | | return false;
|
| | | }
|
| | |
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | _pLog.Error(e.Message);
|
| | | Console.WriteLine(e.StackTrace);
|
| | | Logger.Error(e, e.Message);
|
| | |
|
| | | if (command != null)
|
| | | command.Dispose();
|
| | |
| | |
|
| | | private bool InsertIntoSri(Object.EventRecord mRecord)
|
| | | {
|
| | | string sqlStmt;
|
| | | int count = 0;
|
| | | OracleCommand command = null;
|
| | | OracleDataReader reader = null;
|
| | |
|
| | | sqlStmt = "SELECT COUNT(*) as COUNT FROM OCSDB.SRI WHERE SCENENAME = '" + mRecord.AcceptNum+ "'";
|
| | | var sqlStmt = "SELECT COUNT(*) as COUNT FROM OCSDB.SRI WHERE SCENENAME = '" + mRecord.AcceptNum+ "'";
|
| | |
|
| | | try
|
| | | {
|
| | |
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | _pLog.Error("Problems occur when checking SCENE Data: " + e.Message);
|
| | | Console.WriteLine(e.StackTrace);
|
| | | Logger.Error(e, "Problems occur when checking SCENE Data: " + e.Message);
|
| | | return false;
|
| | | }
|
| | | finally
|
| | | {
|
| | | if (reader != null)
|
| | | reader.Close();
|
| | | reader?.Close();
|
| | | }
|
| | |
|
| | | if (count > 0)
|
| | |
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | Console.WriteLine(e.Message);
|
| | | Console.WriteLine(e.StackTrace);
|
| | | Logger.Warn(e, e.Message);
|
| | | }
|
| | | finally
|
| | | {
|
| | |
| | | // 電話資料過長
|
| | | if (mRecord.Tel.Trim().Length > 24)
|
| | | {
|
| | | _pLog.Warn("電話過長號碼,無法回存資料庫.");
|
| | | Logger.Warn("電話過長號碼,無法回存資料庫.");
|
| | | return true;
|
| | | }
|
| | |
|
| | |
| | | try
|
| | | {
|
| | | if (command.ExecuteNonQuery() <= 0)
|
| | | _pLog.Warn("無法將用戶電話回存回資料庫.");
|
| | | Logger.Warn("無法將用戶電話回存回資料庫.");
|
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | Console.WriteLine(e.Message);
|
| | | Console.WriteLine(e.StackTrace);
|
| | | Logger.Warn(e, e.Message);
|
| | | }
|
| | | finally
|
| | | {
|