Example #1
0
        public void ActualizaRegistroMarkDone(ICase _caseIdentifier, Interaccion _inx)
        {
            DataRow rowUpdate = null;
            string  connid    = "";
            var     tipo      = _caseIdentifier.MainInteraction.Type;

            switch (tipo)
            {
            case "InteractionVoice":
                if (_caseIdentifier.MainInteraction.HasOutboundChainRecord)
                {
                    ICampaignManager cm = InteractionExtensionCrossnetModule._container.Resolve <ICampaignManager>();
                    IWCampaign       c;

                    for (int i = 0; i < cm.IWCampaigns.Count(); i++)
                    {
                        if (cm.IWCampaigns[i].Mode.Value != null)
                        {
                            _inx.genDialMode = cm.IWCampaigns[i].Mode.Value.ToString();
                        }
                    }


                    if (_inx.genDialMode != null)
                    {
                        if (_inx.genDialMode.Equals("PROGRESSIVE") || _inx.genDialMode.Equals("PREDICTIVE"))
                        {
                            rowUpdate           = InteractionExtensionCrossnetModule._TablaInteraccion.Select("idMarkDone = '" + _caseIdentifier.MainInteraction.EntrepriseInteractionCurrent.Id + "'").FirstOrDefault();
                            rowUpdate["Estado"] = "TIPIFICADO";
                        }
                        else
                        {
                            var item3 = _caseIdentifier.MainInteraction.OutboundChainRecord.Records.FirstOrDefault();
                            rowUpdate = InteractionExtensionCrossnetModule._TablaInteraccion.Select("idMarkDone = '" + item3.CallAttemptGUID + "'").FirstOrDefault();
                        }
                    }
                    else
                    {
                        var item2 = _caseIdentifier.MainInteraction.OutboundChainRecord.Records.FirstOrDefault();
                        rowUpdate = InteractionExtensionCrossnetModule._TablaInteraccion.Select("idMarkDone = '" + item2.CallAttemptGUID + "'").FirstOrDefault();
                    }
                }
                else
                if (_caseIdentifier.MainInteraction.EntrepriseInteractionCurrent.Profile != null)
                {
                    if (_caseIdentifier.MainInteraction.EntrepriseInteractionCurrent.Profile.ToString().Equals("Consult"))
                    {
                        connid = _caseIdentifier.MainInteraction.EntrepriseInteractionCurrent.Data.Owner != null?
                                 _caseIdentifier.MainInteraction.EntrepriseInteractionCurrent.Data.Owner.ToString() : "";
                    }
                }


                rowUpdate           = InteractionExtensionCrossnetModule._TablaInteraccion.Select("idMarkDone = '" + _caseIdentifier.MainInteraction.EntrepriseInteractionCurrent.Id + "'").FirstOrDefault();
                rowUpdate["Estado"] = "TIPIFICADO";
                break;

            case "InteractionPullPreview":
                var item = _caseIdentifier.MainInteraction.OutboundChainRecord.Records.FirstOrDefault();
                rowUpdate           = InteractionExtensionCrossnetModule._TablaInteraccion.Select("idMarkDone = '" + item.CallAttemptGUID + "'").FirstOrDefault();
                rowUpdate["Estado"] = "TIPIFICADO";
                break;

            case "InteractionCallback":
                rowUpdate           = InteractionExtensionCrossnetModule._TablaInteraccion.Select("idMarkDone = '" + _caseIdentifier.MainInteraction.EntrepriseInteractionCurrent.Id + "'").FirstOrDefault();
                rowUpdate["Estado"] = "TIPIFICADO";
                break;
            }
        }
