Example #1
0
 public static EPUser GetUser(string username)
 {
     UserService userService = new UserService();
     return userService.GetUser(username);
 }
Example #2
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;
 }
Example #3
0
 private bool SendCampaign(Campaign campaign)
 {
     var user = new UserService().GetUser(campaign.CreatedBy);
     if (campaign != null && user != null)
     {
         if (campaign.StatusId == (int)CampaignStatus.Scheduled)
         {
             campaignService.UpdateCampaignStatus(campaign.Id, CampaignStatus.Progress);
         }
         if (campaign.TypeId == (int)CampaignType.Email)
         {
             if (emailCount < _emailBatchSize)
             {
                 var emailList = campaignService.GetCampaignEmails(campaign.Id, MessageStatus.New).Take(_emailBatchSize - emailCount).ToList();
                 SendEmails(user, emailList);
             }
         }
         else
         {
             if (smsCount < _smsBatchSize)
             {
                 var smsList = campaignService.GetCampaignSmses(campaign.Id, MessageStatus.New).Take(_smsBatchSize - smsCount);
                 SendSmes(user, smsList);
             }
         }
         UpdateCampaignPercentage(campaign);
         return true;
     }
     else
     {
         return false;
     }
 }