Ejemplo n.º 1
0
        public ActionResult CampaignSetup(CampaignSetupModel cs, string command)
        {

            if (command == "") command = "";

            var logEnty = new LogEntry {ActivityId = Guid.NewGuid(), Message = "Loading CampaignSetup Controller"};
            Logger.Write(logEnty);
            //var logService = new LogService();
            //logService.AddToLog(1, "Campaign Setup Accessed", "CampaignSetup//CampaignSetup//CampaignSetup", 1);
            //var scw = new ServiceClientWrapper();
            //scw.SendEmail("subject", "*****@*****.**", "*****@*****.**", "test mail");

            //var campaignSetupModel = new CampaignSetupModel();
            Session["SiteLinks"] = null;
            Session["NegativeKeywords"] = null;
            Session["NegativeKeywordsText"] = null;
            Session["CampaignSetupModel"] = cs;
            Session["AllCategories"] = null;
            ViewBag.IsLaunched = false;
            ViewBag.IsCompleted = false;
            ViewBag.IsLaunchedAndCompleted = false;
            cs.AdModelProp.IsNew = true;
            var dbContext = new SemplestModel.Semplest();
            var userid =
                ((Credential)System.Web.HttpContext.Current.Session[SharedResources.SEMplestConstants.SESSION_USERID]).
                    UsersFK;
            cs.BillType = dbContext.Users.First(key => key.UserPK == userid).Customer.BillTypeFK;
            return View(cs);
        }
Ejemplo n.º 2
0
 public HomeModelChild()
 {
     using (var entities = new SemplestModel.Semplest())
         Configuration = entities.Configurations.FirstOrDefault();
     CampaignSetup = new CampaignSetupModel();
     CampaignSetup.AdModelProp.Addresses.FirstOrDefault().StateCodeFK = 0;
 }
Ejemplo n.º 3
0
 public ActionResult CampaignSetup()
 {
     //var logEnty = new LogEntry { ActivityId = Guid.NewGuid(), Message = "Loading" };
     //Logger.Write(logEnty);
     //var logService = new LogService();
     //logService.AddToLog(1, "Campaign Setup Accessed", "CampaignSetup//CampaignSetup//CampaignSetup", 1);
     var campaignSetupModel = new CampaignSetupModel();
     return View(campaignSetupModel);
 }
Ejemplo n.º 4
0
 public ActionResult LaunchAdProduct(CampaignSetupModel model)
 {
     if (ModelState.IsValid)
     {
         model = (CampaignSetupModel)Session["FullModel"];
         //SemplestDataService ds = new SemplestDataService();
         //ds.SaveAd(model);
     }
     //return PartialView("KeyWords", model);
     return View();
 }
Ejemplo n.º 5
0
 public ActionResult GetKeywords(CampaignSetupModel model)
 {
     if (ModelState.IsValid)
     {
         //model.AllCategories = (List<CampaignSetupModel.CategoriesModel>)Session["AllCategories"];
         //model = _campaignRepository.GetKeyWords(model);
         model.BillingLaunch.KeywordsCount = model.AllKeywords.Count;
         Session.Add("FullModel", model);
     }
     return Json("BillingLaunch");
 }
Ejemplo n.º 6
0
 public ActionResult GetCategories(CampaignSetupModel model)
 {
     if (ModelState.IsValid)
     {
         //model = _campaignRepository.GetCategories(model);
         // save this some how while getting the keywords this is becoming null
         Session.Add("AllCategories", model.AllCategories);
         Session.Add("AdModelProp", model.AdModelProp);
         Session.Add("ProductGroup", model.ProductGroup);
     }
     return Json("Categories");
 }
