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 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 string CampaignMainFrameAdd(CampaignMainFrame request) { try { using (ACM_Redesign2014Context ctx = new ACM_Redesign2014Context()) { ctx.CampaignMainFrames.Add(request); ctx.SaveChanges(); } } catch (Exception ex) { Error.WriteException(TraceEventType.Error, ex.Message.ToString(), "CampaignMainFrameAdd"); throw; } return "Successfully added"; }
public string DeploymentModification(ACM.Model.DeploymentPeriod 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(), "DeploymentModification"); 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 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 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 CampaignMainFrameMod(CampaignMainFrame 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(), "CampaignMainFrameMod"); throw; } return "Successfully updated"; }
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"; }