예제 #1
0
        /// <summary>
        /// 依據卡機UID和M_Kind檢查是否存在於SAM主檔
        /// </summary>
        /// <param name="obDB">DB連線模組</param>
        /// <param name="uid">卡機UID(7 bytes=>14 hex string)</param>
        /// <param name="m_kind">卡片代別(default:21)</param>
        /// <returns>true:存在/false:不存在</returns>
        public bool Check_ReaderId_FromSAM_D(AL_DBModule obDB, string uid, string m_kind)
        {
            try
            {
                //判斷資料庫連線有無開啟
                if (obDB != null && obDB.ALCon.State != ConnectionState.Open)
                {
                    obDB.ALCon.Open();
                }
            }
            catch (SqlException ex)
            {
                Console.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
            {
                m_kind = String.IsNullOrEmpty(m_kind) ? "21" : m_kind;
                //檢查ReaderId('86' + uid)是否存在於SAM主檔
                //operate_SAM_D.Exist_ReaderId(uid, out sSql, out SqlParamSet, m_kind);
                this.Operate_SAM_D.Exist_OSN(uid, out sSql, out SqlParamSet, m_kind);

                string result = obDB.SqlExecuteScalarHasParams(sSql, SqlParamSet);
                return((result == "0" || result == "") ? false : true);
            }
            catch (SqlException sqlEx)
            {
                if (IsDebugWriteLine)
                {
                    Debug.WriteLine("[Shipment][Check_ReaderId_FromSAM_D]Sql Error:" + sqlEx.Message);
                }
                throw sqlEx;
            }
            catch (Exception ex)
            {
                if (IsDebugWriteLine)
                {
                    Debug.WriteLine("[Shipment][Check_ReaderId_FromSAM_D]Error:" + ex.Message);
                }
                throw ex;
            }
            finally
            {
                //operate_SAM_D = null;
                Array.Resize(ref SqlParamSet, 0);
            }
        }
예제 #2
0
        /// <summary>
        /// 依據卡機ReaderId檢查是否存在於Reader主檔
        /// </summary>
        /// <param name="obDB">DB連線模組</param>
        /// <param name="readerId">卡機ReaderId(14 hex string)</param>
        /// <returns>true:存在/false:不存在</returns>
        protected bool Check_ReaderId_FromReader_D(AL_DBModule obDB, string readerId)
        {
            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)是否存在於SAM主檔
                //operate_Reader_D.Exist_ReaderId(readerId, out sSql, out SqlParamSet);
                this.Operate_Reader_D.Exist_ReaderId(readerId, out sSql, out SqlParamSet);
                string result = obDB.SqlExecuteScalarHasParams(sSql, SqlParamSet);
                return((result == "0" || result == "") ? false : true);
            }
            catch (SqlException sqlEx)
            {
                if (IsDebugWriteLine)
                {
                    Debug.WriteLine("[Shipment][Check_ReaderId_FromReader_D]Sql Error:" + sqlEx.Message);
                }
                throw sqlEx;
            }
            catch (Exception ex)
            {
                if (IsDebugWriteLine)
                {
                    Debug.WriteLine("[Shipment][Check_ReaderId_FromReader_D]Error:" + ex.Message);
                }
                throw ex;
            }
            finally
            {
                //operate_Reader_D = null;
                Array.Resize(ref SqlParamSet, 0);
            }
        }
예제 #3
0
        /// <summary>
        /// 依據卡機UID和M_Kind檢查是否存在於SAM主檔
        /// </summary>
        /// <param name="obDB">DB連線模組</param>
        /// <param name="uid">卡機UID(7 bytes=>14 hex string)</param>
        /// <param name="m_kind">卡片代別(default:21)</param>
        /// <returns>true:存在/false:不存在</returns>
        public bool Check_ReaderId_FromSAM_D(AL_DBModule obDB,string uid,string m_kind)
        {
            try
            {
                //判斷資料庫連線有無開啟
                if (obDB != null && obDB.ALCon.State != ConnectionState.Open)
                {
                    obDB.ALCon.Open();
                }
            }
            catch (SqlException ex)
            {
                Console.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
            {
                m_kind = String.IsNullOrEmpty(m_kind) ? "21" : m_kind;
                //檢查ReaderId('86' + uid)是否存在於SAM主檔
                //operate_SAM_D.Exist_ReaderId(uid, out sSql, out SqlParamSet, m_kind);
                this.Operate_SAM_D.Exist_OSN(uid, out sSql, out SqlParamSet, m_kind);

                string result = obDB.SqlExecuteScalarHasParams(sSql, SqlParamSet);
                return (result == "0" || result == "") ? false : true;

            }
            catch (SqlException sqlEx)
            {
                if (IsDebugWriteLine)
                {
                    Debug.WriteLine("[Shipment][Check_ReaderId_FromSAM_D]Sql Error:" + sqlEx.Message);
                }
                throw sqlEx;
            }
            catch (Exception ex)
            {
                if (IsDebugWriteLine)
                {
                    Debug.WriteLine("[Shipment][Check_ReaderId_FromSAM_D]Error:" + ex.Message);
                }
                throw ex;
            }
            finally
            {
                //operate_SAM_D = null;
                Array.Resize(ref SqlParamSet, 0);
            }
        }
예제 #4
0
        /// <summary>
        /// 依據卡機ReaderId檢查是否存在於Reader主檔
        /// </summary>
        /// <param name="obDB">DB連線模組</param>
        /// <param name="readerId">卡機ReaderId(14 hex string)</param>
        /// <returns>true:存在/false:不存在</returns>
        protected bool Check_ReaderId_FromReader_D(AL_DBModule obDB, string readerId)
        {
            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)是否存在於SAM主檔
                //operate_Reader_D.Exist_ReaderId(readerId, out sSql, out SqlParamSet);
                this.Operate_Reader_D.Exist_ReaderId(readerId, out sSql, out SqlParamSet);
                string result = obDB.SqlExecuteScalarHasParams(sSql, SqlParamSet);
                return (result == "0" || result == "") ? false : true;

            }
            catch (SqlException sqlEx)
            {
                if (IsDebugWriteLine)
                {
                    Debug.WriteLine("[Shipment][Check_ReaderId_FromReader_D]Sql Error:" + sqlEx.Message);
                }
                throw sqlEx;
            }
            catch (Exception ex)
            {
                if (IsDebugWriteLine)
                {
                    Debug.WriteLine("[Shipment][Check_ReaderId_FromReader_D]Error:" + ex.Message);
                }
                throw ex;
            }
            finally
            {
                //operate_Reader_D = null;
                Array.Resize(ref SqlParamSet, 0);
            }
        }