Beispiel #1
0
        private async Task ProcessSelectRestaurantCommand(RestaurantData selectedRestaurant)
        {
            try
            {
                SelectedRestaurant = selectedRestaurant;
                Mvx.IoCProvider.Resolve <IAppLoader>().ShowIndicator();
                var response = await ProductService.ProcessInitRestaurantMenu(SelectedRestaurant);

                Mvx.IoCProvider.Resolve <IAppLoader>().StopIndicator();
                if (response != null)
                {
                    if (response != null)// && response.Code == AppConstants.SuccessCode)
                    {
                        MenuList     = response.Data.MenuItemsFirstPage.Data;
                        OGMenuList   = MenuList;
                        CategoryList = response.Data.RestaurantsCategories;
                        CategoryList.Insert(0, new RestaurantsCategory {
                            Id = 0, Title = "All", ImageUrl = CategoryList[1].ImageUrl, SelectedBackgroundColor = "AppColor", SelectedTextColor = "WhiteColor"
                        });
                    }
                    else
                    {
                        Mvx.IoCProvider.Resolve <IMessageBox>().ShowMessageBox(response.Message, null, false);
                    }
                }
            }
            catch (Exception ex)
            {
                Mvx.IoCProvider.Resolve <IAppLogger>().DebugLog(nameof(DashBoardViewModel), ex);
            }
        }
Beispiel #2
0
        public IActionResult OnPost()
        {
            //if (ModelState.IsValid)
            //{
            //    Cuisines = HtmlHelper.GetEnumSelectList<CuisineType>();
            //    Restaurant = RestaurantData.Update(Restaurant);
            //    //PRG - Post Redirect to Get
            //    return RedirectToPage("./Detail", new { restaurantId = Restaurant.Id });
            //}
            //RestaurantData.Commit();
            //return Page();

            if (!ModelState.IsValid)
            {
                Cuisines = HtmlHelper.GetEnumSelectList <CuisineType>();
                return(Page());
            }

            if (Restaurant.Id > 0)
            {
                Restaurant = RestaurantData.Update(Restaurant);
            }
            else
            {
                RestaurantData.Add(Restaurant);
            }
            TempData["Message"] = "Restaurant Saved";
            RestaurantData.Commit();
            return(RedirectToPage("./Detail", new { restaurantId = Restaurant.Id }));
        }
        public ActionResult Index(SearchModel searchModel)
        {
            var restaurants = RestaurantData.GetRestaurants();

            IEnumerable <Restaurant> model = null;

            if (ModelState.IsValid)
            {
                model = restaurants
                        .OrderByDescending(r => r.Id)
                        .Where(
                    r =>
                    searchModel == null || searchModel.SearchTerm == null ||
                    r.Name.StartsWith(searchModel.SearchTerm))
                        .Select(r => new Restaurant
                {
                    Id      = r.Id,
                    Name    = r.Name,
                    City    = r.City,
                    Country = r.Country
                });
            }
            if (Request.IsAjaxRequest())
            {
                return(PartialView("_PartialRestaurantView", model));
            }
            return(View(model));
        }
        public ActionResult Search()
        {

            var _restaurant = RestaurantData.GetRestaurants();
            return View(_restaurant);

        }
Beispiel #5
0
 void Start()
 {
     SaveLoad.Load();
     if (SaveLoad.savedData != null)
     {
         MyRestaurant = SaveLoad.savedData;
     }
 }
 public static void Delete()
 {
     savedData = null;
     if (File.Exists(Application.persistentDataPath + "/savedGames.gd"))
     {
         File.Delete(Application.persistentDataPath + "/savedGames.gd");
     }
 }
Beispiel #7
0
 public RestaurantData(RestaurantData data)
 {
     Name           = data.Name;
     City           = data.City;
     Persons        = data.Persons;
     Uid            = data.Uid;
     LastModifiedOn = data.LastModifiedOn;
 }
 // Use this for initialization
 void Start()
 {
     Check_NewPlayerGuide(); // 新手指引
     RestaurantData.CleanRestaurantTip();
     m_PushToggle.value = PlayerPreferenceData.SystemIsPushRestaurant;
     UpdateMoneyInfo();
     m_FoodWindow.GetComponent <RestaurantFoodWindow>().BindFoodItem();
 }
Beispiel #9
0
 public IActionResult OnGet(int restaurantId)
 {
     Restaurant = RestaurantData.GetById(restaurantId);
     if (Restaurant == null)
     {
         return(RedirectToPage("./NotFound"));
     }
     return(Page());
 }
Beispiel #10
0
 public void Load()
 {
     Debug.Log("Player loads");
     SaveLoad.Load();
     if (SaveLoad.savedData != null)
     {
         MyRestaurant = SaveLoad.savedData;
     }
 }
