Beispiel #1
0
 /// <remarks/>
 public void exportSkippedAsync(ContactExportRequest exportSkippedRequest, object userState) {
     if ((this.exportSkippedOperationCompleted == null)) {
         this.exportSkippedOperationCompleted = new System.Threading.SendOrPostCallback(this.OnexportSkippedOperationCompleted);
     }
     this.InvokeAsync("exportSkipped", new object[] {
                 exportSkippedRequest}, this.exportSkippedOperationCompleted, userState);
 }
Beispiel #2
0
 /// <remarks/>
 public void exportSkippedAsync(ContactExportRequest exportSkippedRequest) {
     this.exportSkippedAsync(exportSkippedRequest, null);
 }
Beispiel #3
0
 /// <remarks/>
 public void exportSentAsync(ContactExportRequest exportSentRequest) {
     this.exportSentAsync(exportSentRequest, null);
 }
Beispiel #4
0
 /// <remarks/>
 public void exportComplainedAsync(ContactExportRequest exportComplainedRequest) {
     this.exportComplainedAsync(exportComplainedRequest, null);
 }
Beispiel #5
0
        /// <summary>
        /// Get feedback information
        /// </summary>
        /// <param name="customerName">customer Name</param>
        /// <param name="startTime">StartTime</param>
        /// <param name="endTime">End time</param>
        /// <param name="searchConditions">searchConditions</param>
        /// <returns>all of the information, including sent, bounced, 
        /// clicked and opened</returns>
        private XDocument queryFeedbackInfo(String customerName, DateTime startTime, DateTime endTime, Hashtable  searchConditions)
        {
            //String BouncedFormat = "email"; "name"; "Email address of bounced message"; "Bounce date"; "Bounce code"; "Bounce decription"; "Hard bounce"; "Job ID";
            //String OpenedFormat  = "email"; "name"; "Rendered"; "Opened"; "IP address"; "Browser"; "OS"; "Job ID";
            //String ClickedFormat = "email"; "name"; "clicked";  "linkid"; "IP address"; "browser";       "Job ID"
            if (logger.IsDebugEnabled)
            {
                logger.Debug("queryFeedbackInfo:customerName=" + customerName + ",startTime=" + startTime.ToLongTimeString() + ",endTime=" + endTime.ToLongTimeString());
            }
            String result;            
            XDocument doc = new XDocument(new XDeclaration("1.0", "UTF-8", "yes"));
            try
            {
                Action.ContactDatabaseAction contactDatabaseAction = new ContactDatabaseAction(client, userName, password);
                String contactDatabaseId = contactDatabaseAction.getDatabaseIdByName(customerName);

                ContactDatabaseFieldAction contactDatabaseFieldAction = new ContactDatabaseFieldAction(client, userName, password);
                Hashtable ht = contactDatabaseFieldAction.getContactDatabaseFields(contactDatabaseId);
                //String toEmailFieldId = contactDatabaseFieldAction.getDatabaseEmailId(contactDatabaseId);

                cn.tripolis.dialogue.export.ContactExportRequest request = new cn.tripolis.dialogue.export.ContactExportRequest
                    {
                        contactDatabaseId = contactDatabaseId,
                        timeRange = new cn.tripolis.dialogue.export.TimeRange { startTime = startTime, endTime = endTime }
                    };

                var xroot = new XElement("FeedbackReport");

                // logger.Debug("******exportSent*****");
                request.returnContactFields = new cn.tripolis.dialogue.export.ReturnContactFields
                    {
                        contactDatabaseFieldIds = new String[ht.Keys.Count]
                    };
                int index = 0;
                foreach (String value in ht.Values)
                {
                    request.returnContactFields.contactDatabaseFieldIds.SetValue(value, index++);
                }
                RawDataResponse response = null;// exportService.exportSent(request);
                XElement element = null;
                //  response = exportService.exportSent(request);
                // result = System.Text.Encoding.UTF8.GetString(response.data);
                // XElement element = Util.convertCsvToXmlElement(result.Replace("\"", ""), new[] { ";" }, "exportSent", searchConditions);
                // xroot.Add(element);

                request.returnContactFields.contactDatabaseFieldIds = null;


                request.returnContactFields = new cn.tripolis.dialogue.export.ReturnContactFields();
                request.returnContactFields.contactDatabaseFieldNames = new string[] { EMAIL_ID,EMAIL};

               // request.returnContactFields.returnAllContactFields = true;

             //   request.returnContactFields.returnAllContactFieldsSpecified = true;


                logger.Debug("******exportBounced*****");
                response = exportService.exportBounced(request);
                result = System.Text.Encoding.UTF8.GetString(response.data);
                element = Util.convertCsvToXmlElement(result.Replace("\"", ""), new[] { ";" }, "exportBounced", searchConditions);
                xroot.Add(element);


                logger.Debug("******exportOpened*****");
                response = exportService.exportOpened(request);
                result = System.Text.Encoding.UTF8.GetString(response.data);
                element = Util.convertCsvToXmlElement(result.Replace("\"", ""), new[] { ";" }, "exportOpened", searchConditions);
                xroot.Add(element);


                logger.Debug("******exportClicked*****");
                response = exportService.exportClicked(request);
                result = System.Text.Encoding.UTF8.GetString(response.data);
                element = Util.convertCsvToXmlElement(result.Replace("\"", ""), new[] { ";" }, "exportClicked", searchConditions);
                xroot.Add(element);
                doc.Add(xroot);
                result = doc.ToString();
            }
            catch (System.Web.Services.Protocols.SoapException ex)
            {
                result = ex.Detail.InnerXml;
                throw new Exception(result);
            }
            catch (Exception ex)
            {
                result = ex.Message;
                throw new Exception(result);
            }
            if (logger.IsDebugEnabled)
            {
                logger.Debug(result);
            }
            return doc;
        }
