コード例 #1
0
        public ActionResult UpdateNutritionalInformation()
        {
            var repo    = new MatchedItemRepository_pp();
            var results = repo.UpdateMenu();

            return(View(results));
        }
コード例 #2
0
        public ActionResult UpdateIngredientMatch(string xmlguid, string matchedGuid)
        {
            var repo     = new MatchedItemRepository_pp();
            var response = "Ingredient Updated to " + matchedGuid;

            try
            {
                if (!repo.UpdateIngredientXref(xmlguid, matchedGuid))
                {
                    response = "Unable to update Ingredient";
                }
            }
            catch (Exception e)
            {
                response = "Oops, an error occured. Details: " + e.Message;
            }

            var ingredient = repo.GetXmlIngredientByGuid(xmlguid);

            ingredient.IngredientMatch = repo.GetMatchedIngredient(matchedGuid, true);

            return(PartialView("GetIngredientDetails", ingredient));

            return(Content(response));
        }
コード例 #3
0
        public ActionResult GetIngredientDetails(string ingredientId)
        {
            var repo    = new MatchedItemRepository_pp();
            var results = repo.GetMatchedIngredient(ingredientId, false);

            return(View(results));
        }
コード例 #4
0
        public ActionResult GetExample(string guid)
        {
            var repo = new MatchedItemRepository_pp();
            var item = repo.GetMenuItem(guid);

            return(View("Index", item));
        }
コード例 #5
0
        public ActionResult UnmatchedMenuItems()
        {
            var repo  = new MatchedItemRepository_pp();
            var model = repo.GetUnMatchedMenuItems();

            ViewBag.Total = model.Count;
            return(View("MatchedMenuItems", model));
        }
コード例 #6
0
        //
        // GET: /ManageDuplicates/

        public ActionResult Index()
        {
            var repo = new MatchedItemRepository_pp();
            //var dups = repo.GetXmlIngredientDuplicates();
            var dups = repo.GetDuplicates();

            ViewBag.Total = dups.Duplicates.Count;
            return(View(dups));
        }
コード例 #7
0
        public ActionResult UpdateMenuItemsMatch(string xmlguid, string matchedGuid)
        {
            var repo = new MatchedItemRepository_pp();

            repo.UpdateMenuItemsXref(xmlguid, matchedGuid);

            var menuitem = repo.GetXmlMenuItem(xmlguid);

            menuitem.MenuItemMatch = repo.GetMenuItemWithIngredients(matchedGuid);
            return(PartialView("GetMenuItemDetails", menuitem));
        }
コード例 #8
0
        public ActionResult MenuItemMatchControl(string xmlmenuitemid)
        {
            MenuItemCandidates candidates = new MenuItemCandidates();
            var repo        = new MatchedItemRepository_pp();
            var xmlmenuitem = repo.GetXmlMenuItem(xmlmenuitemid);

            if (xmlmenuitem != null)
            {
                candidates = repo.GetMenuItemCandidates(xmlmenuitem);
            }
            candidates.XmlMenuItem = xmlmenuitem;
            return(View(candidates));
        }
コード例 #9
0
        //will replace search and replace all matches of itemname in ingredientsxref with itemguid
        public ActionResult ShrinkDuplicates(string itemname, string itemguid, string calories, string quantity)
        {
            var repo = new MatchedItemRepository_pp();

            if (repo.UpdateXrefIngredients(itemname, quantity, calories, itemguid))
            {
                return(Content("<div class=\"notify\">All " + itemname + " updated to use " + itemguid + " as matched ingredient</div>"));
            }
            else
            {
                return(Content("<div class=\"error-message\">Unable to update " + itemname + " to use " + itemguid + ", please refresh and try again.</div>"));
            }
        }
コード例 #10
0
 public ActionResult IngredientMatchControl(string xmlingredientid)
 {
     try
     {
         IngredientCandidates candidates = new IngredientCandidates();
         var repo          = new MatchedItemRepository_pp();
         var xmlingredient = repo.GetXmlIngredient(xmlingredientid);
         if (xmlingredient != null)
         {
             candidates = repo.GetIngredientCandidates(xmlingredient);
         }
         candidates.XmlIngredient = xmlingredient;
         return(View(candidates));
     }
     catch (Exception e)
     {
         return(Content("<p><div class=\"error-message\">Unable to find candidates, verify the menu item is matched.</div></p>"));
     }
 }
コード例 #11
0
        public ActionResult MatchAggregate(string xmlguid, string menuitemguid)
        {
            var repo      = new MatchedItemRepository_pp();
            var aggregate = new XmlMenuItem();

            if (!string.IsNullOrEmpty(xmlguid))
            {
                aggregate = repo.GetXmlMenuItemWithIngredients(xmlguid);

                foreach (var xmlIngredient in aggregate.Ingredients)
                {
                    //need to get ingredient match, different from menu item ingredients
                    var xref = repo.GetIngredientCrossReference(xmlIngredient.ItemIngredientGuid);
                    if (xref != null && xref.ingredientsguid != null) // means there is no match
                    {
                        xmlIngredient.IngredientMatch = repo.GetMatchedIngredient(xref.ingredientsguid.ToString(), true);
                    }
//
//                    if ( xmlIngredient.IngredientMatch == null)
//                        xmlIngredient.IngredientMatch = new IngredientAggregate();
                }
            }

            if (string.IsNullOrEmpty(menuitemguid))
            {
                //attempt to get from xref
                var xref = repo.GetMenuCrossReference(xmlguid);
                menuitemguid = xref.menuitemguid.ToString();
            }
            if (!string.IsNullOrEmpty(menuitemguid))
            {
                aggregate.MenuItemMatch = repo.GetMenuItemWithIngredients(menuitemguid);
            }


            return(View(aggregate));
        }
コード例 #12
0
        //
        // GET: /UpdateNutrionalInformation/
        public ActionResult Index()
        {
            var repo = new MatchedItemRepository_pp();

            return(View(repo.GetImport()));
        }