Beispiel #11
0
        public static List <Restaurant> GetAllRestaurants()
        {
            List <Restaurant> lsRestaurants = new List <Restaurant>();

            foreach (var item in RestaurantData.ShowAllRestaurants())
            {
                lsRestaurants.Add((Restaurant)item);
            }
            return(lsRestaurants);
        }
    public static void Save()
    {
        savedData = Player.instance.MyRestaurant;
        BinaryFormatter bf = new BinaryFormatter();

        using (FileStream file = File.Create(Application.persistentDataPath + "/savedGames.gd")) {
            bf.Serialize(file, SaveLoad.savedData);
            file.Close();
        }
    }
Beispiel #13
0
        public static List <Review> GetReviewsForRestaurant(string sRestName)
        {
            List <Review> lsLocalList = new List <Review>();

            foreach (var item in RestaurantData.ShowReviewsForRestaurant(sRestName))
            {
                lsLocalList.Add((Review)item);
            }

            return(lsLocalList);
        }
Beispiel #14
0
 protected override void LazySet()
 {
     base.LazySet();
     if (PersistenceState == PersistenceState.NewAndChanged || PersistenceState == PersistenceState.LoadedAndChanged)
     {
         if ((object)InnerData == (object)OriginalData)
         {
             OriginalData = new RestaurantData(InnerData);
         }
     }
 }
 public static void Load()
 {
     if (File.Exists(Application.persistentDataPath + "/savedGames.gd"))
     {
         BinaryFormatter bf = new BinaryFormatter();
         using (FileStream file = File.Open(Application.persistentDataPath + "/savedGames.gd", FileMode.Open)) {
             savedData = (RestaurantData)bf.Deserialize(file);
             file.Close();
         }
     }
 }
        public uint Execute(PacketDistributed ipacket)
        {
            GC_RESTAURANT_DESTUPDATE packet = (GC_RESTAURANT_DESTUPDATE)ipacket;

            if (null == packet)
            {
                return((uint)PACKET_EXE.PACKET_EXE_ERROR);
            }
            RestaurantData.UpdatePlayerDeskData(packet);
            return((uint)PACKET_EXE.PACKET_EXE_CONTINUE);
        }
Beispiel #17
0
        public static List <Review> GetAllReviews()
        {
            List <Review> lsReviews = new List <Review>();

            foreach (var item in RestaurantData.ShowAllReviews())
            {
                lsReviews.Add((Review)item);
            }

            return(lsReviews);
        }
Beispiel #18
0
        private static List <Restaurant> PrintRestaurants()
        {
            RestaurantData    crud = new RestaurantData();
            List <Restaurant> returnRestaurants = new List <Restaurant>();

            foreach (Restaurant r in crud.PrintRestaurants())
            {
                returnRestaurants.Add(r);
            }

            return(returnRestaurants);
        }
Beispiel #19
0
        public IActionResult OnPost(int restaurantId)
        {
            var restaurant = RestaurantData.Delete(restaurantId);

            RestaurantData.Commit();
            if (restaurant == null)
            {
                return(RedirectToPage("./NotFound"));
            }

            TempData["Message"] = $"{restaurant.Name} deleted";
            return(RedirectToPage("./List"));
        }
Beispiel #20
0
    void OnEnable()
    {
        if (bgTween != null)
        {
//			bgTween.enabled = true;
//			bgTween.from = 0f;
//			bgTween.to = 1f;
            bgTween.Play();
        }
        RestaurantData.StatisticsRestaurantWaitBilling();
        UpdateBelleTip();
        UpdateRestaurantTips();
        UpdateFellowRedTip();
    }
Beispiel #21
0
        public static async Task <InitMenuResponse> ProcessInitRestaurantMenu(RestaurantData selectedRestaurant)
        {
            try
            {
                var request = new RestRequest(AppConstants.RestApi.InitRestaurantMenu);
                request.AddParameter("restaurantId", selectedRestaurant.Id);
                var response = await BaseWebService.ExecuteGet <InitMenuResponse>(request);

                return(response);
            }
            catch (Exception e)
            {
                Mvx.IoCProvider.Resolve <IAppLogger>().DebugLog(nameof(ProductService), e);
                return(null);
            }
        }
Beispiel #22
0
        public IActionResult OnGet(int?id)
        {
            Cuisines = HtmlHelper.GetEnumSelectList <CusineType>();

            Restaurant = id.HasValue ? RestaurantData.FindRestaurant(id.Value)
                : new Restaurant();

            CancelDestination = id.HasValue ? "./Details" : "./List";

            if (Restaurant == null)
            {
                RedirectToPage("./NotFound");
            }

            return(Page());
        }
Beispiel #23
0
 public IActionResult OnGet(int?restaurantId)
 {
     if (restaurantId.HasValue)
     {
         Restaurant = RestaurantData.GetById(restaurantId.Value);
     }
     else
     {
         Restaurant = new Restaurant();
     }
     if (Restaurant == null)
     {
         return(RedirectToPage("../Shared/NotFound"));
     }
     return(Page());
 }
