예제 #1
0
 public bool SendTestCampaign(int campaignId, string recepient)
 {
     CampaignService campaignService = new CampaignService();
     var campaign = campaignService.GetCampaign(campaignId);
     var user = new UserService().GetUser(campaign.CreatedBy);
     bool response = false;
     if (campaign.TypeId == (int)CampaignType.SMS)
     {
         SmsModule smsModule = new SmsModule(user.SmsUsername, user.SmsPassword);
         response = smsModule.SendSMS(recepient, campaign.ContentTemplate);
     }
     else
     {
         EmailModule emailModule = new EmailModule(user.EmailUsername, user.EmailPassword);
         response = emailModule.SendEmail(user.Name, recepient, "", "", campaign.SubjectTemplate, campaign.ContentTemplate);
     }
     return response;
 }
예제 #2
0
 private void SendSmes(EPUser user, IEnumerable<Sms> smsList)
 {
     if (smsList.Count() > 0)
     {
         SmsModule smsModule = new SmsModule(user.EmailUsername, user.EmailPassword);
         foreach (var sms in smsList)
         {
             bool smsSuccess = smsModule.SendSMS(sms.ToNumber, sms.Content);
             sms.StatusId = smsSuccess ? (int)MessageStatus.Send : (int)MessageStatus.Failed;
             sms.StatusDate = DateTime.Now;
             smsCount += 1;
         }
         campaignService.UpdateCampaignSmses(smsList);
     }
 }