Esempio n. 1
0
 /// <summary> 
 /// 添加数据库记录 
 /// </summary> 
 /// <param name="feedbackBO">信息数组</param> 
 public void Feedback_updateInfoForSent(TripolisDialogueAdapter.DAO.FeedbackBO feedbackBO)
 {
     try
     {
         if (!Feedback_IsRecordExist(feedbackBO.jobId))
         {
             comm = new OleDbCommand("insert into [Feedback] ([jobId],[email],[updateDate]) values ('"
                 + feedbackBO.jobId + "','" + feedbackBO.email + "',Now())", conn);
         }
         else
         {
             comm = new OleDbCommand("update [Feedback] set [email]='" + feedbackBO.email + "',[updatedate]=Now() where jobId='" 
                 + feedbackBO.jobId + "'", conn);
         }
         conn.Open();
         comm.ExecuteNonQuery();
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
         //MessageBox.Show("添加失败"); 
     }
     finally
     {
         conn.Close();
     }
 }
Esempio n. 2
0
        /// <summary>
        /// send Register email 
        /// </summary>
        /// <param name="dialogueSetting">Dialogue setting, such as database Id, workspaceId</param>        
        /// <param name="ContactInfos">parameters related with contact information, such as email Id.</param>
        /// <returns></returns>
        public String registerContact(DialogueSetting dialogueSetting, TripolisDialogueAdapter.BO.KeyValuePair[] ContactInfos)
        {

            logger.Debug(System.Environment.NewLine + "Begin Register Contact.");
            String result = "OK";
            try
            {

                String contactDatabaseId = dialogueSetting.contactDatabaseId;
                String workspaceId = dialogueSetting.workspaceId;
               // String emailTypeId = dialogueSetting.emailTypeId;
                String directEmailId = dialogueSetting.directEmailId;


              
                cn.tripolis.dialogue.subscription.subscribeContactRequest request = new cn.tripolis.dialogue.subscription.subscribeContactRequest();
                request.contactDatabase = new cn.tripolis.dialogue.subscription.IdNameModel();
                request.contactDatabase.id = contactDatabaseId;
                request.workspace = new cn.tripolis.dialogue.subscription.IdNameModel();
                request.workspace.id = workspaceId;

                request.contactFields = new cn.tripolis.dialogue.subscription.ContactFieldValue[ContactInfos.Length];
                cn.tripolis.dialogue.subscription.ContactFieldValue contactFieldValue;
                int i = 0;
                foreach (TripolisDialogueAdapter.BO.KeyValuePair keyValuePair in ContactInfos)
                {
                    contactFieldValue = new cn.tripolis.dialogue.subscription.ContactFieldValue();
                    contactFieldValue.name = keyValuePair.key;
                    contactFieldValue.value = keyValuePair.value;
                    request.contactFields.SetValue(contactFieldValue, i++);
                }
                if (!string.IsNullOrEmpty(directEmailId))
                {
                    request.directEmail = new cn.tripolis.dialogue.subscription.IdNameModel();
                    request.directEmail.id = directEmailId;
                }
                request.ip = "127.0.0.1";

                cn.tripolis.dialogue.subscription.IDResponse response = subscriptionService.subscribeContact(request);

                String contactId = response.id;


                result = contactId;
            }
            catch (System.Web.Services.Protocols.SoapException ex)
            {
                result = ex.Message;
                logger.Debug("error happen in send mail, error is " + result);
            }
            catch (Exception ex)
            {
                result = ex.Message;
                logger.Debug("error happen in send mail, error is " + result);
                // return ex.Message;

            }
            logger.Debug("Finish register Contact. Contact Id is " + result);
            return result;
        }