Beispiel #24
0
        public IActionResult OnPost()
        {
            if (!ModelState.IsValid)
            {
                Cuisines = HtmlHelper.GetEnumSelectList <CusineType>();
                return(Page());
            }

            Restaurant = Restaurant.Id > 0 ?
                         RestaurantData.Update(Restaurant):
                         RestaurantData.Add(Restaurant);

            _ = RestaurantData.Commit();

            TempData["Message"] = "Restaurant saved.";
            return(RedirectToPage("./Details", new { Restaurant.Id }));
        }
Beispiel #25
0
 public IActionResult OnGet(int?restaurantId)
 {
     Cuisines = HtmlHelper.GetEnumSelectList <CuisineType>();
     if (restaurantId.HasValue)
     {
         Restaurant = RestaurantData.GetById(restaurantId.Value);
     }
     else
     {
         Restaurant = new Restaurant();
     }
     if (Restaurant == null)
     {
         return(RedirectToPage("./NotFound"));
     }
     return(Page());
 }
        public IActionResult Restaurants(string option)
        {
            if (option == "random")
            {
                RestaurantData.Randomize();
                RestaurantData.Restaurants = RestaurantData.RandomRestaurants;
                return(View(RestaurantData.Restaurants));
            }
            if (option == "distance")
            {
                RestaurantData.Restaurants = RestaurantData.DistanceRestaurants;
                return(View(RestaurantData.Restaurants));
            }



            return(View(RestaurantData.Restaurants));
        }
Beispiel #27
0
        public List <Restaurant> GetRestaurant()
        {
            DataTable         restaurantsTable = RestaurantData.GetRestaurants();
            List <Restaurant> restaurantsList  = new List <Restaurant>(restaurantsTable.Rows.Count);

            foreach (DataRow dr in restaurantsTable.Rows)
            {
                Restaurant temp = new Restaurant();
                temp.Id          = Convert.ToInt32(dr["Id"].ToString());
                temp.CorporateId = Convert.ToInt64(dr["KorporataId"].ToString());
                temp.Description = dr["Pershkrimi"].ToString();
                temp.AddressId   = Convert.ToInt64(dr["AdresaId"].ToString());
                temp.TelephoneNr = dr["NrTelefonit"].ToString();
                temp.MenuId      = Convert.ToInt32(dr["MenuId"].ToString());
                restaurantsList.Add(temp);
            }
            return(restaurantsList);
        }
        public async Task <IActionResult> Index(LocationViewModel model)
        {
            if (ModelState.IsValid)
            {
                var UserLocation = await GeocodeCall.LoadGeocode(model.Location);

                RestaurantData.Restaurants = await NearbyRestaurantsCall.LoadRestaurants(UserLocation.Lat, UserLocation.Lng);

                RestaurantData.DistanceRestaurants = RestaurantData.Restaurants;
                RestaurantData.Randomize();
                RestaurantData.Restaurants = RestaurantData.RandomRestaurants;
                return(Redirect("/home/restaurants"));
            }
            else
            {
                return(View(model));
            }
        }
 public ActionResult EditRestaurant(RestaurantData data)
 {
     if (!data.Equals(null))
     {
         try
         {
             Restaraunt     EditRestaraunt = data.RestarauntData;
             RestarauntLang EditRestLang   = data.RestaurantLangData;
             restRepository.SaveRestaraunt(EditRestaraunt);
             restLangRepository.SaveRestarauntLang(EditRestLang);
             return(Json(new { result = "success" }));
         }
         catch
         {
             return(Json(new { result = "error", message = "Ooooooops! Some troubles was happened with DB." }));
         }
     }
     return(Json(new { result = "error", message = "JSON IS NULL" }));
 }
        public IActionResult OnPost()
        {
            System.Diagnostics.Debug.WriteLine("---------------OnPost-----------------");
            System.Diagnostics.Debug.WriteLine(Restaurant == null);

            if (ModelState.IsValid)                // Validating Data Annotations(of Model) using IsValid Property
            {                                      // if any validation error occurs then it is saved in
                                                   // ModelState["Location"].Errors collection (for Restaurant.Location field only)
                RestaurantData.Create(Restaurant); // Yha pr restaurant avail kese hua
                RestaurantData.commit();
                // As post must redirect to some Get req page so the changes might not
                // get submitted again if user refreshes the page
                return(RedirectToPage("./List"));
            }

            System.Diagnostics.Debug.WriteLine("-----------------------Debug-----------------------------");
            System.Diagnostics.Debug.WriteLine(ModelState["PureVeg"].Errors[0]);

            return(RedirectToPage("./ErrorAddRest", new { modelStates = ModelState.Values }));
        }