Ejemplo n.º 7
0
 public ActionResult CampaignSetup(CampaignSetupModel cs)
 {
     Session["SiteLinks"] = null;
     Session["NegativeKeywords"] = null;
     Session["NegativeKeywordsText"] = null;
     Session["CampaignSetupModel"] = cs;
     Session["AllCategories"] = null;
     ViewBag.IsLaunched = false;
     ViewBag.IsCompleted = false;
     ViewBag.IsPending = false;
     ViewBag.IsLaunchedAndCompleted = false;
     cs.AdModelProp.IsNew = true;
     var dbContext = new SemplestModel.Semplest();
     var userid =
         ((Credential)System.Web.HttpContext.Current.Session[SharedResources.SEMplestConstants.SESSION_USERID]).
             UsersFK;
     cs.BillType = dbContext.Users.First(key => key.UserPK == userid).Customer.BillTypeFK;
     cs.ProductGroup.AllowAutoBid = dbContext.Users.Single(key => key.UserPK == userid).Customer.AllowAutobid;
     return View(cs);
 }
Ejemplo n.º 8
0
        public ActionResult CampaignSetup(CampaignSetupModel cs, string command)
        {

            if (command == "") command = "";

            var logEnty = new LogEntry { ActivityId = Guid.NewGuid(), Message = "Loading CampaignSetup Controller" };
            Logger.Write(logEnty);
            //var logService = new LogService();
            //logService.AddToLog(1, "Campaign Setup Accessed", "CampaignSetup//CampaignSetup//CampaignSetup", 1);
            //var scw = new ServiceClientWrapper();
            //scw.SendEmail("subject", "*****@*****.**", "*****@*****.**", "test mail");

            //var campaignSetupModel = new CampaignSetupModel();
            Session["SiteLinks"] = null;
            Session["NegativeKeywords"] = null;
            Session["NegativeKeywordsText"] = null;
            Session["CampaignSetupModel"] = cs;
            Session["AllCategories"] = null;
            ViewBag.IsLaunched = false;
            ViewBag.IsCompleted = false;
            ViewBag.IsLaunchedAndCompleted = false;

            return View(cs);
        }
Ejemplo n.º 9
0
        public ActionResult LaunchAdProduct(CampaignSetupModel model)
        {
            ServiceClientWrapper sw = new ServiceClientWrapper();
            List<string> adEngines = new List<string>();
            if (ModelState.IsValid)
            {
                model = (CampaignSetupModel)Session["CampaignSetupModel"];
                //SemplestDataService ds = new SemplestDataService();
                //ds.SaveAd(model);
            }
            var dbContext = new SemplestModel.Semplest();
            //ProductGroup pg = dbContext.ProductGroups.Where(x => x.ProductGroupName == model.ProductGroup.ProductGroupName).First();
            //Promotion pm = dbContext.ProductGroups.Where(x => x.ProductGroupName==model.ProductGroup.ProductGroupName).First().Promotions.Where(p => p.PromotionName == model.ProductGroup.ProductPromotionName).First();
            var userid = ((Credential)(Session[Semplest.SharedResources.SEMplestConstants.SESSION_USERID])).UsersFK;
            int customerFk = ((Credential)(Session[Semplest.SharedResources.SEMplestConstants.SESSION_USERID])).User.CustomerFK.Value;
            var pm =
                dbContext.Users.First(x => x.UserPK == userid).Customer.ProductGroups.First(
                    x => x.ProductGroupName == model.ProductGroup.ProductGroupName).Promotions.First(
                    p => p.PromotionName == model.ProductGroup.ProductPromotionName);
            foreach (PromotionAdEngineSelected pades in pm.PromotionAdEngineSelecteds)
                adEngines.Add(pades.AdvertisingEngine.AdvertisingEngine1);
            try
            {
                pm.IsLaunched = sw.scheduleAddPromotionToAdEngine(customerFk, pm.ProductGroupFK, pm.PromotionPK, adEngines.ToArray()); ;
            }
            catch (Exception ex)
            {
                var logEnty = new LogEntry { ActivityId = Guid.NewGuid(), Message = ex.Message };
                Logger.Write(logEnty);
                pm.IsLaunched = true;
            }
            dbContext.SaveChanges();
            //return PartialView("KeyWords", model);

            //return View();
            //return Json("Congratulations, Your Product has Launched!!!");
            // now we are showing the image with wait window so we don't to show this in message box
            return Json("");
            //return Json("LaunchAdProduct");

        }
