public CampaignLogComponent(Guid CampaignLogId) { if (CampaignLogId != Guid.Empty) { mifnexsoEntities = new MIFNEXSOEntities(); try { campaignLog = mifnexsoEntities.CampaignLogs.FirstOrDefault(a => a.CampaignLogId == CampaignLogId); if (campaignLog == null) { campaignLog = new CampaignLog(); campaignLog.CampaignLogId = Guid.Empty; mifnexsoEntities.CampaignLogs.AddObject(campaignLog); } } catch (Exception) { throw; } } else { campaignLog = new CampaignLog(); campaignLog.CampaignLogId = Guid.Empty; mifnexsoEntities.CampaignLogs.AddObject(campaignLog); } }
/// <summary> /// load the campaign through a CampaingLogId /// </summary> private void LoadObjects() { if (CampaingLogId != Guid.Empty) { if (Session["MailPreview"] != null) { var obj = (List <CampaignLog>)Session["MailPreview"]; campaingLog = obj.FirstOrDefault(a => a.CampaignLogId == CampaingLogId); } else { var cmm = new CampaignLogComponent(CampaingLogId); campaingLog = cmm.CampaignLog; } } }
public void Update(CampaignLog campaignLog) { _campaignLogDal.Update(campaignLog); }
private static CampaignLog getCampaignLog(CampaignComponent campaign, UserProperty userProperty, UserInfo user) { CampaignLog return_ = new CampaignLog(); string mail = userProperty.email; if (user != null) { mail = user.Email; } string template = campaign.Campaign.CampaignTemplate.TemplateContent; if (!string.IsNullOrEmpty(template)) { template = template.Replace("{USER:UserId}", userProperty.UserId.ToString()); template = template.Replace("{USER:Agreement}", userProperty.Agreement); template = template.Replace("{USER:SkypeName} ", userProperty.SkypeName); template = template.Replace("{USER:Twitter}", userProperty.Twitter); template = template.Replace("{USER:FaceBook}", userProperty.FaceBook); template = template.Replace("{USER:Google}", userProperty.Google); template = template.Replace("{USER:LinkedIn}", userProperty.LinkedIn); template = template.Replace("{USER:OtherSocialNetwork} ", userProperty.OtherSocialNetwork); template = template.Replace("{USER:City}", userProperty.City); template = template.Replace("{USER:Region}", userProperty.Region); template = template.Replace("{USER:Country}", userProperty.Country); template = template.Replace("{USER:PostalCode}", userProperty.PostalCode); template = template.Replace("{USER:Telephone} ", userProperty.Telephone); template = template.Replace("{USER:Address}", userProperty.Address); template = template.Replace("{USER:FirstName}", userProperty.FirstName); template = template.Replace("{USER:LastName}", userProperty.LastName); template = template.Replace("{USER:email}", mail); template = template.Replace("{USER:CustomerType}", userProperty.CustomerType.ToString()); template = template.Replace("{USER:NexsoEnrolment}", userProperty.FirstName); template = template.Replace("{USER:AllowNexsoNotifications}", userProperty.AllowNexsoNotifications.ToString()); template = template.Replace("{USER:Language}", userProperty.Language.ToString()); template = template.Replace("{USER:Latitude}", userProperty.Latitude.ToString()); template = template.Replace("{USER:Longitude}", userProperty.Longitude.ToString()); template = template.Replace("{USER:GoogleLocation}", userProperty.GoogleLocation); } return_.MailContent = template; template = campaign.Campaign.CampaignTemplate.TemplateSubject; if (!string.IsNullOrEmpty(template)) { template = template.Replace("{USER:UserId}", userProperty.UserId.ToString()); template = template.Replace("{USER:Agreement}", userProperty.Agreement); template = template.Replace("{USER:SkypeName} ", userProperty.SkypeName); template = template.Replace("{USER:Twitter}", userProperty.Twitter); template = template.Replace("{USER:FaceBook}", userProperty.FaceBook); template = template.Replace("{USER:Google}", userProperty.Google); template = template.Replace("{USER:LinkedIn}", userProperty.LinkedIn); template = template.Replace("{USER:OtherSocialNetwork} ", userProperty.OtherSocialNetwork); template = template.Replace("{USER:City}", userProperty.City); template = template.Replace("{USER:Region}", userProperty.Region); template = template.Replace("{USER:Country}", userProperty.Country); template = template.Replace("{USER:PostalCode}", userProperty.PostalCode); template = template.Replace("{USER:Telephone} ", userProperty.Telephone); template = template.Replace("{USER:Address}", userProperty.Address); template = template.Replace("{USER:FirstName}", userProperty.FirstName); template = template.Replace("{USER:LastName}", userProperty.LastName); template = template.Replace("{USER:email}", mail); template = template.Replace("{USER:CustomerType}", userProperty.CustomerType.ToString()); template = template.Replace("{USER:NexsoEnrolment}", userProperty.FirstName); template = template.Replace("{USER:AllowNexsoNotifications}", userProperty.AllowNexsoNotifications.ToString()); template = template.Replace("{USER:Language}", userProperty.Language.ToString()); template = template.Replace("{USER:Latitude}", userProperty.Latitude.ToString()); template = template.Replace("{USER:Longitude}", userProperty.Longitude.ToString()); template = template.Replace("{USER:GoogleLocation}", userProperty.GoogleLocation); } return_.MailSubject = template; return_.email = mail; return_.userId = userProperty.UserId; return_.CreatedOn = DateTime.Now; return_.CampaignLogId = Guid.NewGuid(); return(return_); }
public void Add(CampaignLog campaignLog) { _campaignLogDal.Add(campaignLog); }