public ActionResult EditSynonyms(int company_id, string synonyms)
        {
            ProductIdentifier.Engine e = new ProductIdentifier.Engine(false);
            e.Companies.Get(company_id).SetSynonymsFromString(synonyms);
            e.Companies.Get(company_id).SaveSynonyms();

            if (Request.IsAjaxRequest())
            {
                return(Content(null));
            }
            return(RedirectToAction("Index"));
        }
        public ActionResult EditWordWeights(int company_id, string synonyms, string word_weights, string ignored_words)
        {
            ProductIdentifier.Engine e = new ProductIdentifier.Engine(false);
            e.Companies.Get(company_id).SetWordWeightsFromString(word_weights);
            e.Companies.Get(company_id).SaveWordWeights();

            if (Request.IsAjaxRequest())
            {
                return(Content(null));
            }
            return(RedirectToAction("Index"));
        }
        public ActionResult Edit2(string c1_i_c2_i, string mapped_categories)
        {
            Match m = Regex.Match(c1_i_c2_i, @"(\d+),(\d+)$", RegexOptions.Singleline);
            int c1_i = int.Parse(m.Groups[1].Value);
            int c2_i = int.Parse(m.Groups[2].Value);

            ProductIdentifier.Engine e = new ProductIdentifier.Engine(false);
            e.CompanyPairs.SaveMappedCategoriesFromString(c1_i, c2_i, mapped_categories);

            if (Request.IsAjaxRequest())
                return Content(null);
            return RedirectToAction("Index");
        }
        public ActionResult Edit2(string c1_i_c2_i, string mapped_categories)
        {
            Match m    = Regex.Match(c1_i_c2_i, @"(\d+),(\d+)$", RegexOptions.Singleline);
            int   c1_i = int.Parse(m.Groups[1].Value);
            int   c2_i = int.Parse(m.Groups[2].Value);

            ProductIdentifier.Engine e = new ProductIdentifier.Engine(false);
            e.CompanyPairs.SaveMappedCategoriesFromString(c1_i, c2_i, mapped_categories);

            if (Request.IsAjaxRequest())
            {
                return(Content(null));
            }
            return(RedirectToAction("Index"));
        }
 public ActionResult EditWordWeights(int?id)
 {
     if (id == null)
     {
         return(new HttpStatusCodeResult(System.Net.HttpStatusCode.BadRequest));
     }
     ViewBag.CompanyId = id;
     ProductIdentifier.Engine e = new ProductIdentifier.Engine(false);
     ViewBag.WordWeights = e.Companies.Get((int)id).GetWordWeightsAsString();
     if (Request.IsAjaxRequest())
     {
         return(PartialView());
     }
     return(View());
 }
        public ActionResult PerformDataAnalysis(int company_id)
        {
            //getting the using Engine to update its Configuration
            ProductIdentifier.Engine e = ProductLinksController.IdenticalProductList.GetProductIdentifierEngineIfAny(Session);
            if (e == null)
            {
                e = new ProductIdentifier.Engine(false);
            }
            e.PerformDataAnalysis(company_id);

            if (Request.IsAjaxRequest())
            {
                return(Content("Done!"));
            }
            return(RedirectToAction("Index"));
        }
        public ActionResult Edit2([Bind(Prefix = "Id")]string c1_i_c2_i)
        {
            ViewBag.Company1IdCompany2Id = c1_i_c2_i;

            Match m = Regex.Match(c1_i_c2_i, @"(\d+),(\d+)$", RegexOptions.Singleline);
            int c1_i = int.Parse(m.Groups[1].Value);
            int c2_i = int.Parse(m.Groups[2].Value);
            ViewBag.Company1Name = db.Companies.Where(c => c.Id == c1_i).Select(c => c.Name).FirstOrDefault();
            ViewBag.Company2Name = db.Companies.Where(c => c.Id == c2_i).Select(c => c.Name).FirstOrDefault();

            string mapped_categories;
            ProductIdentifier.Engine e = new ProductIdentifier.Engine(false);
            e.CompanyPairs.GetMappedCategoriesAsString(c1_i, c2_i, out mapped_categories);
            ViewBag.MappedCategories = mapped_categories;

            if (Request.IsAjaxRequest())
                return PartialView();
            return View();
        }
        public ActionResult Edit2([Bind(Prefix = "Id")] string c1_i_c2_i)
        {
            ViewBag.Company1IdCompany2Id = c1_i_c2_i;

            Match m    = Regex.Match(c1_i_c2_i, @"(\d+),(\d+)$", RegexOptions.Singleline);
            int   c1_i = int.Parse(m.Groups[1].Value);
            int   c2_i = int.Parse(m.Groups[2].Value);

            ViewBag.Company1Name = db.Companies.Where(c => c.Id == c1_i).Select(c => c.Name).FirstOrDefault();
            ViewBag.Company2Name = db.Companies.Where(c => c.Id == c2_i).Select(c => c.Name).FirstOrDefault();

            string mapped_categories;

            ProductIdentifier.Engine e = new ProductIdentifier.Engine(false);
            e.CompanyPairs.GetMappedCategoriesAsString(c1_i, c2_i, out mapped_categories);
            ViewBag.MappedCategories = mapped_categories;

            if (Request.IsAjaxRequest())
            {
                return(PartialView());
            }
            return(View());
        }
        public ActionResult EditSynonyms(int company_id, string synonyms)
        {
            ProductIdentifier.Engine e = new ProductIdentifier.Engine(false);
            e.Companies.Get(company_id).SetSynonymsFromString(synonyms);
            e.Companies.Get(company_id).SaveSynonyms();

            if (Request.IsAjaxRequest())
                return Content(null);
            return RedirectToAction("Index");
        }
 public ActionResult EditDefaultIgnoredWords()
 {
     ProductIdentifier.Engine e = new ProductIdentifier.Engine(false);
     ViewBag.IgnoredWords = e.GetDefaultIgnoredWordsAsString();
     return(PartialView("EditIgnoredWords"));
 }
 public ActionResult EditDefaultIgnoredWords(string ignored_words)
 {
     ProductIdentifier.Engine e = new ProductIdentifier.Engine(false);
     e.SaveDefaultIgnoredWordsFromString(ignored_words);
     return Content(null);
 }
 public ActionResult EditDefaultIgnoredWords()
 {
     ProductIdentifier.Engine e = new ProductIdentifier.Engine(false);
     ViewBag.IgnoredWords = e.GetDefaultIgnoredWordsAsString();
     return PartialView("EditIgnoredWords");
 }
        public ActionResult PerformSelfTraining()
        {
            //getting the using Engine to update its Configuration
            ProductIdentifier.Engine e = ProductLinksController.IdenticalProductList.GetProductIdentifierEngineIfAny(Session);
            if (e == null)
                e = new ProductIdentifier.Engine(false);
            e.PerformSelfTraining();

            if (Request.IsAjaxRequest())
                return Content("Done!");
            return RedirectToAction("Index");
        }
        public ActionResult EditWordWeights(int company_id, string synonyms, string word_weights, string ignored_words)
        {
            ProductIdentifier.Engine e = new ProductIdentifier.Engine(false);
            e.Companies.Get(company_id).SetWordWeightsFromString(word_weights);
            e.Companies.Get(company_id).SaveWordWeights();

            if (Request.IsAjaxRequest())
                return Content(null);
            return RedirectToAction("Index");
        }
 public ActionResult EditWordWeights(int? id)
 {
     if (id == null)
     {
         return new HttpStatusCodeResult(System.Net.HttpStatusCode.BadRequest);
     }
     ViewBag.CompanyId = id;
     ProductIdentifier.Engine e = new ProductIdentifier.Engine(false);
     ViewBag.WordWeights = e.Companies.Get((int)id).GetWordWeightsAsString();
     if (Request.IsAjaxRequest())
         return PartialView();
     return View();
 }
        //List<object> CompanySelect
        //{
        //    get
        //    {
        //        var cs = (from r in db.Companies select new { Value = r.Id, Name = r.Name }).ToList<object>();
        //        cs.Insert(0, new { Value = -1, Name = "-- COMMON --" });
        //        return cs;
        //    }
        //}

        //public ActionResult Index()
        //{
        //    ViewBag.CompanyId = new SelectList(CompanySelect, "Value", "Name");
        //    return View();
        //}

        public ActionResult EditDefaultSynonyms()
        {
            ProductIdentifier.Engine e = new ProductIdentifier.Engine(false);
            ViewBag.Synonyms = e.GetDefaultSynonymsAsString();
            return(PartialView("EditSynonyms"));
        }
 public ActionResult EditDefaultSynonyms(string synonyms)
 {
     ProductIdentifier.Engine e = new ProductIdentifier.Engine(false);
     e.SaveDefaultSynonymsFromString(synonyms);
     return(Content(null));
 }
 //List<object> CompanySelect
 //{
 //    get
 //    {
 //        var cs = (from r in db.Companies select new { Value = r.Id, Name = r.Name }).ToList<object>();
 //        cs.Insert(0, new { Value = -1, Name = "-- COMMON --" });
 //        return cs;
 //    }
 //}
 //public ActionResult Index()
 //{
 //    ViewBag.CompanyId = new SelectList(CompanySelect, "Value", "Name");
 //    return View();
 //}
 public ActionResult EditDefaultSynonyms()
 {
     ProductIdentifier.Engine e = new ProductIdentifier.Engine(false);
     ViewBag.Synonyms = e.GetDefaultSynonymsAsString();
     return PartialView("EditSynonyms");
 }
 public ActionResult EditDefaultIgnoredWords(string ignored_words)
 {
     ProductIdentifier.Engine e = new ProductIdentifier.Engine(false);
     e.SaveDefaultIgnoredWordsFromString(ignored_words);
     return(Content(null));
 }
 public ActionResult EditDefaultSynonyms(string synonyms)
 {
     ProductIdentifier.Engine e = new ProductIdentifier.Engine(false);
     e.SaveDefaultSynonymsFromString(synonyms);
     return Content(null);
 }