Ejemplo n.º 10
0
 public ActionResult SaveProductPromotion(CampaignSetupModel model)
 {
     try
     {
         var custFK =
             ((Credential) (Session[Semplest.SharedResources.SEMplestConstants.SESSION_USERID])).User.
                 CustomerFK.Value;
         if (model.AdModelProp.IsNew &&
             _campaignRepository.DoesPromotionExist(model.ProductGroup.ProductGroupName,
                                                    model.ProductGroup.ProductPromotionName, custFK))
         {
             return Json("The promotion already exists.");
         }
         _campaignRepository.SaveProductPromotion(custFK, model, (CampaignSetupModel)
                                                                 Session["CampaignSetupModel"]);
         Session["CampaignSetupModel"] = model;
         return Json("Create Ads");
     }
     catch (Exception ex)
     {
         Semplest.SharedResources.Helpers.ExceptionHelper.LogException(ex);
         return Json(ExceptionHelper.GetErrorMessage(ex));
     }
 }
Ejemplo n.º 11
0
 public ThreadData(int promoId, CampaignSetupModel model)
 {
     _promoId = promoId;
     _model = model;
 }
Ejemplo n.º 12
0
 private void WriteLog(string msg, CampaignSetupModel model)
 {
     msg = String.Format(msg, model.ProductGroup.ProductGroupName, model.ProductGroup.ProductPromotionName);
     var logEnty = new LogEntry { ActivityId = Guid.NewGuid(), Message = msg };
     Logger.Write(logEnty);
 }
Ejemplo n.º 13
0
        public ActionResult GetKeywords(CampaignSetupModel model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    model.AllCategories = (List<CampaignSetupModel.CategoriesModel>)Session["AllCategories"];
                    model.AdModelProp.NegativeKeywords = (List<string>)Session["NegativeKeywords"];
                    model.AdModelProp.NegativeKeywordsText = (string)Session["NegativeKeywordsText"];

                    if (!model.CategoryIds.Any())
                        return Json("Atleast one Category needs to be selected");


                    // get selected categories
                    var catList = new List<string>();
                    foreach (var cat in model.AllCategories)
                    {
                        catList.AddRange(from t in model.CategoryIds where cat.Id == t select cat.Name);
                    }

                    // save the selected categories here
                    //int userid = (int)Session[Semplest.SharedResources.SEMplestConstants.SESSION_USERID];
                    int userid =
                        ((Credential)(Session[Semplest.SharedResources.SEMplestConstants.SESSION_USERID])).UsersFK;
                    //int userid = 1; // for testing

                    String msg =
                        "In GetKeywords ActionResult for --- ProductGroup: {0} --- Promotion: {1} --- Before saving  SaveProductGroupAndCampaign to database";
                    WriteLog(msg, model);

                    //var ds = new SemplestDataService();
                    var promoId = _campaignRepository.GetPromotionId(userid, model.ProductGroup.ProductGroupName,
                                                    model.ProductGroup.ProductPromotionName);
                    _campaignRepository.SaveSelectedCategories(promoId, catList);

                    msg =
                        "In GetKeywords ActionResult for --- ProductGroup: {0} --- Promotion: {1} After saving  SaveProductGroupAndCampaign";
                    WriteLog(msg, model);

                    msg =
                        "In GetKeywords ActionResult for --- ProductGroup: {0} --- Promotion: {1} Before getting keywords form web service";
                    WriteLog(msg, model);

                    // get the keywords from web service
                    model = _campaignRepository.GetKeyWords(model, promoId);

                    msg =
                        "In GetKeywords ActionResult for --- ProductGroup: {0} --- Promotion: {1} After getting keywords form web service";
                    WriteLog(msg, model);

                    msg =
                        "In GetKeywords ActionResult for --- ProductGroup: {0} --- Promotion: {1} Before saving keywords to database";
                    WriteLog(msg, model);

                    msg =
                        "In GetKeywords ActionResult for --- ProductGroup: {0} --- Promotion: {1} After saving keywords to database";
                    WriteLog(msg, model);

                    model.BillingLaunch.KeywordsCount = model.AllKeywordProbabilityObjects.Count(x => x.isDeleted == false);
                    Session.Add("CampaignSetupModel", model);

                    return Json("Billing & Launch");
                }
                return Json("ModelState Invalid required data is missing");
            }
            catch (Exception ex)
            {
                Semplest.SharedResources.Helpers.ExceptionHelper.LogException(ex);
                if (ex.Message.Contains("Not enough data provided"))
                    return Json("Invalid words/phrases, URL or ADs<~>Please check your Landing URL and your words/phrases<br>describing your business.  The System was unable to<br>determine Keyword Categories.");
                else
                    return Json(ex.ToString());
            }
        }
