Esempio n. 1
0
 private int SendAnEmail(MessageContent emailMessage)
 {
     int result;
     try
     {                  
         VfsCustomerService.Business.SendTemplateEmailWithParam sendTemplateEmailWithParam = new SendTemplateEmailWithParam();                
         sendTemplateEmailWithParam.Send(emailMessage);
         result = (int)EmailCommandStatus.SuccessAndFinish;
     }
     catch (Exception ex)
     {
         SendEmailException sendEmailException = new SendEmailException(emailMessage, ex);
         listError.Add(sendEmailException);                
         result = (int)EmailCommandStatus.FailAndFinish;
     }
     return result;
 }
Esempio n. 2
0
        private int SendAnEmail(MessageContent emailMessage)
        {
            int result;
            try
            {
               // EmailMessageService.EmailMessageWS emailMessageService = new EmailMessageService.EmailMessageWS();
                //emailMessageService.SendAnEmail(emailMessage);
                VfsCustomerService.Business.SendTemplateEmailWithParam sendTemplateEmailWithParam = new SendTemplateEmailWithParam();
                sendTemplateEmailWithParam.SmtpServer = "mail.vfs.com.vn";
                sendTemplateEmailWithParam.SmtpPort = 25;

                sendTemplateEmailWithParam.Send(emailMessage);
                
                result = (int)EmailCommandStatus.SuccessAndFinish;
            }
            catch (Exception ex)
            {
                SendEmailException sendEmailException = new SendEmailException(emailMessage, ex);
                listError.Add(sendEmailException);                
                result = (int)EmailCommandStatus.FailAndFinish;
            }
            return result;
        }
Esempio n. 3
0
    protected void Send_Click(object sender, EventArgs e)
    {
        if (this.templateDropDownList.SelectedValue == "0" || this.templateDropDownList.SelectedValue == string.Empty)
        {
            messageLiteral.Text = Resources.UIResource.InvalidTemplateContent;
            messageLiteral.Visible = true;
            return;
        }

        if (Page.IsValid == false)
            return;
        try
        {
            this.GetContentTemplate();
            if (contentTemplate != null)
            {
                MessageContent messageContent = new MessageContent();
                messageContent.BodyContentType = contentTemplate.BodyContentType;
                messageContent.BodyEncoding = contentTemplate.BodyEncoding;
                messageContent.BodyMessage = contentTemplate.BodyMessage;
                messageContent.ContentTemplateID = contentTemplate.ContentTemplateID;
                messageContent.CreatedDate = DateTime.Now;
                messageContent.ModifiedDate = DateTime.Now;
                messageContent.Receiver = this.receiverTextBox.Text;
                messageContent.Sender = contentTemplate.Sender;
                messageContent.ServiceTypeID = contentTemplate.ServiceTypeID;
                messageContent.Subject = contentTemplate.Subject;

                if (contentTemplate.ServiceTypeID == 1)
                {
                    VfsCustomerService.Business.SendTemplateEmailWithParam sendMail = new SendTemplateEmailWithParam();
                    contentTemplate.Receiver = this.receiverTextBox.Text;
                    sendMail.Send(contentTemplate);
                }
                else
                {
                    SendSMS sendSMS = new SendSMS();
                    sendSMS.UserName = ApplicationHelper.SmsUserName;
                    sendSMS.Password = ApplicationHelper.SmsPassword;
                    sendSMS.Send(messageContent);
                }

                messageLiteral.Text = Resources.UIResource.MeesageSucessfullySent;
                messageLiteral.Visible = true;
            }
        }
        catch (Exception ex)
        {
            messageLiteral.Text = Resources.UIResource.SimulationError + " :" + ex.Message;
            messageLiteral.Visible = true;
            log4net.Util.LogLog.Error(ex.InnerException.Message);
        }
    }