public void Add(CmsCampaign campaign) { if (campaign.SubscriptionId == null) throw new ApplicationException("The subscription id for this campaign has not been set."); if (campaign.Guid == null) { //Make sure this tracking code hasn't been used CmsCampaign check = GetByTrackingCode(campaign.SubscriptionId, campaign.TrackingCode); if (check != null) throw new ArgumentException("The tracking code: " + campaign.TrackingCode + " has already been associated with camapaign: " + check.Name + " and may not be used again."); campaign.Guid = System.Guid.NewGuid().ToString(); } CmsCampaignDao dao = new CmsCampaignDao(); using (Transaction tx = new Transaction()) { dao.Save<CmsCampaign>(campaign); tx.Commit(); } }
public IList<CmsCampaign> GetCampaigns(Data.Guid siteGuid) { CmsCampaignDao dao = new CmsCampaignDao(); return dao.FindBySite(siteGuid); }
public CmsCampaign GetByTrackingCode(Data.Guid siteGuid, String trackingCode) { CmsCampaignDao dao = new CmsCampaignDao(); return dao.FindByTrackingCodeAndSite(siteGuid, trackingCode); }
public CmsCampaign GetCampaign(Data.Guid siteGuid, Data.Guid campaignGuid) { CmsCampaignDao dao = new CmsCampaignDao(); return dao.FindBySiteAndGuid(siteGuid,campaignGuid); }
public void Delete(Data.Guid siteGuid, Data.Guid guid) { CmsCampaign campaign = GetCampaign(siteGuid, guid); if (campaign != null) { //Delete it from the subscription itself SubscriptionManager.RemovePhoneFromSubscription(CurrentSite.Guid, campaign.PhoneNumber); CmsCampaignDao dao = new CmsCampaignDao(); using (Transaction tx = new Transaction()) { dao.Delete<CmsCampaign>(campaign); tx.Commit(); } } }