public static bool AssignCampaignToSession(AsCampaign campaign, long idfMonitoringSession) { using (DbManagerProxy manager = DbManagerFactory.Factory.Create(eidss.model.Core.EidssUserContext.Instance)) { AsSession session = AsSession.Accessor.Instance(null).SelectByKey(manager, idfMonitoringSession); if (session != null && campaign.Sessions.Count(s => s.idfMonitoringSession == session.idfMonitoringSession && !s.IsMarkedToDelete) == 0) { if (campaign.ValidateSessionAssignment(session)) { //session.CampaignInRamOnly = campaign; session.SetCampaignForTest(campaign); session.idfCampaign = campaign.idfCampaign; var temp = session.CampaignInRamOnly; campaign.Sessions.Add(AsMonitoringSession.CreateFromASSession(manager, campaign, session)); } } } return(true); }
public static bool AssignCampaignToSession(AsCampaign campaign, AsSession session) { if (session == null) { return(false); } using (DbManagerProxy manager = DbManagerFactory.Factory.Create(eidss.model.Core.EidssUserContext.Instance)) { if (campaign.ValidateSessionAssignment(session)) { //session.CampaignInRamOnly = campaign; session.SetCampaignForTest(campaign); session.idfCampaign = campaign.idfCampaign; var temp = session.CampaignInRamOnly; campaign.Sessions.Add(AsMonitoringSession.CreateFromASSession(manager, campaign, session)); } } return(true); }