Ejemplo n.º 14
0
 public ActionResult KeyWords(CampaignSetupModel model)
 {
     model = (CampaignSetupModel)Session["CampaignSetupModel"];
     return PartialView(model);
 }
Ejemplo n.º 15
0
 public ActionResult SaveProductPromotion(CampaignSetupModel model)
 {
     try
     {
         if (model.AdModelProp.IsNew &&
             _campaignRepository.DoesPromotionExist(model.ProductGroup.ProductGroupName,
                                                    model.ProductGroup.ProductPromotionName, GetCustomerId()))
         {
             return Json("The promotion already exists.");
         }
         _campaignRepository.SaveProductPromotion(GetCustomerId(), model, (CampaignSetupModel)
                                                                 Session["CampaignSetupModel"]);
         Session["CampaignSetupModel"] = model;
         return Json("Create Ads");
     }
     catch (Exception ex)
     {
         ExceptionHelper.LogException(ex);
         return Json(ConfigurationManager.AppSettings["TechnicalDifficulties"]);
     }
 }
Ejemplo n.º 16
0
 public ActionResult SetAdditionalLinks(CampaignSetupModel model)
 {
     try
     {
         Session["SiteLinks"] = model.SiteLinks.Where(t => t.Delete).ToList();
         var cred =
             (Credential) (Session[Semplest.SharedResources.SEMplestConstants.SESSION_USERID]);
         var customerFK = cred.User.CustomerFK;
         var newIds = _campaignRepository.SaveSiteLinks(model, customerFK.Value,
                                                        (CampaignSetupModel) Session["CampaignSetupModel"]);
         var csm = (CampaignSetupModel) Session["CampaignSetupModel"];
         if (!String.IsNullOrEmpty(newIds))
         {
             foreach (var nvp in newIds.Split(',').Select(items => items.Split('=')))
             {
                 model.SiteLinks.Single(t => t.UID == nvp[0]).SiteLInkPK = int.Parse(nvp[1]);
             }
         }
         csm.SiteLinks = model.SiteLinks;
         return Json(new {newKeys = newIds, name = "AdditionalLinks"});
     }
     catch (Exception ex)
     {
         Semplest.SharedResources.Helpers.ExceptionHelper.LogException(ex);
         return Json(ExceptionHelper.GetErrorMessage(ex));
     }
 }
Ejemplo n.º 17
0
 public ActionResult Categories(CampaignSetupModel model)
 {
     model.AllCategories = (List<CampaignSetupModel.CategoriesModel>)Session["AllCategories"];
     return PartialView(model);
 }