Esempio n. 3
0
        /// <summary>
        /// send single email 
        /// </summary>
        /// <param name="dialogueSetting">Dialogue setting, such as database Id, workspaceId</param>
        /// <param name="directEmail">parameters related with direct email, such as subject, fromaddress</param>
        /// <param name="ContactInfos">parameters related with contact information, such as email Id.</param>
        /// <returns></returns>
        public String sendSingleEmail(DialogueSetting dialogueSetting, DirectEmail directEmail, TripolisDialogueAdapter.BO.KeyValuePair[] ContactInfos)
        {

            logger.Debug(System.Environment.NewLine + "Begin sending Single Email.");
            String result = "OK";
            try
            {

                String contactDatabaseId = dialogueSetting.contactDatabaseId;
                String workspaceId = dialogueSetting.workspaceId;
                String emailTypeId = dialogueSetting.emailTypeId;
                String directEmailId = dialogueSetting.directEmailId;


                //查找<A的html标记,如果里面没有title属性,则增加这个属性.
                directEmail.htmlContent = Util.addTitleInAFlagHtml(directEmail.htmlContent);

                cn.tripolis.dialogue.subscription.subscribeContactRequest request = new cn.tripolis.dialogue.subscription.subscribeContactRequest();
                request.contactDatabase = new cn.tripolis.dialogue.subscription.IdNameModel();
                request.contactDatabase.id = contactDatabaseId;
                request.workspace = new cn.tripolis.dialogue.subscription.IdNameModel();
                request.workspace.id = workspaceId;

                request.contactFields = new cn.tripolis.dialogue.subscription.ContactFieldValue[ContactInfos.Length];
                cn.tripolis.dialogue.subscription.ContactFieldValue contactFieldValue;
                int i = 0;
                foreach (TripolisDialogueAdapter.BO.KeyValuePair keyValuePair in ContactInfos)
                {
                    contactFieldValue = new cn.tripolis.dialogue.subscription.ContactFieldValue();
                    contactFieldValue.name = keyValuePair.key;
                    contactFieldValue.value = keyValuePair.value;
                    request.contactFields.SetValue(contactFieldValue, i++);
                }

                request.ip = "127.0.0.1";

                cn.tripolis.dialogue.subscription.IDResponse response = subscriptionService.subscribeContact(request);

                String contactId = response.id;

                DirectEmailAction directEmailAction = new DirectEmailAction(client, userName, password, oWebProxy);
                directEmailId = directEmailAction.createDirectEmail(emailTypeId, directEmail.emailLabel, directEmail.emailName, directEmail.subject, directEmail.description, directEmail.fromName, directEmail.fromAddress, directEmail.htmlContent);
                // directEmailAction.updateDirectEmail(directEmailId, directEmail.subject, directEmail.fromName, directEmail.htmlContent);

                PublishingAction publishingAction = new PublishingAction(client, userName, password, oWebProxy);
                String publishId = publishingAction.publishTransactionalEmail(contactId, directEmailId, directEmail.sheduleTime);


                //  SendLogDao dbAccess = new SendLogDao();
                //  dbAccess.SengLog_InsertInfo(new String[] { emailId, publishId, batchNo });
                result = publishId;
            }
            catch (System.Web.Services.Protocols.SoapException ex)
            {
                result = ex.Message;
                logger.Debug("error happen in send mail, error is " + result);
            }
            catch (Exception ex)
            {
                result = ex.Message;
                logger.Debug("error happen in send mail, error is " + result);
                // return ex.Message;

            }
            logger.Debug("Finish sending Single Email. Publish Id is " + result);
            return result;
        }
Esempio n. 4
0
 /// <summary> 
 /// 添加数据库记录 
 /// </summary> 
 /// <param name="feedbackBO">信息数组</param> 
 public void Feedback_updateInfoForClicked(TripolisDialogueAdapter.DAO.FeedbackBO feedbackBO)
 {
     try
     {
         if (!Feedback_IsRecordExist(feedbackBO.jobId))
         {
             comm = new OleDbCommand("insert into [Feedback] ([jobId],[email],[linkid],[ipAddress],[browse],[clicked],[updateDate]) values ('" 
                 + feedbackBO.jobId + "','" + feedbackBO.email + "','" + feedbackBO.linkid + "','"
                 + feedbackBO.ipAddress + "','" + feedbackBO.browse + "','" + feedbackBO.clicked + "',Now())", conn);
         }
         else
         {
             comm = new OleDbCommand("update [Feedback] set  [bouncedate]=null,[bouncecode]=null,[bounceDecription]=null,[hardbounce]=null,[email]='" 
                 + feedbackBO.email + "',[linkid]='" + feedbackBO.linkid 
                 + "',[ipAddress]='" + feedbackBO.ipAddress + "',[browse]='" + feedbackBO.browse
                 + "',[clicked]='" + feedbackBO.clicked + "',[updatedate]=Now() where jobId='" + feedbackBO.jobId + "'", conn);
         }
         conn.Open();
         comm.ExecuteNonQuery();
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
         //MessageBox.Show("添加失败"); 
     }
     finally
     {
         conn.Close();
     }
 }