示例#1
0
        //private void PopupEclipseIntegration(Type objType, object obj, KeyValueCollection objUserData, string dataSection)
        //{
        //    try
        //    {
        //        if (objUserData == null)
        //            logger.Warn("User data is null in eclipse integration");
        //        //KeyValueCollection filterKeys = null;
        //        //if (!ConfigContainer.Instance().AllKeys.Contains(dataSection))
        //        //    ConfigContainer.Instance().ReadSection(dataSection);
        //        //if (!ConfigContainer.Instance().AllKeys.Contains(dataSection))
        //        //    filterKeys = ConfigContainer.Instance().GetValue(dataSection) as KeyValueCollection;
        //        string data = string.Empty;
        //        //if (filterKeys != null)
        //        //{
        //        //    foreach (string key in filterKeys.AllKeys)
        //        //    {
        //        //        if (objUserData.ContainsKey(filterKeys[key].ToString()))
        //        //            data = data + ((string.IsNullOrEmpty(data)) ? string.Empty : "<") + key + ":" + objUserData[filterKeys[key].ToString()].ToString();
        //        //        else
        //        //            data = data + ((string.IsNullOrEmpty(data)) ? string.Empty : "<") + key + ":N/A";
        //        //    }
        //        //}
        //        //else
        //        //{
        //        //    logger.Warn("Filter keys not available in eclipse integration.");
        //        //    return;
        //        //}
        //        DataParser objDataParser = new DataParser();
        //        string delimiter = "<";
        //        if (ConfigContainer.Instance().AllKeys.Contains("file.string-delimiter"))
        //            delimiter = ConfigContainer.Instance().GetAsString("file.string-delimiter");
        //        data = objDataParser.ParseTextEclipse(objType, obj, objUserData, dataSection, ":", "N/A");
        //        if (ConfigContainer.Instance().AllKeys.Contains("file-name"))
        //        {
        //            string filePath = ConfigContainer.Instance().GetAsString("file-name");
        //            //e:/ directory
        //            if (ConfigContainer.Instance().AllKeys.Contains("directory"))
        //                filePath = Path.Combine(ConfigContainer.Instance().GetAsString("directory"), filePath);
        //            if (!filePath.EndsWith(".txt"))
        //                filePath += ".txt";
        //            File.WriteAllText(filePath, data);
        //        }
        //        else
        //        {
        //            logger.Warn("File path is null to eclipse integration.");
        //            return;
        //        }
        //    }
        //    catch (Exception _generalException)
        //    {
        //        logger.Error("Error occurred as " + _generalException.Message);
        //    }
        //}
        private void PopupInformation(Type objEventType, object obj, KeyValueCollection userData, iCallData value)
        {
            try
            {
                string     xmlString     = string.Empty;
                DataParser objDataParser = new DataParser();
                string     dataSection   = string.Empty;
                if (ConfigContainer.Instance().AllKeys.Contains("file.data-section"))
                {
                    dataSection = ConfigContainer.Instance().GetAsString("file.data-section");
                }
                xmlString = objDataParser.ParseXML(objEventType, obj, userData, dataSection);

                #region Old Code

                //switch (value.VoiceEvent.Id)
                //{
                //    case EventRinging.MessageId:
                //        EventRinging eventRinging = (EventRinging)value.VoiceEvent;
                //        xmlString = objDataParser.GetXML(eventRinging.GetType(), eventRinging, userData, section);
                //        break;
                //    case EventReleased.MessageId:
                //        EventReleased eventReleased = (EventReleased)value.VoiceEvent;
                //        xmlString = objDataParser.GetXML(eventReleased.GetType(), eventReleased, userData, section);
                //        break;

                //    case EventEstablished.MessageId:
                //        EventEstablished eventEstablished = (EventEstablished)value.VoiceEvent;
                //        xmlString = objDataParser.GetXML(eventEstablished.GetType(), eventEstablished, userData, section);
                //        break;

                //    case EventHeld.MessageId:
                //        EventHeld eventHeld = (EventHeld)value.VoiceEvent;
                //        xmlString = objDataParser.GetXML(eventHeld.GetType(), eventHeld, userData, section);
                //        break;

                //    case EventPartyChanged.MessageId:
                //        EventPartyChanged eventPartyChanged = (EventPartyChanged)value.VoiceEvent;
                //        xmlString = objDataParser.GetXML(eventPartyChanged.GetType(), eventPartyChanged, userData, section);
                //        break;

                //    case EventAttachedDataChanged.MessageId:
                //        EventAttachedDataChanged eventAttachedDataChanged = (EventAttachedDataChanged)value.VoiceEvent;
                //        xmlString = objDataParser.GetXML(eventAttachedDataChanged.GetType(), eventAttachedDataChanged, userData, section);
                //        break;

                //    case EventDialing.MessageId:
                //        EventDialing eventDialing = (EventDialing)value.VoiceEvent;
                //        xmlString = objDataParser.GetXML(eventDialing.GetType(), eventDialing, userData, section);
                //        break;

                //    case EventRetrieved.MessageId:
                //        EventRetrieved eventRetrieved = (EventRetrieved)value.VoiceEvent;
                //        xmlString = objDataParser.GetXML(eventRetrieved.GetType(), eventRetrieved, userData, section);
                //        break;

                //    case EventAbandoned.MessageId:
                //        EventAbandoned eventAbandoned = (EventAbandoned)value.VoiceEvent;
                //        xmlString = objDataParser.GetXML(eventAbandoned.GetType(), eventAbandoned, userData, section);
                //        break;

                //    case EventPartyAdded.MessageId:
                //        EventAbandoned eventPartyAdded = (EventAbandoned)value.VoiceEvent;
                //        xmlString = objDataParser.GetXML(eventPartyAdded.GetType(), eventPartyAdded, userData, section);
                //        break;

                //    case EventPartyDeleted.MessageId:
                //        EventPartyDeleted eventPartyDeleted = (EventPartyDeleted)value.VoiceEvent;
                //        xmlString = objDataParser.GetXML(eventPartyDeleted.GetType(), eventPartyDeleted, userData, section);
                //        break;
                //}

                #endregion

                string   memberID           = string.Empty;
                string   memberSX           = string.Empty;
                string   memberPhone        = string.Empty;
                string   memberExtension    = string.Empty;
                string   message            = string.Empty;
                string   memberFirstName    = string.Empty;
                string   memberLastName     = string.Empty;
                string   memberDOB          = string.Empty;
                string   memberTopValidated = string.Empty;
                string   cstk_summary       = string.Empty;
                string   cstk_mctr_category = string.Empty;
                string   cssc_mctr_call     = string.Empty;
                string   callertype         = string.Empty;
                string   providerID         = string.Empty;
                string   groupID            = string.Empty;
                string   cstk_mem_summary   = string.Empty;
                string[] tempValues;
                string   memValidated = string.Empty;
                string   callingFor   = string.Empty;

                #region Old Code

                KeyValueCollection data = userData;
                if (data != null)
                {
                    if (!data.Equals(string.Empty))
                    {
                        foreach (string keys in data.Keys)
                        {
                            if (setting.attachDataList.ContainsValue(keys))
                            {
                                string tag = setting.attachDataList.Where(kvp => kvp.Value == keys).Select(kvp => kvp.Key).FirstOrDefault();
                                if ((tag == "SBSB_ID" || tag == "MEME_SFX") && tag != null)
                                {
                                    try
                                    {
                                        tempValues = null;
                                        if (!string.IsNullOrEmpty(Convert.ToString(data[keys])))
                                        {
                                            tempValues = data[keys].ToString().Split('|');
                                            memberID   = tempValues[0].ToString().Substring(0, 9);
                                            memberSX   = data[keys].ToString().Substring(9, 2);
                                            logger.Info("Search MemIDTranslated : " + memberID);
                                        }
                                    }
                                    catch (Exception memberException)
                                    {
                                        logger.Error("Error occurred while splitting member ID " + memberException.ToString());
                                    }
                                }
                                if ((tag == "CSCI_PHONE") && tag != null)
                                {
                                    memberPhone = data[keys].ToString();
                                    logger.Info("memberPhone : " + memberPhone);
                                }
                                else if (tag == "CSCI_FIRST_NAME" || tag == "CSCI_MID_INIT" || tag == "CSCI_LAST_NAME")
                                {
                                    try
                                    {
                                        tempValues = null;
                                        tempValues = data[keys].ToString().Split('|');
                                        string[] name = tempValues[0].ToString().Split(' ');
                                        memberFirstName = name[0];
                                        memberLastName  = name[1];
                                        logger.Info("Search FristName : " + memberFirstName);
                                        logger.Info("Search LastName : " + memberLastName);
                                    }
                                    catch (Exception splitException)
                                    {
                                        logger.Error("Error occurred while spliting the string value " + splitException.ToString());
                                    }
                                }
                                else if (tag == "MEMBER_DOB")
                                {
                                    tempValues = null;
                                    tempValues = data[keys].ToString().Split('|');
                                    memberDOB  = tempValues[0].ToString();
                                    logger.Info("Search memdob : " + memberDOB);
                                }
                                //else if (tag == "CSSC_MCTR_CALL")
                                //{
                                //    callertype = data[keys].ToString();
                                //    logger.Info("Search CallerType : " + callertype);
                                //}
                                else if (tag == "PRPR_ID")
                                {
                                    providerID = data[keys].ToString();
                                    logger.Info("Search CallerIDTranslated : " + providerID);
                                }
                                else if (tag == "GRGR_ID")
                                {
                                    tempValues = null;
                                    tempValues = data[keys].ToString().Split('|');
                                    groupID    = tempValues[0].ToString();
                                    logger.Info("Search groupid : " + groupID);
                                }
                                else if (string.Compare(keys, "memdos", true) == 0)
                                {
                                    cstk_mem_summary = data[keys].ToString();
                                    logger.Info("Search MemDOS : " + cstk_mem_summary);
                                }
                                else if (tag == "CSTK_SUMMARY")
                                {
                                    cstk_summary = data[keys].ToString();
                                    logger.Info("Search BenDisc : " + cstk_summary);
                                }
                                else if (tag == "CSTK_CUST_IND")
                                {
                                    callertype = data[keys].ToString();
                                    logger.Info("Search CallerType : " + callertype);
                                }
                                else if (tag == "CSSC_MCTR_CALL")
                                {
                                    tempValues     = null;
                                    tempValues     = data[keys].ToString().Split('|');
                                    cssc_mctr_call = tempValues[0].ToString();
                                    logger.Info("MCTR call type : " + cssc_mctr_call);
                                }
                                else if (tag == "CSTK_MCTR_CATG")
                                {
                                    tempValues         = null;
                                    tempValues         = data[keys].ToString().Split('|');
                                    cstk_mctr_category = tempValues[0].ToString();
                                    logger.Info("Search CallReason : " + cstk_mctr_category);
                                }
                                else if (tag == "MEMBER_INFO")
                                {
                                    tempValues   = null;
                                    memValidated = data[keys].ToString();
                                    logger.Info("Search MemValidated : " + memValidated);
                                }
                                else if (tag == "CALLING_FOR")
                                {
                                    callingFor = data[keys].ToString();
                                    logger.Info("Search CALLING_FOR : " + callingFor);
                                }
                            }
                        }
                    }
                }
                else
                {
                    logger.Warn("Attached Data is empty");
                }

                #endregion

                string originalCallerType = callertype;
                callertype = callertype.ToLower() == "p" ? "M" : callertype;
                //string CSSC_MCTR_CALLValue = string.IsNullOrEmpty(callertype) == false ? (callertype.ToLower() == "m" ? "1300" : "1800") : string.Empty;

                if (Settings.GetInstance().EnableFacetCommunication)
                {
                    message = "<ListenerMessage><Identification> <Destination>FID</Destination> <Origin>Company Server</Origin></Identification><Execution> <PZAP_APP_ID>CST0</PZAP_APP_ID> " +
                              "<Action>New</Action></Execution><Data><Navigation> <SectionName></SectionName> <ActiveRow></ActiveRow> <SubSectionName></SubSectionName> <AppAction></AppAction> " +
                              "</Navigation><REC_CUST>" + "<CSTK_CUST_IND>" + callertype + "</CSTK_CUST_IND><CSTK_MCTR_CATG>" + cstk_mctr_category + "</CSTK_MCTR_CATG><CSTK_SUMMARY>" + cstk_summary + "</CSTK_SUMMARY>" +
                              "<SBSB_ID>" + memberID + "</SBSB_ID><MEME_SFX>" + memberSX + "</MEME_SFX><PRPR_ID>" + providerID + "</PRPR_ID><GRGR_ID>" + groupID + "</GRGR_ID><SGSG_ID></SGSG_ID> " +
                              "<CSSC_MCTR_CALL>" + cssc_mctr_call + "</CSSC_MCTR_CALL><CSCI_FIRST_NAME>" + (originalCallerType.ToLower() == "p" ? string.Empty : memberFirstName) + "</CSCI_FIRST_NAME><CSCI_LAST_NAME>" + (originalCallerType.ToLower() == "p" ? string.Empty : memberLastName) + "</CSCI_LAST_NAME>" +
                              "<CSCI_MID_INIT></CSCI_MID_INIT><CSCI_TITLE></CSCI_TITLE><CSCI_PHONE>" + memberPhone + "</CSCI_PHONE><CSCI_PHONE_EXT>" + memberExtension + "</CSCI_PHONE_EXT><CSCI_SSN></CSCI_SSN>" +
                              "<CSSC_CALLIN_METHOD>1</CSSC_CALLIN_METHOD></REC_CUST><REC_IVR_DATA><MCPD_SOURCE>CS01</MCPD_SOURCE><CALL_RECEIVED_ON>Customer Care</CALL_RECEIVED_ON><MEMBER_ID>" + memberID + "</MEMBER_ID>" +
                              "<CALLING_FOR>" + callingFor + "</CALLING_FOR><MEMBER_DOB> " + memberDOB + "</MEMBER_DOB><MEMBER_INFO>" + memValidated + "</MEMBER_INFO><PAGE_TYPE>Medical Claims</PAGE_TYPE></REC_IVR_DATA></Data></ListenerMessage>";
                }
                else
                {
                    message = "<ListenerMessage><Identification> <Destination>FID</Destination> <Origin>Company Server</Origin></Identification><Execution> <PZAP_APP_ID>CST0</PZAP_APP_ID> " +
                              "<Action>New</Action></Execution><Data><Navigation> <SectionName></SectionName> <ActiveRow></ActiveRow> <SubSectionName></SubSectionName> <AppAction></AppAction> " +
                              "</Navigation><REC_CUST>" + "<CSTK_CUST_IND>" + callertype + "</CSTK_CUST_IND><CSTK_MCTR_CATG>" + cstk_mctr_category + "</CSTK_MCTR_CATG><CSTK_SUMMARY>" + cstk_summary + "</CSTK_SUMMARY>" +
                              "<SBSB_ID>" + memberID + "</SBSB_ID><MEME_SFX>" + memberSX + "</MEME_SFX><PRPR_ID></PRPR_ID><GRGR_ID></GRGR_ID><SGSG_ID></SGSG_ID> " +
                              "<CSSC_MCTR_CALL>" + cssc_mctr_call + "</CSSC_MCTR_CALL><CSCI_FIRST_NAME>" + (originalCallerType.ToLower() == "p" ? string.Empty : memberFirstName) + "</CSCI_FIRST_NAME><CSCI_LAST_NAME>" + (originalCallerType.ToLower() == "p" ? string.Empty : memberLastName) + "</CSCI_LAST_NAME>" +
                              "<CSCI_MID_INIT></CSCI_MID_INIT><CSCI_TITLE></CSCI_TITLE><CSCI_PHONE>" + memberPhone + "</CSCI_PHONE><CSCI_PHONE_EXT>" + memberExtension + "</CSCI_PHONE_EXT><CSCI_SSN></CSCI_SSN>" +
                              "<CSSC_CALLIN_METHOD>1</CSSC_CALLIN_METHOD></REC_CUST><REC_IVR_DATA><MCPD_SOURCE>CS01</MCPD_SOURCE><CALL_RECEIVED_ON>Customer Care</CALL_RECEIVED_ON><MEMBER_ID>" + memberID + "</MEMBER_ID>" +
                              "<CALLING_FOR>" + callingFor + "</CALLING_FOR><MEMBER_DOB> " + memberDOB + "</MEMBER_DOB><MEMBER_INFO>" + memValidated + "</MEMBER_INFO><PAGE_TYPE>Medical Claims</PAGE_TYPE></REC_IVR_DATA></Data></ListenerMessage>";
                }

                //Code compare default file and BCBS
                //message +="File from Default file = "+ result;

                //code Added on 25-02-2014 to implement storing of call data in specified location
                if (/*Settings.InteractionDataLocation*/ value.FileData.DirectoryPath != string.Empty)
                {
                    try
                    {
                        string folder = Path.Combine(/*Settings.InteractionDataLocation*/ value.FileData.DirectoryPath, "");
                        if (!Directory.Exists(folder))
                        {
                            Directory.CreateDirectory(folder);
                        }
                        string file = "";
                        if (value.FileData.FileName != string.Empty)
                        {
                            file = Path.Combine(folder, value.FileData.FileName + ".txt");
                        }
                        else
                        {
                            logger.Warn("File Name is empty");
                            file = Path.Combine(folder, "calldata_vd.txt");
                        }
                        File.WriteAllText(file, message);
                    }
                    catch (Exception fileException)
                    {
                        logger.Error("Error occurred while writing data in Text file" + fileException.ToString());
                    }
                }
                else
                {
                    logger.Warn("File Directory Path is empty");
                    try
                    {
                        // string folder = Path.Combine(new DirectoryInfo(Environment.SystemDirectory.ToString()).Root.Name.ToString(), Environment.SpecialFolder.ProgramFiles.ToString(), "Pointel");
                        string folder = "C:\\Program Files (x86)\\Pointel";
                        if (!Directory.Exists(folder))
                        {
                            Directory.CreateDirectory(folder);
                        }
                        string file = "";
                        if (value.FileData.FileName != string.Empty)
                        {
                            file = Path.Combine(folder, value.FileData.FileName + ".txt");
                        }
                        else
                        {
                            logger.Warn("File Name is empty");
                            file = Path.Combine(folder, "calldata_vd.txt");
                        }
                        File.WriteAllText(file, message);
                    }
                    catch (Exception fileException)
                    {
                        logger.Error("Error occurred while writing data in Text file" + fileException.ToString());
                    }
                }
                //End
                logger.Info("XML Message " + message);
            }
            catch (Exception generalException)
            {
                logger.Error("Error occurred while constructing XML message for FACET " + generalException.ToString());
            }
        }