Ejemplo n.º 18
0
        public ActionResult GetCategories(CampaignSetupModel model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    model.SiteLinks = (List<SiteLink>)Session["SiteLinks"];
                    model.AdModelProp.NegativeKeywords = (List<string>)Session["NegativeKeywords"];
                    // we need save to database the ProductGroup and Promotion information
                    //int userid = (int)Session[Semplest.SharedResources.SEMplestConstants.SESSION_USERID];
                    int userid =
                        ((Credential)(Session[Semplest.SharedResources.SEMplestConstants.SESSION_USERID])).UsersFK;

                    //int userid = 1; // for testing
                    string msg =
                        "In GetCategories ActionResult for --- ProductGroup: {0} --- Promotion: {1} --- Before saving  SaveProductGroupAndCampaign to database";
                    msg = String.Format(msg, model.ProductGroup.ProductGroupName,
                                        model.ProductGroup.ProductPromotionName);
                    var logEnty = new LogEntry { ActivityId = Guid.NewGuid(), Message = msg };
                    Logger.Write(logEnty);

                    _campaignRepository.SaveProductGroupAndCampaign(userid, model);

                    msg =
                        "In GetCategories ActionResult for --- ProductGroup: {0} --- Promotion: {1} After saving  SaveProductGroupAndCampaign";
                    msg = String.Format(msg, model.ProductGroup.ProductGroupName,
                                        model.ProductGroup.ProductPromotionName);
                    logEnty.Message = msg;
                    Logger.Write(logEnty);

                    msg =
                        "In GetCategories ActionResult for --- ProductGroup: {0} --- Promotion: {1} Before getting categories form web service";
                    msg = String.Format(msg, model.ProductGroup.ProductGroupName,
                                        model.ProductGroup.ProductPromotionName);
                    logEnty.Message = msg;
                    Logger.Write(logEnty);

                    // get the categoris from the web service
                    model = _campaignRepository.GetCategories(model);

                    msg =
                        "In GetCategories ActionResult for --- ProductGroup: {0} --- Promotion: {1} After successfully getting categories form web service";
                    msg = String.Format(msg, model.ProductGroup.ProductGroupName,
                                        model.ProductGroup.ProductPromotionName);
                    logEnty.Message = msg;
                    Logger.Write(logEnty);

                    // save this some how while getting the keywords this is becoming null
                    Session.Add("AllCategories", model.AllCategories);
                    //Session.Add("AdModelProp", model.AdModelProp);
                    //Session.Add("ProductGroup", model.ProductGroup);
                    return Json("Categories");
                }
                return Json("ModelState Invalid required data is missing");

                //return View(model);
            }
            catch (Exception ex)
            {
                if (ex.Message.Contains("Not a valid description"))
                    return Json("Invalid Description<~>Please check your Landing URL and your words/phrases<br>describing your business.  The System was unable to<br>determine Keyword Categories.");
                else
                    return Json(ex.ToString());

            }
        }
Ejemplo n.º 19
0
 public ActionResult BillingLaunch(CampaignSetupModel model)
 {
     model = (CampaignSetupModel)Session["CampaignSetupModel"];
     if (model.AllKeywords != null)
         model.BillingLaunch.KeywordsCount = model.AllKeywords.Count();
     return PartialView(model);
 }
Ejemplo n.º 20
0
        public ActionResult GetKeywords(CampaignSetupModel model)
        {
            try
            {
                model.AllCategories = (List<CampaignSetupModel.CategoriesModel>)Session["AllCategories"];
                model.AdModelProp.NegativeKeywords = (List<string>)Session["NegativeKeywords"];
                model.AdModelProp.NegativeKeywordsText = (string)Session["NegativeKeywordsText"];

                if (!model.CategoryIds.Any())
                    return Json("At least one category needs to be selected");


                // get selected categories
                var catList = new List<string>();
                foreach (var cat in model.AllCategories)
                {
                    catList.AddRange(from t in model.CategoryIds where cat.Id == t select cat.Name);
                }

                // save the selected categories here
                //int userid = (int)Session[Semplest.SharedResources.SEMplestConstants.SESSION_USERID];
                int userid =
                    ((Credential)(Session[SharedResources.SEMplestConstants.SESSION_USERID])).UsersFK;

                var dbcontext = new SemplestModel.Semplest();
                var promotionRepository = new PromotionRepository(dbcontext);
                var promoId = promotionRepository.GetPromotionId(userid, model.ProductGroup.ProductGroupName,
                                                model.ProductGroup.ProductPromotionName);
                _campaignRepository.SaveSelectedCategories(promoId, catList);
                model = _campaignRepository.GetKeyWords(model, promoId);
                if (model != null)
                {
                    model.BillingLaunch.KeywordsCount =
                        model.AllKeywordProbabilityObjects.Count(x => x.isDeleted == false);
                    Session.Add("CampaignSetupModel", model);
                    return Json("Billing & Launch");
                }
                return Json(ConfigurationManager.AppSettings["TechnicalDifficulties"]);
            }
            catch (Exception ex)
            {
                ExceptionHelper.LogException(ex);
                return Json(ConfigurationManager.AppSettings["TechnicalDifficulties"]);
            }
        }
