/// <summary> /// 依據uid(osn)將SAM主檔的Row data備份到SAMDIFF_D表格 /// </summary> /// <param name="obDB"></param> /// <param name="uid">SAM UID(14 hex string)</param> /// <returns>true:新增成功/false:新增數據無變動</returns> protected bool Copy_SAM_D_To_SAMDIFF(AL_DBModule obDB, string uid) { try { //判斷資料庫連線有無開啟 if (obDB != null && obDB.ALCon.State != ConnectionState.Open) { obDB.ALCon.Open(); } } catch (SqlException ex) { Debug.WriteLine(ex); throw ex; } catch (Exception ex) { throw ex; } //SqlMod_Chk_Bkl BkL = new SqlMod_Chk_Bkl();//產生sql指令 //Sql_Getter_SAM_D operate_SAM_D = new Sql_Getter_SAM_D(); SqlParameter[] SqlParamSet = null; String sSql; //查詢SQL try { //依據uid(osn)將SAM主檔的Row data備份到SAMDIFF_D表格 //operate_SAM_D.Insert_To_SAMDIFF_D(uid, out sSql, out SqlParamSet,"21"); this.Operate_SAM_D.Insert_To_SAMDIFF_D(uid, out sSql, out SqlParamSet, "21"); string result = obDB.SqlExec1(sSql, SqlParamSet); if (IsDebugWriteLine) { Debug.WriteLine("Result:" + ((result == "1") ? "Success" : "NoneChange")); } return((result == "1") ? true : false); } catch (SqlException sqlEx) { if (IsDebugWriteLine) { Debug.WriteLine("[Shipment][Copy_SAM_D_To_SADDIFF]Sql Error:" + sqlEx.Message); } throw sqlEx; } catch (Exception ex) { if (IsDebugWriteLine) { Debug.WriteLine("[Shipment][Copy_SAM_D_To_SADDIFF]Error:" + ex.Message); } throw ex; } finally { //operate_SAM_D = null; Array.Resize(ref SqlParamSet, 0); } }
/// <summary> /// 依據OSN來刪除SAM主檔一筆Row data /// </summary> /// <param name="obDB">DB連線模組</param> /// <param name="uid">SAM UID</param> protected void Delete_SAM_D(AL_DBModule obDB, string uid) { try { //判斷資料庫連線有無開啟 if (obDB != null && obDB.ALCon.State != ConnectionState.Open) { obDB.ALCon.Open(); } } catch (SqlException ex) { Debug.WriteLine(ex); throw ex; } catch (Exception ex) { throw ex; } //Sql_Getter_SAM_D operate_SAM_D = new Sql_Getter_SAM_D();//產生sql指令 SqlParameter[] SqlParamSet = null; String sSql; //查詢SQL try { //依據uid(osn)將SAM主檔的Row data刪除 //operate_SAM_D.Delete(uid, out sSql, out SqlParamSet); this.Operate_SAM_D.Delete(uid, out sSql, out SqlParamSet); string result = obDB.SqlExec1(sSql, SqlParamSet); if (IsDebugWriteLine) { Debug.WriteLine("Result:" + ((result == "1") ? "Success" : "NoneChange")); } //return (result == "1") ? true : false; } catch (SqlException sqlEx) { if (IsDebugWriteLine) { Debug.WriteLine("[Shipment][Delete_SAM_D]Sql Error:" + sqlEx.Message); } throw sqlEx; } catch (Exception ex) { if (IsDebugWriteLine) { Debug.WriteLine("[Shipment][Delete_SAM_D]Error:" + ex.Message); } throw ex; } finally { //operate_SAM_D = null; Array.Resize(ref SqlParamSet, 0); } }
/// <summary> /// 依據ReaderId 新增Reader主檔 /// SAM uid(14 hex string), deviceId(16 bytes) /// 取得更新Reader主檔的SQL參數和命令 /// </summary> /// <param name="obDB">DB連線模組</param> /// <param name="uid">SAM uid(14 hex string)</param> /// <param name="deviceId">deviceId(16 bytes)</param> /// <returns>true:新增成功/false:新增後數據無變動</returns> protected bool Insert_FromReader_D(AL_DBModule obDB, string uid, string deviceId) { try { //判斷資料庫連線有無開啟 if (obDB != null && obDB.ALCon.State != ConnectionState.Open) { obDB.ALCon.Open(); } } catch (SqlException ex) { Debug.WriteLine(ex); throw ex; } catch (Exception ex) { throw ex; } //Sql_Getter_Reader_D operate_Reader_D = new Sql_Getter_Reader_D();//產生sql指令 SqlParameter[] SqlParamSet = null; String sSql; //查詢SQL try { //依據ReaderId('86' + uid)新增Reader主檔 //operate_Reader_D.Insert(uid, deviceId, out sSql, out SqlParamSet); this.Operate_Reader_D.Insert(uid, deviceId, out sSql, out SqlParamSet); string result = obDB.SqlExec1(sSql, SqlParamSet); if (IsDebugWriteLine) { Debug.WriteLine("Result:" + ((result == "1") ? "Success" : "NoneChange")); } return((result == "1") ? true : false); } catch (SqlException sqlEx) { if (IsDebugWriteLine) { Debug.WriteLine("[Shipment][Insert_FromReader_D]Sql Error:" + sqlEx.Message); } throw sqlEx; } catch (Exception ex) { if (IsDebugWriteLine) { Debug.WriteLine("[Shipment][Insert_FromReader_D]Error:" + ex.Message); } throw ex; } finally { //operate_Reader_D = null; Array.Resize(ref SqlParamSet, 0); } }
/// <summary> /// 依據ReaderId 更新Reader主檔(需有顧客識別符號與reader_type, null=>default value) /// 資料物件必須有資料的欄位(READER_ID,READER_TYPE,READER_STS,TERMINAL_PSN,SAM_ID,SH_DATE,UPT_DATE,UPT_TIME,READER_ID) /// 取得更新Reader主檔的SQL參數和命令 /// </summary> /// <param name="obDB">DB連線模組</param> /// <param name="uid">SAM uid(14 hex string)</param> /// <param name="deviceId">deviceId(16 bytes)</param> /// <param name="reader_type">卡機種別, 00:沒卡機、01:NEC R6 卡機、02:MPG/CRF 卡機、03:CASTLES/V5s 卡機</param> /// <param name="merc_flg">顧客識別符號, ex:"SET"</param> /// <returns>true:更新成功/false:更新後數據無變動</returns> protected bool Update_FromReader_D(AL_DBModule obDB, string uid, string deviceId, string reader_type, string merc_flg) { try { //判斷資料庫連線有無開啟 if (obDB != null && obDB.ALCon.State != ConnectionState.Open) { obDB.ALCon.Open(); } } catch (SqlException ex) { Debug.WriteLine(ex); throw ex; } catch (Exception ex) { throw ex; } //Sql_Getter_Reader_D operate_Reader_D = new Sql_Getter_Reader_D();//產生sql指令 SqlParameter[] SqlParamSet = null; String sSql; //查詢SQL try { //依據ReaderId('86' + uid)更新Reader主檔 this.Operate_Reader_D.Update(uid, deviceId, out sSql, out SqlParamSet, reader_type, merc_flg); string result = obDB.SqlExec1(sSql, SqlParamSet); //if (IsDebugWriteLine) //{ // Debug.WriteLine("Result:" + ((result == "1") ? "Success" : "NoneChange")); //} return (result == "1") ? true : false; } catch (SqlException sqlEx) { if (IsDebugWriteLine) { Debug.WriteLine("[Shipment][Update_FromReader_D]Sql Error:" + sqlEx.Message); } throw sqlEx; } catch (Exception ex) { if (IsDebugWriteLine) { Debug.WriteLine("[Shipment][Update_FromReader_D]Error:" + ex.Message); } throw ex; } finally { //operate_Reader_D = null; Array.Resize(ref SqlParamSet, 0); } }
/// <summary> /// 依據uid來新增一筆資料到SAM_D表格 /// </summary> /// <param name="obDB">DB模組</param> /// <param name="uid">SAM UID(OSN)7 bytes</param> protected void Insert_SAM_D(AL_DBModule obDB, string uid) { try { //判斷資料庫連線有無開啟 if (obDB != null && obDB.ALCon.State != ConnectionState.Open) { obDB.ALCon.Open(); } } catch (SqlException ex) { Debug.WriteLine(ex); throw ex; } catch (Exception ex) { throw ex; } //Sql_Getter_SAM_D operate_SAM_D = new Sql_Getter_SAM_D();//產生sql指令 SqlParameter[] SqlParamSet = null; String sSql; //查詢SQL try { //依據uid(osn)將SAM主檔的Row data刪除 //operate_SAM_D.Insert(uid, out sSql, out SqlParamSet); this.Operate_SAM_D.Insert(uid, out sSql, out SqlParamSet); string result = obDB.SqlExec1(sSql, SqlParamSet); if (IsDebugWriteLine) { Debug.WriteLine("Result:" + ((result == "1") ? "Success" : "NoneChange")); } //return (result == "1") ? true : false; } catch (SqlException sqlEx) { if (IsDebugWriteLine) { Debug.WriteLine("[Shipment][Insert_SAM_D]Sql Error:" + sqlEx.Message); } throw sqlEx; } catch (Exception ex) { if (IsDebugWriteLine) { Debug.WriteLine("[Shipment][Insert_SAM_D]Error:" + ex.Message); } throw ex; } finally { //operate_SAM_D = null; Array.Resize(ref SqlParamSet, 0); } }