Example #2
0
        public static Interaccion GetAttachedData(IInteraction inx)
        {
            var datosInx = new Interaccion
            {
                GenAgente = InteractionExtensionCrossnetModule.Agente.UserName
            };


            if (inx.EntrepriseInteractionCurrent != null)
            {
                datosInx.GenConnid = inx.EntrepriseInteractionCurrent.Id;

                switch (inx.EntrepriseInteractionCurrent.IdType.Direction.ToString())
                {
                case "In":
                {
                    datosInx.GenCanalEntrada = "Inbound";
                    break;
                }

                case "Out":
                {
                    datosInx.GenCanalEntrada = "Outbound";
                    break;
                }
                }
            }

            if (inx.Type.Equals("InteractionVoice"))
            {
                datosInx.GenFechaInicioCall   = inx.StartDate;
                datosInx.GenNombreInteraccion = inx.Type;

                switch (inx.EntrepriseLastInteractionEvent.Id)
                {
                case EventDialing.MessageId:
                {
                    var eventDial = inx.EntrepriseLastInteractionEvent as EventDialing;
                    if (eventDial != null)
                    {
                        datosInx.GenOrigen  = eventDial.ANI;
                        datosInx.GenDestino = eventDial.DNIS;
                    }
                    return(datosInx);
                }

                case EventRinging.MessageId:
                {
                    var eventRing = inx.EntrepriseLastInteractionEvent as EventRinging;
                    if (eventRing != null)
                    {
                        datosInx.GenOrigen  = eventRing.ANI;
                        datosInx.GenDestino = eventRing.DNIS;
                    }
                    return(datosInx);
                }

                case EventEstablished.MessageId:
                {
                    var eventEstab = inx.EntrepriseLastInteractionEvent as EventEstablished;
                    if (eventEstab != null)
                    {
                        datosInx.GenOrigen  = eventEstab.ANI;
                        datosInx.GenDestino = eventEstab.DNIS;
                    }
                    return(datosInx);
                }

                case EventReleased.MessageId:
                {
                    var eventRelease = inx.EntrepriseLastInteractionEvent as EventReleased;
                    if (eventRelease != null)
                    {
                        datosInx.GenOrigen  = eventRelease.ANI;
                        datosInx.GenDestino = eventRelease.DNIS;
                    }
                    return(datosInx);
                }

                case EventAttachedDataChanged.MessageId:
                {
                    var eventDataChanged =
                        inx.EntrepriseLastInteractionEvent as EventAttachedDataChanged;
                    if (eventDataChanged != null)
                    {
                        datosInx.GenOrigen  = eventDataChanged.ANI;
                        datosInx.GenDestino = eventDataChanged.DNIS;
                    }
                    return(datosInx);
                }
                }
            }

            if (inx.Type.Equals("InteractionChat"))
            {
                try
                {
                    datosInx.GenConnid = inx.EntrepriseInteractionCurrent != null &&
                                         inx.EntrepriseInteractionCurrent.Id != null
                        ? inx.EntrepriseInteractionCurrent.Id
                        : "";
                    datosInx.GenFechaInicioCall   = inx.StartDate;
                    datosInx.GenNombreInteraccion = inx.Type;
                    if (datosInx.GenCanalEntrada.Equals("Inbound"))
                    {
                        datosInx.GenTipoInteraccion = 1;
                    }
                    else if (datosInx.GenCanalEntrada.Equals("Outbound"))
                    {
                        datosInx.GenTipoInteraccion = 2;
                    }
                }
                catch (Exception error)
                {
                    GenesysAlert.SendMessage(
                        "Se ha producido un error al obtener los campos del Chat en InteractionChat: " +
                        error.Message, "Public", SeverityType.Error);
                }
            }
            if (inx.Type.Equals("InteractionCallback"))
            {
                try
                {
                    datosInx.GenOrigen = inx.GetAttachedData("PhoneNumber").ToString();
                }
                catch (Exception error)
                {
                    GenesysAlert.SendMessage(
                        "Se ha producido un error al obtener los campos del fono en InteractionCallback: " +
                        error.Message, "Public", SeverityType.Error);
                }
            }
            if (inx.Type.Equals("InteractionInboundEmail"))
            {
                try
                {
                    datosInx.GenConnid = inx.EntrepriseInteractionCurrent != null &&
                                         inx.EntrepriseInteractionCurrent.Id != null
                        ? inx.EntrepriseInteractionCurrent.Id
                        : "";
                    datosInx.GenFechaInicioCall = inx.StartDate;
                    datosInx.GenTipoInteraccion = 10;
                }
                catch (Exception error)
                {
                    GenesysAlert.SendMessage(
                        "Se ha producido un error al obtener los campos del email en InteractionInboundEmail: " +
                        error.Message, "Public", SeverityType.Error);
                }
            }

            if (inx.Type.Equals("InteractionOutboundEmail"))
            {
                try
                {
                    datosInx.GenConnid = inx.EntrepriseInteractionCurrent != null &&
                                         inx.EntrepriseInteractionCurrent.Id != null
                        ? inx.EntrepriseInteractionCurrent.Id
                        : "";
                    datosInx.GenFechaInicioCall = inx.StartDate;
                    datosInx.GenTipoInteraccion = 11;
                }
                catch (Exception error)
                {
                    GenesysAlert.SendMessage(
                        "Se ha producido un error al obtener los campos del email en InteractionOutboundEmail: " +
                        error.Message, "Public", SeverityType.Error);
                }
            }

            if (inx.Type.Equals("InteractionPullPreview"))
            {
                try
                {
                    datosInx.GenRecordId        = inx.OutboundChainRecord.UserData.GetAsInt("recordid");
                    datosInx.GenChainIdCampana  = inx.OutboundChainRecord.UserData.GetAsInt("GSW_CHAIN_ID");
                    datosInx.GenCampaingName    = inx.OutboundChainRecord.CampaignName;
                    datosInx.GenGuid            = inx.OutboundChainRecord.UserData.GetAsString("GSW_CALL_ATTEMPT_GUID");
                    datosInx.GenAttempt         = inx.OutboundChainRecord.UserData.GetAsInt("GSW_ATTEMPTS");
                    datosInx.GenGroupName       = inx.OutboundChainRecord.UserData.GetAsString("GSW_CAMPAIGN_GROUP_NAME");
                    datosInx.GenTipoInteraccion = 7;
                    datosInx.GenCanalEntrada    = inx.OutboundChainRecord.UserData.GetAsString("InteractionType");
                    datosInx.GenCanalEntrada    = "PreviewRecord";
                    datosInx.GenEvento          = inx.OutboundChainRecord.UserData.GetAsString("GSW_USER_EVENT");
                    datosInx.GenDestino         = inx.OutboundChainRecord.UserData.GetAsString("GSW_PHONE");
                    datosInx.GenOrigen          = inx.Agent.Place.PlaceName;
                    datosInx.GenFechaInicioCall = DateTime.Now;
                }
                catch (Exception error)
                {
                    GenesysAlert.SendMessage(
                        "Se ha producido un error al obtener los campos de la campaña en InteractionPullPreview: " +
                        error.Message, "Public", SeverityType.Error);
                }
            }

            if (inx.Type.Equals("InteractionPushPreview"))
            {
                try
                {
                    datosInx.GenRecordId        = inx.OutboundChainRecord.UserData.GetAsInt("recordid");
                    datosInx.GenChainIdCampana  = inx.OutboundChainRecord.UserData.GetAsInt("GSW_CHAIN_ID");
                    datosInx.GenCampaingName    = inx.OutboundChainRecord.CampaignName;
                    datosInx.GenGuid            = inx.OutboundChainRecord.UserData.GetAsString("GSW_CALL_ATTEMPT_GUID");
                    datosInx.GenAttempt         = inx.OutboundChainRecord.UserData.GetAsInt("GSW_ATTEMPTS");
                    datosInx.GenGroupName       = inx.OutboundChainRecord.UserData.GetAsString("GSW_CAMPAIGN_GROUP_NAME");
                    datosInx.GenTipoInteraccion = 37;
                    datosInx.GenCanalEntrada    = inx.OutboundChainRecord.UserData.GetAsString("InteractionType");
                    datosInx.GenCanalEntrada    = "PreviewRecord";
                    datosInx.GenEvento          = inx.OutboundChainRecord.UserData.GetAsString("GSW_USER_EVENT");
                    datosInx.GenDestino         = inx.OutboundChainRecord.UserData.GetAsString("GSW_PHONE");
                    datosInx.GenOrigen          = inx.Agent.Place.PlaceName;
                    datosInx.GenFechaInicioCall = DateTime.Now;
                }
                catch (Exception error)
                {
                    GenesysAlert.SendMessage(
                        "Se ha producido un error al obtener los campos de la campaña en InteractionPullPreview: " +
                        error.Message, "Public", SeverityType.Error);
                }
            }

            return(datosInx);
        }