升龙物业 老版本 ocx IPO, 加密狗 转值班电话

Config.cpp 2.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #include "StdAfx.h"
  2. #include "Config.h"
  3. CString CConfig::m_LogFilePath = __T("");
  4. CString CConfig::m_CtiIp = _T("127.0.0.1");
  5. int CConfig::m_CtiPort = CTI_LISTEN_PORT;
  6. int CConfig::m_ListenPort = ACD_LISTEN_PORT;
  7. UINT CConfig::m_PostProcessingTime = 0;
  8. int CConfig::m_AgentLockedPeriod = 15;
  9. CArray<CString, LPCTSTR> CConfig::m_CallPrefixList;
  10. CConfig::CConfig(void)
  11. {
  12. }
  13. /*****************************************************************
  14. **【函数名称】 load
  15. **【函数功能】 读取所有配置
  16. **【参数】
  17. **【返回值】 成功true,失败false
  18. ****************************************************************/
  19. bool CConfig::load()
  20. {
  21. IOtlConnection* pConn = IOtlConnection::getInstance();
  22. // 读取日志文件路径
  23. m_LogFilePath = pConn->GetSingleDataStr(_T("SELECT value FROM conf_system WHERE name = 'LogPath'"));
  24. // SOCKET参数
  25. m_CtiIp = pConn->GetSingleDataStr(_T("SELECT value FROM conf_system WHERE name = 'CtiAddr'"));
  26. m_CtiPort = pConn->GetSingleDataStr2Int(_T("SELECT value FROM conf_system WHERE name = 'CtiPort'"));
  27. m_ListenPort = pConn->GetSingleDataStr2Int(_T("SELECT value FROM conf_system WHERE name = 'AcdPort'"));
  28. // 业务参数
  29. m_AgentLockedPeriod = pConn->GetSingleDataStr2Int(_T("SELECT value FROM conf_system WHERE name = 'AgentLockedPeriod'"));
  30. m_PostProcessingTime = pConn->GetSingleDataStr2Int(_T("SELECT value FROM conf_system WHERE name = 'PPTime'"));
  31. IOtlRecordset* pMatchRcd = pConn->QueryRecords(_T("SELECT prefix FROM conf_trunk_match"));
  32. if (NULL == pMatchRcd)
  33. return false;
  34. int Prefix = 0;
  35. while(!pMatchRcd->IsEOF())
  36. {
  37. pMatchRcd->MoveNextRow();
  38. m_CallPrefixList.Add(pMatchRcd->GetValueStrByIndex(1));
  39. } // end while
  40. IOtlRecordset::DestroyInstance(pMatchRcd); // 释放记录集
  41. return true;
  42. }
  43. /*****************************************************************
  44. **【函数名称】 isMatchCallPrefix
  45. **【函数功能】 是否匹配呼叫字冠
  46. **【参数】
  47. **【返回值】 成功true,失败false
  48. ****************************************************************/
  49. bool CConfig::isMatchCallPrefix( const CString& CalleeNum )
  50. {
  51. for(int i = 0; i < m_CallPrefixList.GetCount(); ++i)
  52. {
  53. const CString& Prefix = m_CallPrefixList[i];
  54. if(Prefix == CalleeNum.Left(Prefix.GetLength()))
  55. return true;
  56. }
  57. return false;
  58. }