Exemplo n.º 1
0
        public void descargaOpen(String jobid, BackgroundWorker bgw)
        {
            EmailInfo einf = new EmailInfo();
            Send objSend = einf.getEmailInformationOpenSent(jobid);
            double deci = Convert.ToDouble(objSend.UniqueOpens);
            Conexion conex =new Conexion();

            RetrieveRequest rr = new RetrieveRequest();
            rr.ObjectType = "OpenEvent";

            String[] props = { "SubscriberKey" };
            rr.Properties = props;
            /**
            * Details for single JobId/SendId
            */
            SimpleFilterPart filter = new SimpleFilterPart();
            filter.Property = "SendID";
            String[] vlaues = { jobid + " " };
            filter.Value = vlaues;

            rr.Filter = filter;

            APIObject[] results = null;
            String requestId = null;
            String status;
            List<String> lista = new List<String>();
            int k = 0;
            int porcentaje;

            do
            {
                status = conex.cliente.Retrieve(rr, out requestId, out results);
                for (int i = 0; i < results.Length; i++)
                {
                    OpenEvent deo = results[i] as OpenEvent;
                    string parte3 = deo.SubscriberKey;
                    var newLine = string.Format("{0}", parte3);
                    lista.Add(newLine);
                    porcentaje = Convert.ToInt32((k / deci) * 100);
                    if (porcentaje > 100) porcentaje = 100;
                    bgw.ReportProgress(porcentaje);
                    k++;
                }
                rr = new RetrieveRequest();
                rr.ContinueRequest = requestId;
                System.Console.Out.WriteLine("Procesando....");
                System.Console.Out.WriteLine(results.Length);
            } while (status.Equals("MoreDataAvailable"));
            List<String> sinDup = lista.Distinct().ToList();
            System.Console.Out.WriteLine("Descarga Completa!");
            StreamWriter file = new StreamWriter(@"D:\ET_EXTRACTOR\Open_" + jobid + ".txt", true);
            System.Console.Out.WriteLine("Formateando");
            for (int j = 0; j < sinDup.Count; j++)
            {
                file.WriteLine(sinDup.ElementAt(j));
            }
            file.Close();
            bgw.ReportProgress(0);
        }
Exemplo n.º 2
0
        public Send getEmailInformationOpenSent(String jobid)
        {
            Conexion conex = new Conexion();

            RetrieveRequest rr = new RetrieveRequest();
            rr.ObjectType = "Send";

            String[] props = { "UniqueOpens", "NumberSent" };
            rr.Properties = props;

            SimpleFilterPart filter = new SimpleFilterPart();
            filter.Property = "ID";
            String[] vlaues = { jobid + " " };
            filter.Value = vlaues;

            rr.Filter = filter;

            APIObject[] results = null;
            String requestId = null;
            String status;
            List<String> lista = new List<String>();
            Send obj=null;
            status = conex.cliente.Retrieve(rr, out requestId, out results);

            while (status.CompareTo("OK") != 0)
            {
                status = conex.cliente.Retrieve(rr, out requestId, out results);

            }

            for (int i = 0; i < results.Length; i++)
            {
                  Send deo = results[i] as Send;
                  obj = deo;
            }
            return obj;
        }