Ejemplo n.º 21
0
        public ActionResult GetCategories(CampaignSetupModel model)
        {
            try
            {
                model.SiteLinks = (List<SiteLink>) Session["SiteLinks"];
                model.AdModelProp.NegativeKeywords = (List<string>) Session["NegativeKeywords"];

                // we need save to database the ProductGroup and Promotion information
                //int userid = (int)Session[Semplest.SharedResources.SEMplestConstants.SESSION_USERID];

                var newIds = _campaignRepository.SaveGeoTargetingAds(GetCustomerId(), model,
                                                                     (CampaignSetupModel)
                                                                     Session["CampaignSetupModel"]);
                if (!newIds.IsException && !newIds.IsValidationError)
                {
                    var csm = (CampaignSetupModel) Session["CampaignSetupModel"];
                    if (!String.IsNullOrEmpty(newIds.ReturnMessage))
                    {
                        foreach (var nvp in newIds.ReturnMessage.Split(',').Select(items => items.Split('=')))
                        {
                            var item = model.AdModelProp.Addresses.SingleOrDefault(t => t.UID == nvp[0]);
                            if (item != null)
                                item.GeoTargetingPK = int.Parse(nvp[1]);
                            else
                                model.AdModelProp.Ads.Single(t => t.UID == nvp[0]).PromotionAdsPK = int.Parse(nvp[1]);
                        }
                    }
                    csm.AdModelProp.Addresses = model.AdModelProp.Addresses;
                    csm.AdModelProp.Ads = model.AdModelProp.Ads;
                    // get the categoris from the web service
                    model = _campaignRepository.GetCategories(model);
                    if (model == null)
                        return Json(ConfigurationManager.AppSettings["TechnicalDifficulties"]);
                    Session.Add("AllCategories", model.AllCategories);
                    return Json(new {newKeys = newIds.ReturnMessage, name = "Categories"});
                }
                if (!newIds.IsException && newIds.IsValidationError)
                    return Json("Validation Error<~> " + newIds.ReturnMessage);

                if (newIds.ReturnMessage.Contains("Not a valid description"))
                    return
                        Json(
                            "Invalid Description<~>Please check your Landing URL and your words/phrases<br>describing your business.  The System was unable to<br>determine Keyword Categories.");
                if (newIds.ReturnMessage.ToLower().Contains("no service for"))
                {
                    return
                        Json(
                            "Services not available<~>Sorry, the Ad Engine Services are currently not available. Please try again in a few minutes. If this problem continues, please contact SEMplest.");
                }
                if (newIds.ReturnMessage.ToLower().Contains("geotarget limit"))
                {
                    return
                        Json(
                            "Too many cities<~>Your target selections are over the limit.");
                }
                return Json(ConfigurationManager.AppSettings["TechnicalDifficulties"]);
            }
            catch (Exception ex)
            {
                ExceptionHelper.LogException(ex);
                 return Json(ConfigurationManager.AppSettings["TechnicalDifficulties"]);
            }
        }
Ejemplo n.º 22
0
 public ActionResult SetAdditionalLinks(CampaignSetupModel model)
 {
     try
     {
         Session["SiteLinks"] = model.SiteLinks.Where(t => t.Delete).ToList();
         var newIds = _campaignRepository.SaveSiteLinks(model, GetCustomerId(),
                                                        (CampaignSetupModel) Session["CampaignSetupModel"]);
         if (!newIds.IsException && !newIds.IsValidationError)
         {
             var csm = (CampaignSetupModel) Session["CampaignSetupModel"];
             if (!String.IsNullOrEmpty(newIds.ReturnMessage))
             {
                 foreach (var nvp in newIds.ReturnMessage.Split(',').Select(items => items.Split('=')))
                 {
                     model.SiteLinks.Single(t => t.UID == nvp[0]).SiteLInkPK = int.Parse(nvp[1]);
                 }
             }
             csm.SiteLinks = model.SiteLinks;
             return Json(new {newKeys = newIds.ReturnMessage, name = "AdditionalLinks"});
         }
         if (!newIds.IsException && newIds.IsValidationError)
         {
             return Json("Validation Error<~> " + newIds.ReturnMessage);
         }
         return Json(ConfigurationManager.AppSettings["TechnicalDifficulties"]);
     }
     catch (Exception ex)
     {
         ExceptionHelper.LogException(ex);
         return Json(ConfigurationManager.AppSettings["TechnicalDifficulties"]);
     }
 }
