public CampaignSetupModel()
 {
     ProductGroup = new ProductGroupModel();
     AdModelProp = new AdModel();
     BillingLaunch = new BillingLaunchModel();
     // for categories
     AllCategories = new List<CategoriesModel>();
     SelectedCategories = new List<CategoriesModel>();
     CategoryIds = new List<int>();
     // for keywords
     AllKeywords = new List<KeywordsModel>();
     SelectedKeywords = new List<KeywordsModel>();
     KeywordIds = new List<int>();
     
 }
 public CampaignSetupModel()
 {
     ProductGroup = new ProductGroupModel();
     AdModelProp = new AdModel();
     BillingLaunch = new BillingLaunchModel();
     // for categories
     AllCategories = new List<CategoriesModel>();
     SelectedCategories = new List<CategoriesModel>();
     CategoryIds = new List<int>();
     // for keywords
     AllKeywords = new List<KeywordsModel>();
     AllKeywordProbabilityObjects = new List<KeywordProbabilityObject>();
     SelectedKeywords = new List<KeywordsModel>();
     KeywordIds = new List<int>();
     SiteLinks = new List<SiteLink>();
     Configuration = new SemplestModel.Semplest().Configurations.Single();
 }
 public ActionResult NegativeKeyWords(AdModel model)
 {
     if (Session["NegativeKeywords"] != null)
     {
         model.NegativeKeywords = (List<string>)Session["NegativeKeywords"];
         model.NegativeKeywordsText = (string)Session["NegativeKeywordsText"];
     }
     return PartialView(model);
 }
 public ActionResult SetNegativeKeywords(AdModel model)
 {
     try
     {
         if (!string.IsNullOrEmpty(model.NegativeKeywordsText))
         {
             var addl = model.NegativeKeywordsText.Split(',').ToList();
             addl.ForEach(t => model.NegativeKeywords.Add(t.Trim()));
         }
         Session["NegativeKeywords"] = model.NegativeKeywords;
         Session["NegativeKeywordsText"] = model.NegativeKeywordsText;
         var csm = (CampaignSetupModel) Session["CampaignSetupModel"];
         var cred =
             (Credential) (Session[Semplest.SharedResources.SEMplestConstants.SESSION_USERID]);
         var customerFK = cred.User.CustomerFK;
         csm.AdModelProp.NegativeKeywords = model.NegativeKeywords;
         csm.AdModelProp.NegativeKeywordsText = model.NegativeKeywordsText;
         csm.AllKeywords = _campaignRepository.SaveNegativeKeywords(csm, customerFK.Value);
         return Json("NegativeKeywords");
     }
     catch (Exception ex)
     {
         Semplest.SharedResources.Helpers.ExceptionHelper.LogException(ex);
         return Json(ExceptionHelper.GetErrorMessage(ex));
     }
 }
        public ActionResult SetNegativeKeywords(AdModel model)
        {
            if (string.IsNullOrEmpty(model.NegativeKeywordsText))
                return Json("NegativeKeywords");
            var addl = model.NegativeKeywordsText.Split(',').ToList();
            addl.ForEach(t => model.NegativeKeywords.Add(t.Trim()));
            Session["NegativeKeywords"] = model.NegativeKeywords;
            Session["NegativeKeywordsText"] = model.NegativeKeywordsText;
            //SemplestDataService.CheckForNegativeKeywords(model.NegativeKeywords);
            //SemplestDataService ds = new SemplestDataService();
            //int userid = 1;
            //CampaignSetupModel fullmodel = 
            //ds.SaveNegativeKeywords(userid, model);

            return Json("NegativeKeywords");
        }
 public ActionResult SetNegativeKeywords(AdModel model)
 {
     try
     {
         if (!string.IsNullOrEmpty(model.NegativeKeywordsText))
         {
             var addl = model.NegativeKeywordsText.Split(',').ToList();
             addl.ForEach(t => model.NegativeKeywords.Add(t.Trim()));
         }
         Session["NegativeKeywords"] = model.NegativeKeywords;
         Session["NegativeKeywordsText"] = model.NegativeKeywordsText;
         var csm = (CampaignSetupModel) Session["CampaignSetupModel"];
         csm.AdModelProp.NegativeKeywords = model.NegativeKeywords;
         csm.AdModelProp.NegativeKeywordsText = model.NegativeKeywordsText;
         
         var rs = _campaignRepository.SaveNegativeKeywords(csm, GetCustomerId());
         if(!rs.IsException && !rs.IsValidationError)
         {
             csm.AllKeywords.Clear();
             csm.AllKeywords = (List<CampaignSetupModel.KeywordsModel>)rs.ReturnObject;
             return Json("NegativeKeywords");
         }
         if (!rs.IsException && rs.IsValidationError)
             return Json("Validation Error<~> " + rs.ReturnMessage);
         return Json(ConfigurationManager.AppSettings["TechnicalDifficulties"]);
         
     }
     catch (Exception ex)
     {
         ExceptionHelper.LogException(ex);
         return Json(ExceptionHelper.GetErrorMessage(ex));
     }
 }
 public ActionResult AdModel(AdModel model)
 {
     return PartialView(model);
 }