/// <summary>
        /// Validate length of required tokens that was present in the received ICOMS Message
        /// </summary>
        /// <param name="objdic"></param>
        /// <param name="str4LookUp"></param>
        /// <returns></returns>
        public string checkRequiredLengthOfTokens(Dictionary<string, string> objdic, ServiceListenerMembers templistenerMembers)
        {
            logger.Info("ServiceBusinessRulesManager::checkRequiredLengthOfTokens() called");

            string strErrCode = string.Empty;
            string strSiteTokenName = templistenerMembers.siteIdTokenName;

            logger.Info(string.Format("ServiceBusinessRulesManager::checkRequiredLengthOfTokens :: siteId TokenName is {0}", strSiteTokenName));

            foreach (KeyValuePair<string, string> pair in objdic)
            {
                using(ServiceTranslationManager trMgr=new ServiceTranslationManager())
                {
                    // Get relavent error code if any mismatch in token length
                    logger.Info(string.Format("ServiceBusinessRulesManager::checkRequiredLengthOfTokens :: Checking length for token \"{0}\" ", pair.ToString()));
                    if (pair.Key.Equals(strSiteTokenName))continue;
                    strErrCode = trMgr.getErrorCode4lengthOfTokens(pair);
                    if (strErrCode != string.Empty)
                    {
                        logger.Info("ServiceBusinessRulesManager::checkRequiredLengthOfTokens() failed");
                        return strErrCode;
                    }
                }

            }
            logger.Info("ServiceBusinessRulesManager::checkRequiredLengthOfTokens() success");
            return string.Empty;
        }
        public void Test_AddSiteId2CustId()
        {
            ServiceBusinessRulesManager bm = new ServiceBusinessRulesManager();
            ServiceListenerMembers listMem = new ServiceListenerMembers();
            Dictionary<String, String> testData = new Dictionary<string, string>();
            Dictionary<String, String> expData = bm.AddSiteId2CustId(testData, listMem);

            Assert.IsInstanceOf(typeof(Dictionary<String, String>), expData, "Method does not return correct Object Type");
        }
        public void Test_getDataFor4cInterface()
        {
            ServiceTranslationManager transMngr = new ServiceTranslationManager();
            ServiceListenerMembers testListenMember = new ServiceListenerMembers();
            testListenMember.siteIdTokenName = "SI:";
            String InputData = "I000CUI,TI:000000000000000000,AN:010203040,SI:013,HE:C3,ND:B4567,BD:05,TL:Mrs ,LN:Customer       ,FN:Test      ,MI:E,A1:222 Avenue St.                  ,A2:Apt#123                         ,CT:Greensburg               ,ST:PA,ZP:12345    ,HP:213 123 1234,WP:215 123 1234,AS:A,E1:ENG000102030405.00039V000CUI,0000000,TI:000000000000000000.select LastName from Subscriber where SmsTag='013010203040'CUSTOMERselect FirstName from Subscriber where SmsTag='013010203040'TEST";

            Assert.IsInstanceOf(typeof(Dictionary<String, String>), transMngr.getDataFor4cInterface(InputData, ServiceConstantsManager.CONST_CUI, testListenMember), "Invalid data returned");
            Dictionary<String, String> expData = transMngr.getDataFor4cInterface(InputData, ServiceConstantsManager.CONST_CUI, testListenMember);
            Assert.AreEqual(expData.Count, ServiceConstantsManager.CONST_CUI.Length, "Data count is not valid");
        }
        public void Test_processCCIMessage_InvInput()
        {
            ServiceRunTimeManager srtMngr = new ServiceRunTimeManager();
            ServiceListenerMembers listMem = new ServiceListenerMembers();
            listMem.siteid = "siteid1";
            listMem.listenerAddress = "10.203.232.19";

            listMem.CustomerIdFlag = "true";

            listMem.listenerPort = "12000";

            String testData = "I000CUI,TI:000000000000000000,AN:010203040,SI:013,HE:C3,ND:B4567,BD:05,TL:Mrs ,LN:Customer       ,FN:Test      ,MI:E,A1:222 Avenue St.                  ,A2:Apt#123                         ,CT:Greensburg               ,ST:PA,ZP:12345    ,HP:213 123 1234,WP:215 123 1234,AS:A,E1:ENG000102030405.00039V000CUI,0000000,TI:000000000000000000.select LastName from Subscriber where SmsTag='013010203040'CUSTOMERselect FirstName from Subscriber where SmsTag='013010203040'TEST";
            String expData = "0000116";
            String resp = srtMngr.processCCIMessage(testData, listMem);
            Assert.AreEqual(expData, resp, "CCI Message is not processed correctly. Response [" + resp + "]");
        }
        /// <summary>
        /// Load site id,listeners,port,unit address,customer flag from configuration XML file in to object of ICOMSListenerMembers
        /// </summary> 
        public bool getAllListernsList()
        {
            try
            {
                logger.Info("ServiceConfigurationManager::getAllListernsList() called");
                XmlNodeList xnNodeList;
                ServiceListenerMembers[] lstMem;
                xnNodeList = xmlDoc.SelectNodes("/serviceconfiguration/sites/site");

                lstMem = new ServiceListenerMembers[xnNodeList.Count];
                int i = 0;
                foreach (XmlNode xn in xnNodeList)
                {
                    ServiceListenerMembers lstMemlst = new ServiceListenerMembers();
                    lstMemlst.siteid = xn.Attributes["id"].Value;
                    lstMemlst.siteIdTokenName = xn["TokenName4SiteId"].InnerText + ":";
                    lstMemlst.listenerAddress = xn["listenerAddress"].InnerText;
                    lstMemlst.listenerPort = xn["listenerPort"].InnerText;
                    lstMemlst.CustomerIdFlag = xn["CustomerIdFlag"].InnerText;
                    lstMemlst.DeviceIdFormat = xn["DeviceIdFormat"].InnerText;
                    lstMemlst.NativeFormat4cFlag = xn["NativeFormat4cFlag"].InnerText;
                    lstMem.SetValue(lstMemlst,i);
                    i++;
                }
                if (lstMem.Length > 0)
                {
                    _CRMSiteDetails = lstMem;
                    logger.Info(string.Format("{0} Site(s) information was loaded successfully from service config file", lstMem.Length));
                    return true;
                }
                else
                {
                    _CRMSiteDetails = null;
                    logger.Error(" No Site(s) information found to loaded from service config file");
                    return false;
                }

            }
            catch (Exception ex)
            {
                logger.Error(string.Format("getAllListernsList(): Exception: {0}", ex.Message));
                logger.Error("ServiceConfigurationManager::Error while loading Site List from configuration file. Please correct site details from config file");
                return false;
            }
        }
        public void Test_AddSiteId2CustId_FalseValue()
        {
            ServiceBusinessRulesManager bm = new ServiceBusinessRulesManager();
            ServiceListenerMembers listMem = new ServiceListenerMembers();
            listMem.siteid = "siteid1";
            listMem.listenerAddress = "10.203.232.19";

            listMem.CustomerIdFlag = "false";

            listMem.listenerPort = "12000";

            Dictionary<String, String> testData = new Dictionary<string, string>();
            testData.Add("AN:", "010203040");
            testData.Add("AS:", "A");
            testData.Add("SI:", "013");
            testData.Add("TI:", "000000000000000000");

            Dictionary<String, String> expData = bm.AddSiteId2CustId(testData, listMem);

            Assert.IsFalse(expData.ContainsValue("010203040013"), "Site ID should not be added to Customer ID");
        }
        public void Test_processCCIMessage()
        {
            ServiceRunTimeManager srtMngr = new ServiceRunTimeManager();
            ServiceListenerMembers listMem = new ServiceListenerMembers();
            listMem.siteid = "siteid1";
            listMem.listenerAddress = "10.203.232.19";

            listMem.CustomerIdFlag = "true";

            listMem.listenerPort = "12000";

            String testData = "I000CCI,TI:000000000000000000,AN:010203040,SI:013,CA:AB,CL:000000995,CP:0000000.00039V000CCI,0000000,TI:000000000000000000.select CreditLimit from Subscriber where SmsTag='013010203040'995";
            String expData_Success = "0000000";
            String expData_Fail = "0000901";
            String resp = srtMngr.processCCIMessage(testData, listMem);
            if (resp.Equals(expData_Success) || resp.Equals(expData_Fail))
            {
                Assert.Pass("CCI Message is processed correctly");
            }
            else
            {
                Assert.Fail("CCI Message is not processed correctly. Response [" + resp+"]");
            }
        }
        /// <summary>
        /// Add site ID into Customer Id based on CustomerIdFlag value specified in configuration xml
        /// </summary>x
        /// <param name="objdic"></param>
        /// <param name="objLSMem"></param>
        /// <returns></returns>
        public Dictionary<string, string> AddSiteId2CustId(Dictionary<string, string> objdic, ServiceListenerMembers objLSMem)
        {
            logger.Info("ServiceBusinessRulesManager::AddSiteId2CustId() called");
            if (Convert.ToBoolean(objLSMem.CustomerIdFlag) == true)
            {

                logger.Info(string.Format("ServiceBusinessRulesManager::AddSiteId2CustId:: Recieved SiteId {0}", objdic[objLSMem.siteIdTokenName]));

                if (objdic[objLSMem.siteIdTokenName].Length < 3)
                {
                    objdic["AN:"] = objdic[objLSMem.siteIdTokenName].PadRight(3, '0')  + objdic["AN:"];
                    logger.Info(string.Format("ServiceBusinessRulesManager::AddSiteId2CustId:: SiteId added after padding(appending character '0') is {0}", objdic[objLSMem.siteIdTokenName].PadRight(3, '0')));
                }
                else
                {
                    objdic["AN:"] = objdic[objLSMem.siteIdTokenName].Substring(0, 3) + objdic["AN:"];
                    logger.Info(string.Format("ServiceBusinessRulesManager::AddSiteId2CustId:: SiteId added after truncating(3 left most characters) is {0}", objdic[objLSMem.siteIdTokenName].Substring(0, 3)));
                }

                //objdic["AN:"] = objdic["AN:"] + objdic["SI:"];
                logger.Info(string.Format("ServiceBusinessRulesManager::AddSiteId2CustId():: Account number(AN+{0}) created as {1}",objLSMem.siteIdTokenName, objdic["AN:"]));
            }
            return objdic;
        }
        public void Test_processEQIMessage()
        {
            ServiceRunTimeManager srtMngr = new ServiceRunTimeManager();
            ServiceListenerMembers listMem = new ServiceListenerMembers();
            listMem.siteid = "siteid1";
            listMem.listenerAddress = "10.203.232.19";

            listMem.CustomerIdFlag = "true";

            listMem.listenerPort = "12000";

            String testData = "I000EQI,TI:000000000000000000,AN:010203040,SI:013,ES:A,EA:00002986685930000000000000000000,S#:ABC45678901234567890123456789012,PA:ABCDEFGH,SV:0001234/0001236/0001237,AC:A,0000257,TI:000000000000000000.select * from Settop where MacAddr='000011cd5231'<empty>";
            String expData_Success = "0000000";
            String expData_Fail = "0000901";
            String resp = srtMngr.processEQIMessage(testData, listMem);
            if (resp.Equals(expData_Success) || resp.Equals(expData_Fail))
            {
                Assert.Pass("EQI Message is processed correctly");
            }
            else
            {
                Assert.Fail("EQI Message is not processed correctly. Response [" + resp + "]");
            }
        }
        public void Test_processCUIMessage_InvInput()
        {
            ServiceRunTimeManager srtMngr = new ServiceRunTimeManager();
            ServiceListenerMembers listMem = new ServiceListenerMembers();
            listMem.siteid = "siteid1";
            listMem.listenerAddress = "10.203.232.19";

            listMem.CustomerIdFlag = "true";

            listMem.listenerPort = "12000";

            String testData = "I000CCI,TI:000000000000000000,AN:010203040,SI:013,CA:AB,CL:000000995,CP:0000000.00039V000CCI,0000000,TI:000000000000000000.select CreditLimit from Subscriber where SmsTag='013010203040'995";
            String expData = "0000114";
            String resp = srtMngr.processCUIMessage(testData, listMem);
            Assert.AreEqual(expData, resp, "CUI Message is not processed correctly. Response [" + resp + "]");
        }
        /// <summary>
        /// Process ICOMS CUI messages. Messages will be translated in required format to invoke CRM 4c Rest Interface.
        /// </summary>
        /// <param name="strICOMS_CUI_Msg"></param>
        /// <param name="templistenerMembers"></param>
        /// <returns></returns>
        public string processCUIMessage(string strICOMS_CUI_Msg, ServiceListenerMembers templistenerMembers)
        {
            Dictionary<string, string> dictObj4c = new Dictionary<string, string>();
             SyncRequest objSyncReq;
             ServiceTranslationManager trsMgr;
             ServiceBusinessRulesManager busMgr;
             string retMsg2ICOM = "0000901";
             string strResMainFormat=string.Empty;
             string strErrCode = string.Empty;
             trsMgr = new ServiceTranslationManager();
             string[] arrConfigSiteIdName=new string[2];

             try
             {

               logger.Info("ServiceRunTimeManager::processCUIMessage() called");

               busMgr = new ServiceBusinessRulesManager();

               // Create dictionary object with all required tokens(key-value) for CUI
               dictObj4c = trsMgr.getDataFor4cInterface(strICOMS_CUI_Msg, ServiceConstantsManager.CONST_CUI, templistenerMembers);

               logger.Info(string.Format("Required tokens are extracted from CUI message...  {0}", trsMgr.GetLine(dictObj4c)));

               // Validation for missing tokens
               strErrCode = busMgr.checkRequiredTokensPresent(dictObj4c, ServiceConstantsManager.CONST_CUI);
               if (strErrCode != string.Empty)
               {
               logger.Error(string.Format("Please verify all required tokens are present in the CUI message. Required Tokens... \"{0}\"", string.Join(",", ServiceConstantsManager.CONST_CUI)));
               return strErrCode;
               }

               // Validation for token length
               strErrCode = busMgr.checkRequiredLengthOfTokens(dictObj4c,templistenerMembers);
               if (strErrCode != string.Empty)
               {
               logger.Error(string.Format("Length is not matching for one of tokens present in the CUI message(): {0}", string.Join(",", ServiceConstantsManager.CONST_CUI)));
               return strErrCode;
               }

               // update Customerid(AN=AN+SI) based on flag value in config value
               dictObj4c = busMgr.AddSiteId2CustId(dictObj4c, templistenerMembers);

               objSyncReq = new SyncRequest();
               objSyncReq.CustomerId = dictObj4c["AN:"];
               objSyncReq.CustomerStatus = dictObj4c["AS:"];
               objSyncReq.ICOMSMsgFormat = "CUI";

               CustomerInformationRequest crmreq = new CustomerInformationRequest(objSyncReq, objSyncReq);
               // Perform Add customer
               retMsg2ICOM = crmreq.AddCustomer();

               // Get success/failure error code to send to ICOMS
               retMsg2ICOM = transalteResCode2ICOM4m4C(retMsg2ICOM, "AddCustomer");

               logger.Info(string.Format("ServiceRunTimeManager::processCUIMessage() returning value {0}", retMsg2ICOM));
               return retMsg2ICOM;
             }
             catch (Exception ex)
             {
             logger.Error(string.Format("processCUIMessage(): Exception: {0}", ex.Message));
             logger.Error("ServiceRunTimeManager::processCUIMessage() returning error");
             return "0000901";
             }
        }
        /// <summary>
        ///  Process ICOMS input messages based on type CUI/CCI/EQI.
        /// </summary>
        /// <param name="strICOMS_input_Msg"></param>
        /// <param name="templistenerMembers"></param>
        /// <returns></returns>
        public string processICOMSMessages(string strICOMS_input_Msg, ServiceListenerMembers templistenerMembers)
        {
            string strMsgFormat = string.Empty;
               string retMsg2ICOM = string.Empty;
               string strResMainFormat = string.Empty;
               string strGetICOMSMsgTillDot = string.Empty;
               ServiceTranslationManager trsMgr = new ServiceTranslationManager();
               try
               {

               logger.Info("ServiceRunTimeManager::processICOMSMessages() called");

               // Find dot from last & get message till that dot
               strGetICOMSMsgTillDot = strICOMS_input_Msg.Substring(0, strICOMS_input_Msg.LastIndexOf("."));
               logger.Info("Extracted ICOMS Message for processing from received message...");
               logger.Info(string.Format("{0}",strGetICOMSMsgTillDot));

               // Find CUI/CCI/EQI
               strMsgFormat = trsMgr.findICOMInputFormat(strGetICOMSMsgTillDot);
               logger.Info(string.Format("ICOMS Message Format...  {0}", strMsgFormat));

               if (strMsgFormat.Equals("ACK"))
               {
                   // form outgoing message format - xxxxxVyyyACK
                   strResMainFormat = trsMgr.ReplaceAtIndex(strGetICOMSMsgTillDot.IndexOf("I"), 'V', strGetICOMSMsgTillDot);
                   logger.Info(string.Format("ICOMS Full response Format...  {0}", strResMainFormat));
                   return trsMgr.formatResponse(strMsgFormat, strResMainFormat, "0000000", trsMgr.getValue4Key(strGetICOMSMsgTillDot, "TI:"));
               }
               // get incoming message format - xxxxxIyyyCUI/xxxxxIyyyCCI/xxxxxIyyyEQI
               strResMainFormat = trsMgr.getFullInputFormatValue(strGetICOMSMsgTillDot);
               logger.Info(string.Format("ICOMS Full request Format...  {0}", strResMainFormat));

               // form outgoing message format - xxxxxVyyyCUI/xxxxxVyyyCCI/xxxxxVyyyEQI
               strResMainFormat = trsMgr.ReplaceAtIndex(strResMainFormat.IndexOf("I"), 'V', strResMainFormat);
               logger.Info(string.Format("ICOMS Full response Format...  {0}", strResMainFormat));

               switch (strMsgFormat)
               {
                   case "CUI":
                       retMsg2ICOM = processCUIMessage(strGetICOMSMsgTillDot, templistenerMembers);
                       break;
                   case "CCI":
                       retMsg2ICOM = processCCIMessage(strGetICOMSMsgTillDot, templistenerMembers);
                       break;
                   case "EQI":
                       retMsg2ICOM = processEQIMessage(strGetICOMSMsgTillDot, templistenerMembers);
                       break;
                   default:
                       logger.Warn(string.Format("Invalid message format received from ICOMS - {0}. Valid formats CUI/CCI/EQI", strMsgFormat));
                       retMsg2ICOM = trsMgr.formatResponse("XXX", strResMainFormat, "0000902", trsMgr.getValue4Key(strGetICOMSMsgTillDot, "TI:"));
                       break;
                }

               // Format full outgoing response to ICOMS
               logger.Info("ServiceRunTimeManager::processICOMSMessages() formatting the response ");
               return trsMgr.formatResponse(strMsgFormat, strResMainFormat, retMsg2ICOM, trsMgr.getValue4Key(strGetICOMSMsgTillDot, "TI:"));
               }
               catch (Exception ex)
               {
               logger.Error(string.Format("processICOMSMessages(): Exception: {0}", ex.Message));
               logger.Error("ServiceRunTimeManager::processICOMSMessages() returning error");
               return trsMgr.formatResponse("XXX", strResMainFormat, "0000901", "xxxxxx");
               }
        }
        /// <summary>
        /// Process ICOMS EQI messages. Messages will be translated in required format to invoke CRM 4c Rest Interface.
        /// </summary>
        /// <param name="strICOMS_EQI_Msg"></param>
        /// <param name="templistenerMembers"></param>
        /// <returns></returns>
        public string processEQIMessage(string strICOMS_EQI_Msg, ServiceListenerMembers templistenerMembers)
        {
            Dictionary<string, string> dictObj4c = new Dictionary<string, string>();
             SyncRequest objSyncReq;
             EquipmentSyncRequest objCusEqi;
             ServiceTranslationManager trsMgr;
             ServiceBusinessRulesManager busMgr;
             string retMsg2ICOM = "0000901";
             string strResMainFormat = string.Empty;
             string strErrCode = string.Empty;
             trsMgr = new ServiceTranslationManager();

             try
             {
             logger.Info("ServiceRunTimeManager::processEQIMessage() called");
             busMgr = new ServiceBusinessRulesManager();

             // Create dictionary object with all required tokens(key-value) for EQI
             dictObj4c = trsMgr.getDataFor4cInterface(strICOMS_EQI_Msg, ServiceConstantsManager.CONST_EQI, templistenerMembers);
             logger.Info(string.Format("Required tokens are extracted from EQI message...  {0}", trsMgr.GetLine(dictObj4c)));

             // Validation for missing tokens
             strErrCode = busMgr.checkRequiredTokensPresent(dictObj4c, ServiceConstantsManager.CONST_EQI);
             if (strErrCode != string.Empty)
             {
                 logger.Error(string.Format("Please verify all required tokens are present in the EQI message. Required Tokens... \"{0}\"", string.Join(",", ServiceConstantsManager.CONST_EQI)));
                 return strErrCode;
             }

             // Validation for token length
             strErrCode = busMgr.checkRequiredLengthOfTokens(dictObj4c, templistenerMembers);
             if (strErrCode != string.Empty)
             {
                 logger.Error(string.Format("Length is not matching for one of tokens present in the EQI message(): {0}", string.Join(",", ServiceConstantsManager.CONST_EQI)));
                 return strErrCode;
             }

             // update Customerid(AN=AN+SI) based on flag value in config value
             dictObj4c = busMgr.AddSiteId2CustId(dictObj4c, templistenerMembers);

             // Get Native format device id from ICOMS "EA" token based config value of "DeviceIdFormat" & "NativeFormat4cFlag"
             dictObj4c = busMgr.getNativeFormat4cAddress(dictObj4c, templistenerMembers);

             objCusEqi = new EquipmentSyncRequest();
             objCusEqi.CustomerId = dictObj4c["AN:"];
             objCusEqi.macAddress = dictObj4c["EA:"];
             // Create new list for product Ids
             objCusEqi.offeringId = busMgr.getProductIdList(dictObj4c);
             objSyncReq = new SyncRequest();
             objSyncReq.CustomerId = dictObj4c["AN:"];
             objSyncReq.CustomerStatus = string.Empty;
             objSyncReq.ICOMSMsgFormat = "EQI";

             CustomerEquipmentRequest objCusEQIReq = new CustomerEquipmentRequest(objCusEqi, objSyncReq);

             switch (dictObj4c["AC:"])
             {
                 // Add EQI
                 case "A":
                     logger.Info("ADD EQI action called");
                     retMsg2ICOM = objCusEQIReq.AddEQI();
                     // Get success/failure error code to send to ICOMS
                     retMsg2ICOM = transalteResCode2ICOM4m4C(retMsg2ICOM, "AddEQI");
                     break;
                 // Update EQI
                 case "U":
                     logger.Info("Update EQI action called");
                     retMsg2ICOM = objCusEQIReq.UpdateEQI();
                     // Get success/failure error code to send to ICOMS
                     retMsg2ICOM = transalteResCode2ICOM4m4C(retMsg2ICOM, "UpdateEQI");
                     break;
                 // Delete EQI
                 case "R":
                     logger.Info("Delete EQI action called");
                     retMsg2ICOM = objCusEQIReq.DeleteEQI();
                     // Get success/failure error code to send to ICOMS
                     retMsg2ICOM = transalteResCode2ICOM4m4C(retMsg2ICOM, "DeleteEQI");
                     break;
                 default:
                     logger.Warn(string.Format("Invalid token value received from EQI message for AC operation : {0}", dictObj4c["AC:"]));
                     break;
             }
             logger.Info(string.Format("ServiceRunTimeManager::processEQIMessage() returning value {0}", retMsg2ICOM));
             return retMsg2ICOM;
             }
             catch (Exception ex)
             {
             logger.Error(string.Format("processEQIMessage(): Exception: {0}", ex.Message));
             logger.Error("ServiceRunTimeManager::processEQIMessage() returning error");
             return retMsg2ICOM;
             }
        }
        /// <summary>
        /// Create dictionay object to collect key-value pairs for required tokens for received messages from ICOMS
        /// </summary>
        /// <param name="strICOMIn"></param>
        /// <param name="arrlkpStr"></param>
        /// <returns></returns>
        public Dictionary<string, string> getDataFor4cInterface(string strICOMIn, string[] arrlkpStr ,ServiceListenerMembers templistenerMembers)
        {
            logger.Info("ServiceTranslationManager::getDataFor4cInterface() called");
            Dictionary<string, string> dictFor4cInterface = new Dictionary<string, string>();
            string[] arrToken=new string[2];

            foreach (string str in arrlkpStr)
            {
                arrToken = getKeyValuePair(strICOMIn, str);
                if (arrToken != null) {
                    dictFor4cInterface.Add(arrToken[0]+":", arrToken[1]);
                }
            }

            // Checking for CustomerId Flag id if set to true siteId Token populated to the dictFor4cInterface based on config
            if (Convert.ToBoolean(templistenerMembers.CustomerIdFlag) == true)
            {
                logger.Info(string.Format("ServiceTranslationManager::getDataFor4cInterface() CustomerId Flag set to True ,SiteId token {0}: as per Config", templistenerMembers.siteIdTokenName));

                arrToken = getKeyValuePair(strICOMIn, templistenerMembers.siteIdTokenName);
                dictFor4cInterface.Add(arrToken[0] + ":", arrToken[1]);
            }

            return dictFor4cInterface;
        }
 /// <summary>
 ///  Create native address format from ICOMS "EA" token and send it to 4c interface
 /// </summary>
 /// <param name="objdic"></param>
 /// <param name="objSerLisMem"></param>
 /// <returns></returns>
 public Dictionary<string, string> getNativeFormat4cAddress(Dictionary<string, string> objdic, ServiceListenerMembers objSerLisMem)
 {
     logger.Info("ServiceBusinessRulesManager::getNativeFormat4cAddress() called");
     string strCurrEA = objdic["EA:"];
     string strRetEA = string.Empty;
     bool bln4cNtvFlg= Convert.ToBoolean(objSerLisMem.NativeFormat4cFlag);
     logger.Info(string.Format("EA token value is...  {0}", strCurrEA));
     logger.Info(string.Format("DeviceIdFormat value is... {0}", objSerLisMem.DeviceIdFormat));
     logger.Info(string.Format("NativeFormat4cFlag value is... {0}", bln4cNtvFlg));
     switch (objSerLisMem.DeviceIdFormat)
     {
         case "1":
             strRetEA = strCurrEA.Substring(0, 12);
             break;
         case "2":
             if(bln4cNtvFlg)
             {
                 strRetEA = strCurrEA.Substring(0, 17);
             }
             else
             {
                 strRetEA = strCurrEA.Substring(0, 17).Replace(":", string.Empty);
             }
             break;
         case "3":
             if (bln4cNtvFlg)
             {
                 strRetEA = strCurrEA.Substring(0, 13);
             }
             else
             {
                 strRetEA = (Convert.ToInt64(strCurrEA.Substring(0, 13))).ToString("X12");
             }
             break;
         case "4":
             if (bln4cNtvFlg)
             {
                 strRetEA = strCurrEA.Substring(0, 13);
             }
             else
             {
                 strRetEA = (Convert.ToInt64(strCurrEA.Substring(0, 13))).ToString("X12");
             }
             break;
         case "5":
             // 000-NNNNN-NNNNN-NNN
             strRetEA = strCurrEA.Substring(0, 19);
             break;
         default:
             logger.Error("Unknown Device Id format received. Please configure correct device format id.");
             break;
     }
     logger.Info(string.Format("ICOMS EA({0}) value converted as \"{1}\" to send CRM", strCurrEA,strRetEA));
     objdic["EA:"] = strRetEA;
     return objdic;
 }