Spontaneous.WebApp.Services.DefaultMenuUtility.AddDefaultsMenus C# (CSharp) Method

AddDefaultsMenus() public method

public AddDefaultsMenus ( List restList ) : void
restList List
return void
        public void AddDefaultsMenus(List<RestaurantBasicData> restList) 
        {
            ServiceLayerImpl serviceLayer = new ServiceLayerImpl();
            int AddMenuCount = 0;
            int notNullMenuCount = 0;
            int notFoundDefMenuCount = 0;

            if (restList != null && restList.Count > 0) 
            {
                foreach (var rest in restList)
                {
                    var TempMenus = GetDefaultMenusList(rest);
                    if (TempMenus != null && TempMenus.Count > 0)
                    {
                        //if (rest.Menu != null && rest.Menu.MenuParts != null &&  (rest.Menu.MenuParts.Count == 0 || (rest.Menu.MenuParts.Count == 1 && rest.Menu.MenuParts[0].Name.IndexOf("כל המנות") >= 0))) //|| rest.UpdatedBy == "Back office")
                        if (rest.Menu != null && rest.Menu.MenuParts != null && rest.Menu.MenuParts.Count == 0)
                        {
                            AddMenuCount++;
                            ////If Menu contain "כל המנות" MenuPart combine it with other menus
                            //if (rest.Menu.MenuParts[0].Name.IndexOf("כל המנות") >= 0) 
                            //{
                            //    TempMenus.Add(rest.Menu);
                            //}

                            rest.Menu = CombineMenus(TempMenus);
                            string cuisineName = rest.Cuisine != null ? rest.Cuisine : "";
                            string cuisinesList = rest.Cuisines != null ? String.Join(", ", rest.Cuisines.ToArray()) : "Empty";
                            log.InfoFormat("[AddDefaultsMenus] Found default Menu and rest has null menu, for rest.Name={0}, Cuisine={1}, Cuisines List={2}.", rest.Name, cuisineName, cuisinesList);
                            //rest.UpdatedBy = "SupervisedCuisine_2014.05.29";
                            //rest.UpdatedBy = "AutoFoundCuisine_2014.06.12";
                            rest.UpdateDishesLocation();
                            serviceLayer.UpdateRestaurant(rest);
                        }
                        else
                        {
                            if (rest.Menu != null)
                            {
                                notNullMenuCount++;
                                string cuisineName = rest.Cuisine != null ? rest.Cuisine : "";
                                log.InfoFormat("[AddDefaultsMenus] Found default Menu and rest has Not null menu, for Cuisine={0}, rest.Name={1}.", cuisineName, rest.Name);
                            }
                        }
                    }
                    else
                    {
                        notFoundDefMenuCount++;
                        string cuisineName = rest.Cuisine != null ? rest.Cuisine : "";
                        log.InfoFormat("[AddDefaultsMenus] Not found default menu for Cuisine={0}, rest.Name={1}.", cuisineName, rest.Name);
                    }
                }
            }
            log.InfoFormat("[AddDefaultsMenus] Added menu to restaurants, count={0}.", AddMenuCount);
            log.InfoFormat("[AddDefaultsMenus] Found Cuisine for rest and rest.Menu was NOT empty count={0}.", notNullMenuCount);
            log.InfoFormat("[AddDefaultsMenus] Not found default menu count={0}.", notFoundDefMenuCount);
        }