public Dictionary <int, int> GetAdRestrictionFlag(int campaignId, int adid) { string adRestrictionIds = string.Empty; Dictionary <int, int> res = new Dictionary <int, int>(); try { using (ctx = new ACM_Redesign2014Context()) { var result = (ctx.Database.SqlQuery <GetRestrictionFlag>("SP_GetAdRestrictionFlag @campaignId, @adid", new SqlParameter("campaignId", campaignId), new SqlParameter("adid", adid) )).ToList(); foreach (var item in result) { res.Add(item.CategoryID, item.RestrictionID); } adRestrictionIds = string.Join(",", result); } return(res); } catch (Exception ex) { Error.WriteException(TraceEventType.Error, ex.Message.ToString(), "GetAdRestrictionCode"); throw; } }
public List <ACM.Model.Campaign> CampaignInfo(ACM.Model.Campaign request) { List <ACM.Model.Campaign> response = new List <ACM.Model.Campaign>(); try { using (ACM_Redesign2014Context ctx = new ACM_Redesign2014Context()) { ctx.Configuration.ProxyCreationEnabled = false; if (request != null && request.RequestorId != null && request.RequestorId != 0) { response = (from campaign in ctx.Campaigns where campaign.RequestorId == request.RequestorId select campaign).ToList(); } else { response = (from campaign in ctx.Campaigns select campaign).ToList(); } ctx.Configuration.ProxyCreationEnabled = true; } } catch (Exception ex) { Error.WriteException(TraceEventType.Error, ex.Message.ToString(), "CampaignInfo"); throw; } return(response); }
public List <ACM.Model.Ad> AdInfo(ACM.Model.Ad request) { try { List <ACM.Model.Ad> response = new List <ACM.Model.Ad>(); using (ctx = new ACM_Redesign2014Context()) { ctx.Configuration.LazyLoadingEnabled = true; ctx.Configuration.ProxyCreationEnabled = false; response = (from ad in ctx.Ads where ad.CampaignId == request.CampaignId select ad).ToList(); // ctx.Ads.Include("AdRestriction").ToList(); ctx.Ads.Include("AdLocation").ToList(); ctx.Ads.Include("AdProductType").ToList(); ctx.Configuration.ProxyCreationEnabled = true; } return(response); } catch (Exception ex) { Error.WriteException(TraceEventType.Error, ex.Message.ToString(), "AdInfo"); throw; } }
public ACM.Model.DeploymentPeriod DeploymentPeriodAdd(ACM.Model.DeploymentPeriod request) { ACM.Model.DeploymentPeriod response = new ACM.Model.DeploymentPeriod(); try { using (ACM_Redesign2014Context ctx = new ACM_Redesign2014Context()) { request.CreatedDate = DateTime.Now; ctx.DeploymentPeriods.Add(request); ctx.SaveChanges(); ctx.Configuration.ProxyCreationEnabled = false; // IQueryable<ACM.Model.Campaign> response1 = ctx.Campaigns.Last(); response = (from deploymentperiod in ctx.DeploymentPeriods orderby deploymentperiod.DeploymentPeriodId descending select deploymentperiod).First(); ctx.Configuration.ProxyCreationEnabled = true; } } catch (Exception ex) { Error.WriteException(TraceEventType.Error, ex.Message.ToString(), "DeploymentPeriodAdd"); throw; } return(response); }
public List <ACM.Model.DeploymentPeriod> DeploymentPeriodInformation(ACM.Model.DeploymentPeriod request) { List <ACM.Model.DeploymentPeriod> response = new List <ACM.Model.DeploymentPeriod>(); try { using (ACM_Redesign2014Context ctx = new ACM_Redesign2014Context()) { ctx.Configuration.ProxyCreationEnabled = false; if (request != null) { response = (from deploymentperiod in ctx.DeploymentPeriods select deploymentperiod).ToList(); } ctx.Configuration.ProxyCreationEnabled = true; } } catch (Exception ex) { Error.WriteException(TraceEventType.Error, ex.Message.ToString(), "DeploymentPeriodInformation"); throw; } return(response); }
public List <CampaignFollowUp> CampaignFollowUpInfo(CampaignFollowUp request) { List <CampaignFollowUp> response = new List <CampaignFollowUp>(); try { using (ACM_Redesign2014Context ctx = new ACM_Redesign2014Context()) { if (request != null && request.CampaignId != 0) { response = (from campaignFollowUp in ctx.CampaignFollowUps where campaignFollowUp.CampaignId == request.CampaignId select campaignFollowUp).ToList(); } else { response = (from campaign in ctx.CampaignFollowUps select campaign).ToList(); } } } catch (Exception ex) { Error.WriteException(TraceEventType.Error, ex.Message.ToString(), "CampaignFollowUpInfo"); throw; } return(response); }
public ACM.Model.Campaign CampaignAdd(ACM.Model.Campaign request) { ACM.Model.Campaign response = new ACM.Model.Campaign(); try { using (ACM_Redesign2014Context ctx = new ACM_Redesign2014Context()) { request.CreatedDate = DateTime.Now; ctx.Campaigns.Add(request); ctx.SaveChanges(); ctx.Configuration.ProxyCreationEnabled = false; response = (from campaign in ctx.Campaigns where campaign.CampaignGuid == request.CampaignGuid orderby campaign.CampaignId descending select campaign).First(); ctx.Configuration.ProxyCreationEnabled = true; } } catch (Exception ex) { Error.WriteException(TraceEventType.Error, ex.Message.ToString(), "CampaignAdd"); throw; } return(response); }
public List <AdlocationList> AdLocationsByCampaign(int campaignId, int adid) { string status = "Edit"; if (adid == 0) { status = "New"; } try { using (ctx = new ACM_Redesign2014Context()) { var listItems = (ctx.Database.SqlQuery <AdlocationList>("SP_GetAdLocationsByCampaignType @CampaignId, @Status,@adid", new SqlParameter("CampaignId", campaignId), new SqlParameter("Status", status), new SqlParameter("adid", adid) )).ToList(); return(listItems); } } catch (Exception ex) { Error.WriteException(TraceEventType.Error, ex.Message.ToString(), "GetMasterDropDownDataforMasterTables"); throw; } }
public string AdAdRestrictionFlagAdd(int adid, int campaignId, List <int> flags, bool applyAll = false) { string retVal = string.Empty; try { if (flags.Count > 0) { var splitFlag = string.Join(",", flags); int applyToAllAd = 0; if (applyAll) { applyToAllAd = 1; } using (ACM_Redesign2014Context ctx = new ACM_Redesign2014Context()) { ctx.Database.ExecuteSqlCommand("SP_Adrestrictions @AdRestrictionId, @AdId, @CampaignId, @applyAll", new SqlParameter("AdRestrictionId", splitFlag), new SqlParameter("AdId", adid), new SqlParameter("CampaignId", campaignId), new SqlParameter("applyAll", applyToAllAd) ); } } } catch (Exception ex) { Error.WriteException(TraceEventType.Error, ex.Message.ToString(), "AdAdd"); throw; } return(retVal); }
public static IEnumerable <GetDropDownListByID> GetDropDownListByID(string MasterTableID, string MasterTableDescription, string MasterTableName) { List <GetDropDownListByID> listItems = new List <GetDropDownListByID>(); using (ACM_Redesign2014Context ctx = new ACM_Redesign2014Context()) { listItems = (ctx.Database.SqlQuery <GetDropDownListByID>("exec GetListforDropDown @Param1,@Param2,@Param3", new SqlParameter("Param1", MasterTableID), new SqlParameter("Param2", MasterTableDescription), new SqlParameter("Param3", MasterTableName) )).ToList(); } return(listItems); }
public string CampaigTargetFileAdd(CampaignTargetFileProvider request) { try { using (ACM_Redesign2014Context ctx = new ACM_Redesign2014Context()) { ctx.CampaignTargetFileProviders.Add(request); ctx.SaveChanges(); } } catch (Exception ex) { Error.WriteException(TraceEventType.Error, ex.Message.ToString(), "CampaigTargetFileAdd"); throw; } return("Successfully added"); }
public string AdStatusModify(ACM.Model.AdDeploymentPeriod request) { try { using (ACM_Redesign2014Context ctx = new ACM_Redesign2014Context()) { ctx.Entry(request).State = EntityState.Modified; ctx.SaveChanges(); } } catch (Exception ex) { Error.WriteException(TraceEventType.Error, ex.Message.ToString(), "AdMod"); throw; } return("Successfully updated"); }
public Restrictions GetAdRestrictionCategory() { Restrictions restriction = new Restrictions(); try { using (ctx = new ACM_Redesign2014Context()) { ctx.Configuration.LazyLoadingEnabled = true; var response = (from adres in ctx.AdRestrictions group adres by new { adres.ACMName, adres.AdRestrictionId } into r select new { ACMName = r.Key.ACMName, RestrictionID = r.Key.AdRestrictionId, ACMCategoryId = r.Max(d => d.ACMCategoryId) }).ToList(); List <Restrictions> restrictionList = new List <Restrictions>(); restriction.DepositoryType = new Dictionary <int, string>(); restriction.EFcutoff = new Dictionary <int, string>(); restriction.Other = new Dictionary <int, string>(); foreach (var item in response) { switch (item.ACMCategoryId) { case (Int32)AdRestrictionFlag.DepositoryType: restriction.DepositoryType.Add(item.RestrictionID, item.ACMName); break; case (Int32)AdRestrictionFlag.EFcutoff: restriction.EFcutoff.Add(item.RestrictionID, item.ACMName); break; case (Int32)AdRestrictionFlag.Other: restriction.Other.Add(item.RestrictionID, item.ACMName); break; } } } return(restriction); } catch (Exception ex) { Error.WriteException(TraceEventType.Error, ex.Message.ToString(), "GetAdRestrictionCategory"); throw; } }
public string CampaigTargetFileMod(CampaignTargetFileProvider request) { try { using (ACM_Redesign2014Context ctx = new ACM_Redesign2014Context()) { ctx.Entry(request).State = EntityState.Modified; ctx.SaveChanges(); } } catch (Exception ex) { Error.WriteException(TraceEventType.Error, ex.Message.ToString(), "CampaigTargetFileMod"); throw; } return("Successfully updated"); }
public string CampaignDel(ACM.Model.Campaign request) { try { using (ACM_Redesign2014Context ctx = new ACM_Redesign2014Context()) { ACM.Model.Campaign campaign = ctx.Campaigns.Find(request.CampaignId); ctx.Campaigns.Remove(request); ctx.SaveChanges(); } } catch (Exception ex) { Error.WriteException(TraceEventType.Error, ex.Message.ToString(), "CampaignDel"); throw; } return("Successfully deleted"); }
public string CampaignMod(ACM.Model.Campaign request) { try { using (ACM_Redesign2014Context ctx = new ACM_Redesign2014Context()) { request.ModifiedDate = DateTime.Now; ctx.Entry(request).State = EntityState.Modified; ctx.SaveChanges(); } } catch (Exception ex) { Error.WriteException(TraceEventType.Error, ex.Message.ToString(), "CampaignMod"); throw; } return("Successfully updated"); }
public List <GetDropDownListByID> GetAvailableDeploymentPeriod(int campaignId) { try { List <GetDropDownListByID> listItems = new List <GetDropDownListByID>(); using (ACM_Redesign2014Context ctx = new ACM_Redesign2014Context()) { listItems = (ctx.Database.SqlQuery <GetDropDownListByID>("exec SP_DeploymentPeriod @campaignId", new SqlParameter("campaignId", campaignId) )).ToList(); } return(listItems); } catch (Exception ex) { Error.WriteException(TraceEventType.Error, ex.Message.ToString(), "GetAvailableDeploymentPeriod"); throw; } }
public ACM.Model.CustomModel.AdInfo AdInfoInq(int campaignId, int adid, int deploymentPeriodId) { ACM.Model.CustomModel.AdInfo adInfo = new Model.CustomModel.AdInfo(); List <AdRestrictions> listRes = new List <AdRestrictions>(); try { using (ctx = new ACM_Redesign2014Context()) { var listItems = (ctx.Database.SqlQuery <AdInfo_Result>("AdInfo @DeploymentPeriodId, @CampaignId, @Adid", new SqlParameter("DeploymentPeriodId", deploymentPeriodId), new SqlParameter("CampaignId", campaignId), new SqlParameter("Adid", adid) )).SingleOrDefault(); adInfo.Ad = listItems; var adResInfo = (from ad in ctx.AdRestrictionAds where ad.CampaignId == campaignId && ad.AdId == adid select new { Id = ad.Id, AdRestrictionId = ad.AdRestrictionId, AdId = ad.AdId, CampaignId = ad.CampaignId }).ToList(); AdRestrictions adRes = new AdRestrictions(); foreach (var item in adResInfo) { adRes = new AdRestrictions(); adRes.AdId = item.AdId; adRes.AdRestrictionId = item.AdRestrictionId; adRes.CampaignId = item.CampaignId; adRes.Id = item.Id; listRes.Add(adRes); } adInfo.AdRestriction = listRes; } return(adInfo); } catch (Exception ex) { Error.WriteException(TraceEventType.Error, ex.Message.ToString(), "GetMasterDropDownDataforMasterTables"); throw; } }
public static IEnumerable <GetDataForDropDownList> GetMasterDropDownDataforMasterTables(string MasterTableID, string MasterTableDescription, string MasterTableName) { ACM_Redesign2014Context ctx = new ACM_Redesign2014Context(); try { var listItems = (ctx.Database.SqlQuery <GetDataForDropDownList>("exec GetListforDropDown @Param1,@Param2,@Param3", new SqlParameter("Param1", MasterTableID), new SqlParameter("Param2", MasterTableDescription), new SqlParameter("Param3", MasterTableName) )).ToList(); return(listItems); } catch (Exception ex) { Error.WriteException(TraceEventType.Error, ex.Message.ToString(), "GetMasterDropDownDataforMasterTables"); throw; } }
public List <AdOutStandingTask> GetOutstandingTask(ACM.Model.Ad request) { List <AdOutStandingTask> response = new List <AdOutStandingTask>(); try { using (ctx = new ACM_Redesign2014Context()) { ctx.Configuration.LazyLoadingEnabled = true; response = (from tasks in ctx.AdOutStandingTasks where tasks.AdId == request.AdId select tasks).ToList(); } return(response); } catch (Exception ex) { Error.WriteException(TraceEventType.Error, ex.Message.ToString(), "GetOutstandingTask"); throw; } }
public List <AdInfo_Result> AdsByCampaign(int campaignId, int deploymentPeriodId) { try { using (ctx = new ACM_Redesign2014Context()) { var listItems = (ctx.Database.SqlQuery <AdInfo_Result>("AdInfo @DeploymentPeriodId, @CampaignId", new SqlParameter("DeploymentPeriodId", deploymentPeriodId), new SqlParameter("CampaignId", campaignId) )).ToList(); return(listItems); } } catch (Exception ex) { Error.WriteException(TraceEventType.Error, ex.Message.ToString(), "GetMasterDropDownDataforMasterTables"); throw; } }
public ACM.Model.DeploymentPeriod DeploymentPeriodInquiry(ACM.Model.DeploymentPeriod request) { ACM.Model.DeploymentPeriod response = new ACM.Model.DeploymentPeriod(); try { using (ACM_Redesign2014Context ctx = new ACM_Redesign2014Context()) { ctx.Configuration.LazyLoadingEnabled = true; ctx.Configuration.ProxyCreationEnabled = false; if (request != null) { response = ctx.DeploymentPeriods.Find(request.DeploymentPeriodId); } } } catch (Exception ex) { Error.WriteException(TraceEventType.Error, ex.Message.ToString(), "DeploymentPeriodInquiry"); throw; } return(response); }
public ACM.Model.AdDeploymentPeriod AdStatusInquiry(ACM.Model.AdDeploymentPeriod request, int deploymentPeriodId) { ACM.Model.AdDeploymentPeriod response = new ACM.Model.AdDeploymentPeriod(); try { using (ctx = new ACM_Redesign2014Context()) { ctx.Configuration.LazyLoadingEnabled = true; ctx.Configuration.ProxyCreationEnabled = false; response = (from ad in ctx.AdDeploymentPeriods where ad.CampaignId == request.CampaignId && ad.Adid == request.Adid && ad.DeploymentPeriodId == deploymentPeriodId select ad).FirstOrDefault(); ctx.Configuration.ProxyCreationEnabled = true; } } catch (Exception ex) { Error.WriteException(TraceEventType.Error, ex.Message.ToString(), "AdInq"); throw; } return(response); }
public string CampaignMainFrameDel(CampaignMainFrame request) { try { using (ACM_Redesign2014Context ctx = new ACM_Redesign2014Context()) { ctx.Configuration.ProxyCreationEnabled = false; CampaignMainFrame campaign = ctx.CampaignMainFrames.Find(request.CampaignId); ctx.CampaignMainFrames.Remove(campaign); ctx.SaveChanges(); ctx.Configuration.ProxyCreationEnabled = true; } } catch (Exception ex) { Error.WriteException(TraceEventType.Error, ex.Message.ToString(), "CampaignMainFrameDel"); throw; } return("Successfully deleted"); }
public string InsertAdDeploymentPeriod(int campaignId, int adid, int deploymentPeriodId, bool applyAllDeployments) { string retVal = string.Empty; try { using (ACM_Redesign2014Context ctx = new ACM_Redesign2014Context()) { int applyToAllDeployment = 0; if (applyAllDeployments) { applyToAllDeployment = 1; } ACM.DAO.DeploymentPeriodDAO dao = new DeploymentPeriodDAO(); var allDeploymentPeriods = dao.GetFutureDeploymentPeriod(campaignId, deploymentPeriodId); List <string> ads = new List <string>(); foreach (var item in allDeploymentPeriods) { ads.Add(item.ID.ToString()); } string adList = string.Join(",", ads.ToList()); ctx.Database.ExecuteSqlCommand("SP_AddDeploymentPeriod @CampaignId, @AdId, @DeploymentPeriodId,@DeploymentPeriodIds, @applyAll", new SqlParameter("CampaignId", campaignId), new SqlParameter("AdId", adid), new SqlParameter("DeploymentPeriodId", deploymentPeriodId), new SqlParameter("DeploymentPeriodIds", adList), new SqlParameter("applyAll", applyToAllDeployment) ); } } catch (Exception ex) { Error.WriteException(TraceEventType.Error, ex.Message.ToString(), "InsertAdDeploymentPeriod"); throw; } return(retVal); }
public ACM.Model.Ad AdAdd(ACM.Model.Ad request) { ACM.Model.Ad response = new ACM.Model.Ad(); try { using (ACM_Redesign2014Context ctx = new ACM_Redesign2014Context()) { ctx.Ads.Add(request); ctx.SaveChanges(); response = (from ad in ctx.Ads where ad.AdGuid == request.AdGuid orderby ad.AdId descending select ad).First(); } } catch (Exception ex) { Error.WriteException(TraceEventType.Error, ex.Message.ToString(), "AdAdd"); throw; } return(response); }
public string UpdateAdRestriction(ACM.Model.Ad request) { try { using (ACM_Redesign2014Context ctx = new ACM_Redesign2014Context()) { var listAd = (from ads in ctx.Ads where ads.CampaignId == request.CampaignId select ads.AdId).ToList(); var some = ctx.Ads.Where(x => listAd.Contains(x.AdId)).ToList(); some.ForEach(a => a.AdRestrictionId = request.AdRestrictionId); ctx.SaveChanges(); } } catch (Exception ex) { Error.WriteException(TraceEventType.Error, ex.Message.ToString(), "UpdateAdRestriction"); throw; } return("Ad restriction applied for the campaign"); }
public List <CampaignTargetFileProvider> CampaigTargetFileInfo(CampaignTargetFileProvider request) { List <CampaignTargetFileProvider> response = new List <CampaignTargetFileProvider>(); try { using (ACM_Redesign2014Context ctx = new ACM_Redesign2014Context()) { if (request != null && request.CampaignId != 0) { response = (from campaignTargetFileProvider in ctx.CampaignTargetFileProviders where campaignTargetFileProvider.CampaignId == request.CampaignId select campaignTargetFileProvider).ToList(); } } } catch (Exception ex) { Error.WriteException(TraceEventType.Error, ex.Message.ToString(), "CampaigTargetFileInfo"); throw; } return(response); }
public ACM.Model.Campaign CampaignInq(ACM.Model.Campaign request) { ACM.Model.Campaign response = new ACM.Model.Campaign(); try { using (ACM_Redesign2014Context ctx = new ACM_Redesign2014Context()) { ctx.Configuration.LazyLoadingEnabled = true; ctx.Configuration.ProxyCreationEnabled = false; if (request != null) { response = ctx.Campaigns.Find(request.CampaignId); ctx.Campaigns.Include("CampaignTableStatu").ToList(); } } } catch (Exception ex) { Error.WriteException(TraceEventType.Error, ex.Message.ToString(), "CampaignInq"); throw; } return(response); }
public CampaignTargetFileProvider CampaigTargetFileInq(CampaignTargetFileProvider request) { CampaignTargetFileProvider response = new CampaignTargetFileProvider(); try { using (ACM_Redesign2014Context ctx = new ACM_Redesign2014Context()) { ctx.Configuration.ProxyCreationEnabled = false; if (request != null) { response = ctx.CampaignTargetFileProviders.Find(request.CampaignId); } ctx.Configuration.ProxyCreationEnabled = true; } } catch (Exception ex) { Error.WriteException(TraceEventType.Error, ex.Message.ToString(), "CampaigTargetFileInq"); throw; } return(response); }