Beispiel #1
0
 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;
     }
 }
Beispiel #2
0
        public string AdAdRestrictionFlagAdd(ACM.Model.Ad ad, List <int> flags, bool applyAll = false)
        {
            List <ACM.Model.AdRestrictionAd> requestRestrictionAds = new List <AdRestrictionAd>();

            ACM.Model.AdRestrictionAd requestRestrictionAd = new AdRestrictionAd();

            return(adDAO.AdAdRestrictionFlagAdd(ad.AdId, ad.CampaignId, flags, applyAll));
        }
 public List <ACM.Model.Ad> AdInfo(ACM.Model.Ad request)
 {
     try
     {
         return(adBO.AdInfo(request));
     }
     catch (Exception ex)
     {
         //Error.WriteException(TraceEventType.Error, ex.Message.ToString(), "AdInfo");
         throw;
     }
 }
Beispiel #4
0
 public string AdMod(ACM.Model.Ad 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");
 }
Beispiel #5
0
 public string AdDel(ACM.Model.Ad request)
 {
     try
     {
         using (ACM_Redesign2014Context ctx = new ACM_Redesign2014Context())
         {
             ACM.Model.Ad ad = ctx.Ads.Find(request.AdId);
             ctx.Ads.Remove(ad);
             ctx.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         Error.WriteException(TraceEventType.Error, ex.Message.ToString(), "AdDel");
         throw;
     }
     return("Successfully deleted");
 }
Beispiel #6
0
        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;
            }
        }
Beispiel #7
0
        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;
        }
Beispiel #8
0
        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");
        }
Beispiel #9
0
        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);
        }
Beispiel #10
0
 public ACM.Model.Ad AdInq(ACM.Model.Ad request)
 {
     return(adDAO.AdInq(request));
 }
 public List <AdOutStandingTask> GetOutstandingTask(ACM.Model.Ad request)
 {
     return(adBO.GetOutstandingTask(request));
 }
 public string AdAdRestrictionFlagAdd(Ad ad, List<int> flags, bool applyAll = false)
 {
     return adBO.AdAdRestrictionFlagAdd(ad, flags,applyAll);
 }
 public string UpdateAdRestriction(Ad request)
 {
     return adBO.UpdateAdRestriction(request);
 }
Beispiel #14
0
 public ACM.Model.Ad AdInq(ACM.Model.Ad request)
 {
     return(adProxy.AdInq(request));
 }
Beispiel #15
0
 public string UpdateAdRestriction(ACM.Model.Ad request)
 {
     return(adDAO.UpdateAdRestriction(request));
 }
Beispiel #16
0
 public string AdMod(ACM.Model.Ad request)
 {
     return(adDAO.AdMod(request));
 }
 public ACM.Model.Ad AdAdd(ACM.Model.Ad request)
 {
     return(adBO.AdAdd(request));
 }
Beispiel #18
0
 public string UpdateAdRestriction(ACM.Model.Ad request)
 {
     //return adProxy.UpdateAdRestriction(request);
     return(string.Empty);
 }
 public string AdDel(ACM.Model.Ad request)
 {
     return(adBO.AdDel(request));
 }
Beispiel #20
0
 public ACM.Model.Ad AdInq(ACM.Model.Ad request)
 {
     ACM.Model.Ad response = new ACM.Model.Ad();
     try
     {
         using (ctx = new ACM_Redesign2014Context())
         {
             ctx.Configuration.LazyLoadingEnabled = true;
             ctx.Configuration.ProxyCreationEnabled = false;
             response = (from ad in ctx.Ads
                         where ad.CampaignId == request.CampaignId && ad.AdId == request.AdId
                         select ad).FirstOrDefault();
             //   /ctx.Ads.Include("AdRestriction").ToList();
             ctx.Ads.Include("AdLocation").ToList();
             ctx.Ads.Include("AdProductType").ToList();
             ctx.Configuration.ProxyCreationEnabled = true;
         }
     }
     catch (Exception ex)
     {
         Error.WriteException(TraceEventType.Error, ex.Message.ToString(), "AdInq");
         throw;
     }
     return response;
 }