protected void Page_Load(object sender, EventArgs e)
        {
            Miami.Substitute.Bll.Location location = new Miami.Substitute.Bll.Location();
            DataView  dv     = location.GetUserLocations();
            DataTable result = dv.Table.Clone();

            result.Clear();

            if (dv != null)
            {
                string LocationName = string.Empty;
                foreach (DataRow dr in dv.Table.Rows)
                {
                    if (dr["LName"].ToString() != LocationName)
                    {
                        result.Rows.Add(dr.ItemArray);
                    }
                    else
                    {
                        result.Rows[result.Rows.Count - 1]["UName"] += "<br>" + dr["UName"].ToString();
                        result.Rows[result.Rows.Count - 1]["Email"] += "<br>" + dr["Email"].ToString();
                    }

                    LocationName = dr["LName"].ToString();
                }
            }
            LocationsList.DataSource = result.DefaultView;
            LocationsList.DataBind();
        }
        public LocationsList Get()
        {
            Database.Connect();
            SqlDataReader reader = Database.Query(
                "SELECT g.location_id, g.location_name, g.x_coordinate, g.y_coordinate, g.description, a.species " +
                "FROM GPS_Locations as g LEFT JOIN Animal_Locations as a ON g.location_id = a.location_id;"
                );

            LocationsList locations = new LocationsList();

            while (reader.Read())
            {
                LocationData data = new LocationData();
                data.location_id   = int.Parse(reader["location_id"].ToString());
                data.location_name = reader["location_name"].ToString();
                data.x_coordinate  = double.Parse(reader["x_coordinate"].ToString());
                data.y_coordinate  = double.Parse(reader["y_coordinate"].ToString());
                data.description   = reader["description"].ToString();
                data.species       = reader["species"].ToString();
                locations.LocationData.Add(data);
            }

            Database.Disconnect();
            return(locations);
        }
        public ActionResult Location(LocationsList locationList)
        {
            try
            {
                order = TempData.Peek <OrderClass>("order");
                if (ModelState.IsValid)
                {
                    order.location = repo.GetLocationByDescription(locationList.locationDescription);
                    TempData.Put("order", order);

                    return(RedirectToAction(nameof(PlaceOrder)));
                }
                else
                {
                    return(View());
                }
            }
            catch (ArgumentException ex)
            {
                ModelState.AddModelError("Id", ex.Message);
                return(View(repo.GetAllLocations()));
            }
            catch
            {
                return(View(repo.GetAllLocations()));
            }
        }
Exemple #4
0
        /// <summary>
        /// Adds a new location to the location list
        /// </summary>
        private void AddLocation()
        {
            try
            {
                // Set the flag to indicate that the user is choosing a location
                IsLoadingALocation = true;

                var location = DI.Get <IDirectoryService>().GetLocation();
                if (Directory.Exists(location))
                {
                    // TODO:
                    // Prevent adding drives

                    // Add the new location
                    if (!LocationsList.Contains(location))
                    {
                        LocationsList.Add(location);
                        HasLocation = true;
                    }

                    // Display a hint when the first location is added
                    if (!FirstLocationAdded)
                    {
                        DI.PopupMenuViewModel.ShowMenu("HINT",
                                                       "You can add more locations if your music collection reside in different directories", "Got it", null, 10000);
                        FirstLocationAdded = true;
                    }
                }
            }
            finally
            {
                // Set the flag to indicate that the user has closed the dialog
                IsLoadingALocation = false;
            }
        }
        public ActionResult ChooseDefaultLocation(LocationsList Locationlist)
        {
            try
            {
                order = TempData.Peek <OrderClass>("order");
                if (ModelState.IsValid)
                {
                    order.customer.DefaultLocation = repo.GetLocationByDescription(Locationlist.locationDescription);
                    repo.UpdateUser(order.customer);
                    repo.SaveChanges();
                    TempData.Put("order", order);

                    return(RedirectToAction(nameof(Options)));
                }
                else
                {
                    return(View());
                }
            }
            catch (ArgumentException ex)
            {
                ModelState.AddModelError("Id", ex.Message);
                return(View());
            }
            catch
            {
                return(View());
            }
        }
        public IActionResult Location()
        {
            LocationsList list = new LocationsList();

            list.InitializeList(repo.GetAllLocations());

            return(View(list));
        }
        public IActionResult AdminLocationPicker()
        {
            LocationsList locationList = new LocationsList();

            locationList.InitializeList(repo.GetAllLocations());

            return(View(locationList));
        }
Exemple #8
0
 private void ListOfLocationsForUser()
 {
     System.Console.WriteLine("\n\nList of PizzaBox Locations");
     //a signle with a list of location based on the user
     //location.
     for (int i = 0; i < LocationsList.Instance().Count; i++)
     {
         var locationObject = LocationsList.Instance()[i];
         //System.Console.WriteLine($"{i+1}. {locationObject.StoreAddress.Street} {locationObject.StoreAddress.City}, {locationObject.StoreAddress.State} {locationObject.StorePhone}");
         System.Console.WriteLine($"{i+1}. Store#: {locationObject.StoreID}\n\t{locationObject.StoreAddress.Street}");
     }
 }
Exemple #9
0
        private void warehouseListview_ItemTapped(object sender, ItemTappedEventArgs ea)
        {
            LocationsList pd = ea.Item as LocationsList;

            location_id = pd.id;

            warehousesBar.Text  = pd.name;
            wh_stock.IsVisible  = false;
            pro_stock.IsVisible = false;

            btn_layout.IsVisible = true;
        }
Exemple #10
0
    private void CreateLocationsList()
    {
        LocationsList = FindObjectsOfType <Location>();
        List <string> revealedLocations = UserProfile.Instance.FoundHiddenLocations;

        LocationNames = LocationsList
                        .Where(t => t.known || revealedLocations.Contains(t.locationName)).Select(t => t.locationName).ToList();
        for (int i = 0; i < LocationsList.Length; i++)
        {
            locationsDictionary.Add(LocationsList[i].locationName, LocationsList[i]);
        }

        Debug.Log("Location lists created. Locations found: " + LocationsList.Length);
    }
Exemple #11
0
        private string GetLocationEmail(string locationName)
        {
            var location = LocationsList.FirstOrDefault(l => l.Name == locationName);

            if (location == null)
            {
                return(string.Empty);
            }
            var resource = ResourcesList.FirstOrDefault(r => r.Id == location.OwningResourceId);

            if (resource != null)
            {
                return(resource.EmailAddress);
            }

            return(string.Empty);
        }
Exemple #12
0
        private void UserSelectALocation()
        {
            string reader;

            System.Console.Write("\nPlease select your closest location: ");
            reader = System.Console.ReadLine();
            int selected = Convert.ToInt16(reader);

            selected -= 1;
            int store = 0;

            if (selected >= 0 && selected < LocationsList.Instance().Count)
            {
                store = LocationsList.Instance()[selected].StoreID;
                CurrentUsersList.Instance()[0].PizzaBoxStore.PrimaryStoreID = store;
                System.Console.WriteLine($"\tYou have selected store number #{store}");
            }
        }