Example #1
0
        private static processArrClientes DEtoClient(DataExtensionObject deObj)
        {
            var data = Newtonsoft.Json.JsonConvert.DeserializeObject <CallCenterRequest>(deObj.Properties.Where(p => p.Name == "Data").FirstOrDefault().Value);

            return(new processArrClientes
            {
                CuentaBRM = data.BRM,
                Nombre = data.Name,
                TelefonoFijo = data.Phone,
                TelefonoMovil = data.MobilePhone,
                CorreoElectronico = data.Email,
                NombreCampania = data.CampaignName,
                IdCampania = data.CampaignId,
                UrlAudio = data.AudioURL,
                FolioOrdenServicio = data.ServiceOrder,
                FolioOrdenTrabajo = data.WorkOrder,
                TurnoAgendamiento = data.ScheduledAppointment,
                FechaAgendamiento = data.ScheduledDate,
                HoraAgendamiento = data.ScheduledDateTime,
                EstatusLlamadas = data.CallStatus,
                IDSFID = data.IDSFID,
                CodigoDigito = data.DigitCode,
                TipoLamada = data.CallType,
                VDN = data.VDNigito
            });
        }
        public Dictionary <string, Dictionary <string, string> > GetDataExtension()
        {
            Dictionary <string, Dictionary <string, string> > dict = new Dictionary <string, Dictionary <string, string> >();
            SoapClient client = new SoapClient();

            client.ClientCredentials.UserName.UserName = "******";
            client.ClientCredentials.UserName.Password = "******";
            APIObject[]      Results;
            String           requestID;
            String           status;
            RetrieveRequest1 rr1 = new RetrieveRequest1();
            RetrieveRequest  rr  = new RetrieveRequest();

            rr.ObjectType = "DataExtensionObject[Alert_Inbox]";
            rr.Properties = new string[] {
                "Alert_Category", "Alert_Subject"
            };
            rr1.RetrieveRequest = rr;
            SimpleFilterPart sf = new SimpleFilterPart();

            sf.SimpleOperator = SimpleOperators.equals;
            sf.Property       = "ET_Surrogate_ID";

            try
            {
                //var result = Task.Run(async () => client.RetrieveAsync(rr1));
                // var values = result.GetAwaiter().GetResult().GetAwaiter().GetResult();
                var results = client.Retrieve(rr, out requestID, out Results);
                if (Results.Length > 0)
                {
                    for (int i = 0; i < Results.Length; i++)
                    {
                        DataExtensionObject deo = (DataExtensionObject)Results[i];

                        Dictionary <string, string> props = new Dictionary <string, string>();
                        string transactionID = "";

                        foreach (APIProperty prop in deo.Properties)
                        {
                            if (prop.Name == "ET_Transaction_ID")
                            {
                                transactionID = prop.Value;
                            }

                            props[prop.Name] = prop.Value;
                        }

                        dict[transactionID] = props;
                    }
                }
            }
            catch (Exception e)
            {
            }
            //var results =   client.RetrieveAsync(rr1);
            return(dict);
        }