Beispiel #6
0
        /// <summary>
        /// Get Mail reports
        /// </summary>
        /// <param name="mailJobId"></param>
        /// <param name="timeRange"></param>
        /// <returns></returns>
        public byte[] ExportReport(String contactDatabaseId, DateTime startTime, DateTime endTime, ReportType reportType)
        {
            byte[] result = null;
            if (logger.IsDebugEnabled)
            {
                logger.Debug("ExportReport:contactDatabaseId=" + contactDatabaseId + ",ReportType=" + reportType);
            }
            try
            {
                cn.tripolis.dialogue.export.ContactExportRequest request = new cn.tripolis.dialogue.export.ContactExportRequest();
                request.contactDatabaseId = contactDatabaseId;
                request.timeRange = new cn.tripolis.dialogue.export.TimeRange();
                request.timeRange.startTime = startTime;
                request.timeRange.endTime = endTime;

                if (!reportType.Equals(ReportType.BOUNCED))
                {
                    request.returnContactFields = new cn.tripolis.dialogue.export.ReturnContactFields();

                    request.returnContactFields.contactDatabaseFieldGroupNames = new string[] { "reportgroup" };
                }
                RawDataResponse response = null;
                switch (reportType)
                {
                    case ReportType.OPENED:
                        response = exportService.exportOpened(request);
                        break;
                    case ReportType.CLICKED:
                        response = exportService.exportClicked(request);                        
                        break;
                    case ReportType.BOUNCED:
                        response = exportService.exportBounced(request);
                        break;
                    case ReportType.SENT:
                        response = exportService.exportSent(request);
                        break;
                    case ReportType.COMPLAINT:
                        response = exportService.exportComplained(request);
                        break;
                    case ReportType.LINKS:
                        response = exportService.exportLinks(request);
                        break;
                    case ReportType.JOBS:
                        response = exportService.exportJobs(request);
                        break;
                        
                    default:
                        break;
                }
                if (response != null)
                {
                    result = response.data;                  
                }

            }
            catch (System.Web.Services.Protocols.SoapException ex)
            {

                throw new Exception(ex.Detail.InnerXml);

            }
            return result;
        }