Ejemplo n.º 23
0
 public HomeModelChild()
 {
     CampaignSetup = new CampaignSetupModel();
     CampaignSetup.AdModelProp.Addresses.FirstOrDefault().StateCodeFK = 0;
 }
Ejemplo n.º 24
0
 public ActionResult BillingLaunch(CampaignSetupModel model)
 {
     model = (CampaignSetupModel)Session["CampaignSetupModel"];
     return PartialView(model);
 }
Ejemplo n.º 25
0
 public ActionResult SetAdditionalLinks(CampaignSetupModel model)
 {
     try
     {
         Session["SiteLinks"] = model.SiteLinks.Where(t => t.Delete).ToList();
         var cred =
             (Credential) (Session[Semplest.SharedResources.SEMplestConstants.SESSION_USERID]);
         var customerFK = cred.User.CustomerFK;
         _campaignRepository.SaveSiteLinks(model, customerFK.Value,
                                           (CampaignSetupModel) Session["CampaignSetupModel"]);
         return Json("AdditionalLinks");
     }
     catch (Exception ex)
     {
         Semplest.SharedResources.Helpers.ExceptionHelper.LogException(ex);
         return Json(ExceptionHelper.GetErrorMessage(ex));
     }
 }
Ejemplo n.º 26
0
        public ActionResult GetCategories(CampaignSetupModel model)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return Json("ModelState Invalid required data is missing");
                }
                else
                {
                        model.SiteLinks = (List<SiteLink>) Session["SiteLinks"];
                        model.AdModelProp.NegativeKeywords = (List<string>) Session["NegativeKeywords"];

                        // we need save to database the ProductGroup and Promotion information
                        //int userid = (int)Session[Semplest.SharedResources.SEMplestConstants.SESSION_USERID];
                        int customerFK =
                            ((Credential) (Session[Semplest.SharedResources.SEMplestConstants.SESSION_USERID])).User.CustomerFK.Value;
                        
                        _campaignRepository.SaveGeoTargetingAds(customerFK, model,
                                                                           (CampaignSetupModel)
                                                                           Session["CampaignSetupModel"]);
                        // get the categoris from the web service
                        model = _campaignRepository.GetCategories(model);
                        Session.Add("AllCategories", model.AllCategories);
                        return Json("Categories");
                }
            }
            catch (Exception ex)
            {
                if (ex.Message.Contains("Not a valid description"))
                    return
                        Json(
                            "Invalid Description<~>Please check your Landing URL and your words/phrases<br>describing your business.  The System was unable to<br>determine Keyword Categories.");
                else if(ex.Message.ToLower().Contains("no service for"))
                {
                    return
                        Json(
                            "Services not available<~>Sorry, the Ad Engine Services are currently not available. Please try again in a few minutes. If this problem continues, please contact SEMplest.");
                }
                else if (ex.Message.ToLower().Contains("geotarget limit"))
                {
                       return
                        Json(
                            "Too many cities<~>Your target selections are over the limit.");
                }
                else
                {
                    Semplest.SharedResources.Helpers.ExceptionHelper.LogException(ex);
                    return Json(ExceptionHelper.GetErrorMessage(ex));
                }

            }
        }
Ejemplo n.º 27
0
 public ActionResult KeyWords(CampaignSetupModel model, FormCollection fc)
 {
     try
     {
         int userid = ((Credential) (Session[Semplest.SharedResources.SEMplestConstants.SESSION_USERID])).UsersFK;
         var promoId = _campaignRepository.GetPromotionId(userid, model.ProductGroup.ProductGroupName,
                                                          model.ProductGroup.ProductPromotionName);
         _campaignRepository.SetKeywordsDeleted(model.KeywordIds, promoId);
         CampaignSetupModel sessionModel = (CampaignSetupModel) Session["CampaignSetupModel"];
         sessionModel.AllKeywords.RemoveAll(key => model.KeywordIds.Contains(key.Id));
         model.BillingLaunch.KeywordsCount = sessionModel.AllKeywords.Count();
         Session["CampaignSetupModel"] = sessionModel;
         //model = sessionModel;
         return Json(new {count = model.BillingLaunch.KeywordsCount, name = "Keywords"});
     }
     catch (Exception ex)
     {
         Semplest.SharedResources.Helpers.ExceptionHelper.LogException(ex);
         return Json(ExceptionHelper.GetErrorMessage(ex));
     }
 }
Ejemplo n.º 28
0
 public ActionResult LaunchAdProduct(CampaignSetupModel model)
 {
     try
     {
         var dbContext = new SemplestModel.Semplest();
         var cr = new CreditCardRepository(dbContext);
         var sr = new StateRepository(dbContext);
         var pr = new PromotionRepository(dbContext);
         var bt = new BillTypeRepository(dbContext);
         var promo = pr.GetPromoitionFromCampaign(GetCustomerId(), model.ProductGroup.ProductGroupName,
                                                  model.ProductGroup.ProductPromotionName);
         var retVal = new ReturnState(false,false,"Not a credit card customer", null);
         if (model.BillType == bt.GetBillTypeCode("Credit Card"))
         {
             retVal = cr.ChargeCreditCard(new CustomerObject
                                                  {
                                                      Address1 = model.BillingLaunch.Address,
                                                      City = model.BillingLaunch.City,
                                                      Email = model.BillingLaunch.Email,
                                                      StateAbbr =
                                                          sr.GetStateNameFromCode(
                                                              int.Parse(model.BillingLaunch.StateCodeFK)),
                                                      ExpireDateMMYY =
                                                          model.BillingLaunch.ExpiryMonth +
                                                          model.BillingLaunch.ExpiryYear,
                                                      FirstName = model.BillingLaunch.FirstName,
                                                      LastName = model.BillingLaunch.LastName,
                                                      Phone = model.BillingLaunch.Phone,
                                                      ZipCode = model.BillingLaunch.Zip,
                                                      creditCardNumber = model.BillingLaunch.CardNumber
                                                  }, promo, model.BillType, model.ProductGroup.Budget);
         }
         try
         {
             if (!retVal.IsException && !retVal.IsValidationError)
             {
                 dbContext.SaveChanges();
                 var adEngines = new List<string>();
                 adEngines.AddRange(
                     promo.PromotionAdEngineSelecteds.Select(
                         pades => pades.AdvertisingEngine.AdvertisingEngine1));
                 var sw = new ServiceClientWrapper();
                 if (sw.ScheduleAddPromotionToAdEngine(GetCustomerId(), promo.ProductGroupFK,
                                                       promo.PromotionPK, adEngines.ToArray()))
                 {
                     pr.SetPromotionToLaunched(promo.PromotionPK);
                     dbContext.SaveChanges();
                 }
                 return Json(retVal.ReturnMessage);
             }
         }
         catch (Exception ex)
         {
             ExceptionHelper.LogException(ex);
             return Json(retVal.ReturnMessage);
         }
         if (!retVal.IsException && retVal.IsValidationError)
             return Json("Validation Error<~> " + retVal.ReturnMessage);
     }
     catch (Exception ex)
     {
         ExceptionHelper.LogException(ex);
     }
     return Json(ConfigurationManager.AppSettings["TechnicalDifficulties"]);
 }
Ejemplo n.º 29
0
 public ActionResult SaveDefineProduct(CampaignSetupModel data)
 {
     if (data == null)
         return Json(0);
     return Json(123);
     // return Json(campaignRepository.Save(data),JsonRequestBehavior.AllowGet);
 }
Ejemplo n.º 30
0
 public ActionResult SetAdditionalLinks(CampaignSetupModel model)
 {
     Session["SiteLinks"] = model.SiteLinks.Where(t => !t.Delete).ToList();
     return Json("AdditionalLinks");
 }