public async Task <ActionResult <Venues> > PostVenues(Venues venues)
        {
            _context.Venues.Add(venues);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetVenues", new { id = venues.VenueId }, venues));
        }
示例#2
0
 public void Update(Venues venue)
 {
     if (venue != null && Exists(venue.VenueID))
     {
         db.SaveChanges();
     }
 }
示例#3
0
        VisualElement CreateVenuePicker(GroupID groupId, Venues venues, VenueID venueIdToSelect = null)
        {
            var venueList = new ScrollView(ScrollViewMode.Vertical)
            {
                style = { marginTop = 8, flexGrow = 1 }
            };

            venueList.Add(new Button(() => CreateNewVenue(groupId))
            {
                text = "新規作成"
            });

            venueList.Add(new Label()
            {
                text = "作成済みワールドから選ぶ", style = { marginTop = 12 }
            });
            foreach (var venue in venues.List.OrderBy(venue => venue.Name))
            {
                var venueButton = new Button(() => { reactiveCurrentVenue.Val = venue; })
                {
                    text  = venue.Name,
                    style = { unityTextAlign = TextAnchor.MiddleLeft },
                };
                venueList.Add(venueButton);
            }

            reactiveCurrentVenue.Val = venues.List.Find(venue => venue.VenueId == venueIdToSelect);

            return(venueList);
        }
示例#4
0
        public ActionResult Create()
        {
            Venue newVenues = new Venues(Request.Form["venuesName"]);

            newVenues.Save();
            return(RedirectToAction("Success", "Home"));
        }
示例#5
0
        public Venues Post([FromBody] Venues venue)
        {
            Venues returnVenue = null;

            using (SqlConnection conn = new SqlConnection(_dbOptions.Value.ConnectionString))
            {
                try
                {
                    conn.Open();
                    string insertSql = "INSERT INTO Venues (VenueName, Coordinates, Capacity, City)" +
                                       "VALUES(@VenueName, @Coordinates, @Capacity, @City);";
                    conn.Execute(insertSql, venue);
                }
                catch (SqlException exc)
                {
                    Console.WriteLine(exc.Message);
                }

                string selectSql  = "SELECT * FROM Venues WHERE VenueName = @VenueName;";
                Venues indexVenue = conn.Query <Venues>(selectSql, venue).FirstOrDefault();
                returnVenue = indexVenue;
                if (indexVenue != null)
                {
                    _client.IndexDocument(indexVenue);
                }
            }

            return(returnVenue);
        }
        VisualElement CreateVenuePicker(GroupID groupId, Venues venues, VenueID venueIdToSelect = null)
        {
            var venueList = new ScrollView(ScrollViewMode.Vertical)
            {
                style = { marginTop = 8 }
            };

            venueList.Add(new Button(() => CreateNewVenue(groupId))
            {
                text  = "新規会場",
                style = { color = new StyleColor(new Color(0.5f, 1, 0.5f)) }
            });

            foreach (var venue in venues.List.OrderBy(venue => venue.Name))
            {
                var venueButton = new Button(() => { reactiveCurrentVenue.Val = venue; })
                {
                    text  = venue.Name,
                    style = { unityTextAlign = TextAnchor.MiddleLeft },
                };
                venueList.Add(venueButton);
            }

            reactiveCurrentVenue.Val = venues.List.Find(venue => venue.VenueId == venueIdToSelect);

            return(venueList);
        }
示例#7
0
        public int setNewVenueAndCheckinList(List <Item2> itemList, DateTime dt)
        {
            int newVenueNumber = 0;

            foreach (Item2 item in itemList)
            {
                if (!Venues.Any(venue => venue.Id == item.venue.id))
                {
                    Venues.Add(new Venue
                    {
                        Id         = item.venue.id,
                        Address    = item.venue.location.address,
                        Lat        = item.venue.location.lat,
                        Lng        = item.venue.location.lng,
                        CategoryId = item.venue.categories.FirstOrDefault().id,
                        Name       = item.venue.name
                    });
                    newVenueNumber++;
                }

                Checkins.Add(new CheckinStatistic
                {
                    Venue_FK      = item.venue.id,
                    DateTime      = dt,
                    CheckinNumber = item.venue.stats.checkinsCount,
                    UserNumber    = item.venue.stats.usersCount
                }
                             );
            }
            return(newVenueNumber);
        }
        public ActionResult Create(Venues venues, HttpPostedFileBase ImagePath)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    var viewModel = new VenueCitiesViewModel
                    {
                        Venues = venues,
                        Cities = _context.Cities.ToList()
                    };
                }

                venues.ApplicationUserCreatedById     = "4af95f1c-0f73-4df9-bb6d-166a07b6e5f4";
                venues.ApplicationUserCreatedDate     = DateTime.Now;
                venues.ApplicationUserLastUpdatedById = venues.ApplicationUserCreatedById;
                venues.ApplicationUserLastUpdatedDate = DateTime.Now;
                // TODO: Add insert logic here
                _context.venues.Add(venues);
                _context.SaveChanges();
                return(RedirectToAction("CreateImages/" + venues.Id));
            }
            catch
            {
                return(View());
            }
        }
        public ActionResult Edit(int id, Venues venues)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    var viewModel = new VenueCitiesViewModel
                    {
                        Venues = venues,
                        Cities = _context.Cities.ToList()
                    };

                    //return View("CustomerForm", viewModel);
                }
                // TODO: Add update logic here
                var venueinDb = _context.venues.Single(v => v.Id == venues.Id);
                venueinDb.VenueName    = venues.VenueName;
                venueinDb.Address      = venues.Address;
                venueinDb.Street       = venues.Street;
                venueinDb.Sector       = venues.Sector;
                venueinDb.CityId       = venues.CityId;
                venueinDb.Introduction = venues.Introduction;
                venueinDb.ContactNo    = venues.ContactNo;
                //venueinDb.ImagePath = venues.ImagePath;

                _context.SaveChanges();
                return(RedirectToAction("CreateImages/" + id));
            }
            catch
            {
                return(View());
            }
        }
 /// <summary>
 /// Venues the update dal.
 /// </summary>
 /// <param name="_Venues">The venues.</param>
 /// <returns>System.Int32.</returns>
 public int Venues_UpdateDAL(Venues _Venues)
 {
     return(ExecuteScalarInt32Sp("Venues_Update",
                                 ParamBuilder.Par("ID", _Venues.ID),
                                 ParamBuilder.Par("PrimaryName", _Venues.PrimaryName),
                                 ParamBuilder.Par("SecondaryName", _Venues.SecondaryName),
                                 ParamBuilder.Par("VenueStatusID", _Venues.VenueStatusID),
                                 ParamBuilder.Par("DrivingInstruction", _Venues.DrivingInstruction),
                                 ParamBuilder.Par("Coordinates", _Venues.Coordinates),
                                 ParamBuilder.Par("PersonID", _Venues.PersonID),
                                 ParamBuilder.Par("VenueCodeID", _Venues.VenueCodeID),
                                 ParamBuilder.Par("Rating", _Venues.Rating),
                                 ParamBuilder.Par("RateType", _Venues.RateType),
                                 ParamBuilder.Par("Cost", _Venues.Cost),
                                 ParamBuilder.Par("Currency", _Venues.Currency),
                                 ParamBuilder.Par("Setup", _Venues.Setup),
                                 ParamBuilder.Par("Notes", _Venues.Notes),
                                 ParamBuilder.Par("Capacity", _Venues.Capacity),
                                 ParamBuilder.Par("ContactPersonName", _Venues.ContactPersonName),
                                 ParamBuilder.Par("ContactPersonPhone", _Venues.ContactPersonPhone),
                                 ParamBuilder.Par("ContactPersonEmail", _Venues.ContactPersonEmail),
                                 ParamBuilder.Par("AvailableFrom", _Venues.AvailableFrom),
                                 ParamBuilder.Par("AvailableTo", _Venues.AvailableTo),
                                 ParamBuilder.Par("IsCommon", _Venues.IsCommon),
                                 ParamBuilder.Par("AddressLine1", _Venues.AddressLine1),
                                 ParamBuilder.Par("AddressLine2", _Venues.AddressLine2),
                                 ParamBuilder.Par("ZipCode", _Venues.ZipCode),
                                 ParamBuilder.Par("CountryID", _Venues.CountryID),
                                 ParamBuilder.Par("StateID", _Venues.StateID),
                                 ParamBuilder.Par("CityID", _Venues.CityID),
                                 ParamBuilder.Par("UpdatedBy", _Venues.UpdatedBy),
                                 ParamBuilder.Par("UpdatedDate", _Venues.UpdatedDate)
                                 ));
 }
示例#11
0
        private async Task LoadVenues()
        {
            if (IsBusy)
            {
                return;
            }
            IsBusy = true;

            Venues.Clear();

            try
            {
                var response = await _foursquare.GetVenues("coffee", CurrentLocation);

                foreach (var v in response.Venues)
                {
                    Venues.Add(v);
                }

                // Publish message that Venues collection has been fully loaded
                MessagingCenter.Send(this, "VenuesLoaded");
            }
            finally
            {
                IsBusy = false;
            }
        }
        public Goal OutOfGoalViewModel(GoalViewModel goalViewModel, string username)
        {
            Sports sports = new Sports(SessionProvider.CurrentSession);
            Venues venues = new Venues(SessionProvider.CurrentSession);
            Goals goals = new Goals(SessionProvider.CurrentSession);
            Users users = new Users(SessionProvider.CurrentSession);

            Goal goal;
            if(goalViewModel.Id == 0)
            {
                goal = new Goal();
                goal.CreatedOn = DateTime.Now;
                goal.UserCreator = users.GetByUserName(username);
            }
            else
            {
                goal = goals.GetById(goalViewModel.Id);
            }
            
            goal.Name = goalViewModel.Name;
            goal.Date = goalViewModel.Date;
            goal.Description = goalViewModel.Description;

            goal.Web = goalViewModel.Web;
            goal.Venue = venues.GetById(Convert.ToInt32(goalViewModel.VenueId));
            goal.Sport = sports.GetById(Convert.ToInt32(goalViewModel.SportId));

            goal.Venue.Latitude = Convert.ToInt32(goalViewModel.VenueLatitude);
            goal.Venue.Longitude = Convert.ToInt32(goalViewModel.VenueLongitude);

            return goal;
        }
        public async Task <IActionResult> PutVenues(Guid id, Venues venues)
        {
            if (id != venues.VenueId)
            {
                return(BadRequest());
            }

            _context.Entry(venues).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!VenuesExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
示例#14
0
        public ActionResult DeleteConfirmed(int id)
        {
            Venues venues = db.Venues.Find(id);

            db.Venues.Remove(venues);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        Venues       v  = new Venues();
        List <Venue> vs = v.GetVenues();

        DataList1.DataSource = vs;
        DataList1.DataBind();
    }
示例#16
0
    private void PopulateVenueGridView()
    {
        Venues        venue     = new Venues(_connString);
        List <Venues> tblVenues = venue.GetVenues();

        VenueGridView.DataSource = tblVenues;
        VenueGridView.DataBind();
    }
        public async Task OnGetAsync()
        {
            Venues = await _venueService.GetAll();

            Venues.Insert(0, new Venue());

            SelectListVenues = new SelectList(Venues, nameof(Venue.VenueId), nameof(Venue.Name));
        }
示例#18
0
 public void Insert(Venues venue)
 {
     if (venue == null)
     {
         return;
     }
     db.Venues.Add(venue);
     db.SaveChanges();
 }
        /// <summary>
        /// Venues the delete dal.
        /// </summary>
        /// <param name="_Venues">The venues.</param>
        /// <returns>System.Int32.</returns>
        public int Venues_DeleteDAL(Venues _Venues)
        {
            return(ExecuteScalarInt32Sp("Venues_Delete",
                                        ParamBuilder.Par("ID", _Venues.ID),
                                        ParamBuilder.Par("UpdatedBy", _Venues.UpdatedBy),
                                        ParamBuilder.Par("UpdatedDate", _Venues.UpdatedDate)

                                        ));
        }
示例#20
0
    private void PopulateVenue(string venue_ID)
    {
        Guid   newVenue_ID = new Guid(venue_ID);
        Venues venue       = new Venues(_connString, newVenue_ID);

        txtVenueName.Text       = venue.Venue_Name;
        divGetVenue.Visible     = false;
        divVenueDetails.Visible = true;
    }
 private void Initialize()
 {
     countries = new Countries(session);
     cities = new Cities(session);
     venues = new Venues(session);
     users = new Users(session);
     sports = new Sports(session);
     goals = new Goals(session);
 }
示例#22
0
 public void Delete(Venues venue)
 {
     if (venue == null)
     {
         return;
     }
     db.Venues.Remove(venue);
     db.SaveChanges();
 }
 public UserContext()
 {
     //Post = new Post();
     //User = new Users();
     Providers  = new Providers();
     LARS       = new LARS();
     LARSSearch = new LARSSearch();
     Venues     = new Venues();
 }
        /// <summary>
        ///     Gets the hash code
        /// </summary>
        /// <returns>Hash code</returns>
        public override int GetHashCode()
        {
            // credit: http://stackoverflow.com/a/263416/677735
            unchecked // Overflow is fine, just wrap
            {
                var hash = 41;
                // Suitable nullity checks etc, of course :)

                if (CountryCodes != null)
                {
                    hash = hash * 59 + CountryCodes.GetHashCode();
                }

                if (BettingTypes != null)
                {
                    hash = hash * 59 + BettingTypes.GetHashCode();
                }

                if (TurnInPlayEnabled != null)
                {
                    hash = hash * 59 + TurnInPlayEnabled.GetHashCode();
                }

                if (MarketTypes != null)
                {
                    hash = hash * 59 + MarketTypes.GetHashCode();
                }

                if (Venues != null)
                {
                    hash = hash * 59 + Venues.GetHashCode();
                }

                if (MarketIds != null)
                {
                    hash = hash * 59 + MarketIds.GetHashCode();
                }

                if (EventTypeIds != null)
                {
                    hash = hash * 59 + EventTypeIds.GetHashCode();
                }

                if (EventIds != null)
                {
                    hash = hash * 59 + EventIds.GetHashCode();
                }

                if (BspMarket != null)
                {
                    hash = hash * 59 + BspMarket.GetHashCode();
                }

                return(hash);
            }
        }
示例#25
0
        public async void GetVenues()
        {
            var response = await Search.SearchRequest(locationHelper.position.Latitude, locationHelper.position.Longitude, 500, Query);

            Venues.Clear();
            foreach (var venue in response.venues)
            {
                Venues.Add(venue);
            }
        }
示例#26
0
        public async void GetVenues(double lat, double lng)
        {
            var venues = await Venue.GetVenues(lat, lng);

            Venues.Clear();
            foreach (var venue in venues)
            {
                Venues.Add(venue);
            }
        }
示例#27
0
 public ActionResult Edit([Bind(Include = "Id,Venue,VenAddress")] Venues venues)
 {
     if (ModelState.IsValid)
     {
         db.Entry(venues).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(venues));
 }
示例#28
0
        public List <Venues> GetAll()
        {
            VenuesDAC     _venuesComponent = new VenuesDAC();
            IDataReader   reader           = _venuesComponent.GetAllVenues().CreateDataReader();
            List <Venues> _venuesList      = new List <Venues>();

            while (reader.Read())
            {
                if (_venuesList == null)
                {
                    _venuesList = new List <Venues>();
                }
                Venues _venues = new Venues();
                if (reader["ID"] != DBNull.Value)
                {
                    _venues.ID = Convert.ToInt32(reader["ID"]);
                }
                if (reader["Name"] != DBNull.Value)
                {
                    _venues.Name = Convert.ToString(reader["Name"]);
                }
                if (reader["Description"] != DBNull.Value)
                {
                    _venues.Description = Convert.ToString(reader["Description"]);
                }
                if (reader["Location"] != DBNull.Value)
                {
                    _venues.Location = Convert.ToString(reader["Location"]);
                }
                if (reader["Star"] != DBNull.Value)
                {
                    _venues.Star = Convert.ToInt32(reader["Star"]);
                }
                if (reader["URL"] != DBNull.Value)
                {
                    _venues.URL = Convert.ToString(reader["URL"]);
                }
                if (reader["Phone"] != DBNull.Value)
                {
                    _venues.Phone = Convert.ToString(reader["Phone"]);
                }
                if (reader["Fax"] != DBNull.Value)
                {
                    _venues.Fax = Convert.ToString(reader["Fax"]);
                }
                if (reader["Email"] != DBNull.Value)
                {
                    _venues.Email = Convert.ToString(reader["Email"]);
                }
                _venues.NewRecord = false;
                _venuesList.Add(_venues);
            }
            reader.Close();
            return(_venuesList);
        }
示例#29
0
        public ActionResult Create([Bind(Include = "Id,Venue,VenAddress")] Venues venues)
        {
            if (ModelState.IsValid)
            {
                db.Venues.Add(venues);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(venues));
        }
 public void LoadItems()
 {
     Venues.Clear();
     foreach (Venue v in administrationService.GetVenues())
     {
         Venues.Add(new VenueVM(v, administrationService));
     }
     CurrentVenue = Venues.First();
     RaisePropertyChangedEvent(nameof(Venues));
     RaisePropertyChangedEvent(nameof(CurrentVenue));
 }
示例#31
0
        public bool Insert(Venues venues)
        {
            int       autonumber       = 0;
            VenuesDAC venuesComponent  = new VenuesDAC();
            bool      endedSuccessfuly = venuesComponent.InsertNewVenues(ref autonumber, venues.Name, venues.Description, venues.Location, venues.Star, venues.URL, venues.Phone, venues.Fax, venues.Email);

            if (endedSuccessfuly)
            {
                venues.ID = autonumber;
            }
            return(endedSuccessfuly);
        }
示例#32
0
 public VenuesViewModel(Venues venues)
 {
     VenueID      = venues.VenueID;
     VenueTypeID  = venues.VenueTypeID;
     CityID       = venues.CityID;
     Name         = venues.Name;
     Street       = venues.Street;
     StreetNumber = venues.StreetNumber;
     Phone        = venues.Phone;
     CityName     = venues.City.CityName;
     VenueType    = venues.VenueType.Type;
 }
示例#33
0
    protected void btnAddVenue_Click(object sender, EventArgs e)
    {
        Venue_Name = txtVenueName.Text;
        if (string.IsNullOrEmpty(Venue_Name))
        {
            MessageLabel.Text = "You must enter a Venue Name";
        }
        else if (string.IsNullOrEmpty(Venue_Address_ID))
        {
            MessageLabel.Text = "You must add an Address";
        }
        else if(string.IsNullOrEmpty(Venue_Contact_ID))
        {
            MessageLabel.Text="You must add a Contact";
        }
        else
        {
            MembershipUser userInfo = Membership.GetUser();
            Guid user_ID = (Guid)userInfo.ProviderUserKey;

            Common.Venue_Address_ID = Venue_Address_ID;
            Common.Venue_Contact_ID = Venue_Contact_ID;

            if (!string.IsNullOrEmpty(Venue_Address_ID) && !string.IsNullOrEmpty(Venue_Contact_ID))
            {
                Guid address_ID = new Guid(Venue_Address_ID);
                Guid person_ID = new Guid(Venue_Contact_ID);

                Venues venue = new Venues();
                venue.Venue_Name = txtVenueName.Text;
                venue.Address_ID = address_ID;
                venue.Venue_Contact = person_ID;

                Guid? venue_ID = venue.Insert_Venue(user_ID);

                if (venue_ID != null)
                {
                    Venue_ID = venue_ID.ToString();
                    Common.Venue_ID = Venue_ID;
                    MessageLabel.Text = string.Format("{0} was added successfully", venue.Venue_Name);
                    PopulateAddress(Venue_Address_ID);
                    PopulatePerson(Venue_Contact_ID);
                    if (!string.IsNullOrEmpty(btnReturn.PostBackUrl))
                        DivReturn.Visible = true;
                }
            }
            PopulateVenueGridView();
        }
    }
        private void Initialize()
        {
            InitalizeSessionFactory(
                typeof (Country).Assembly,
                typeof (Goal).Assembly,
                typeof (User).Assembly,
                typeof (Venue).Assembly,
                typeof (Country).Assembly,
                typeof (Sport).Assembly);

            countries = new Countries(session);
            cities = new Cities(session);
            venues = new Venues(session);
            users = new Users(session);
            sports = new Sports(session);
            goals = new Goals(session);
            goalParticipants = new GoalParticipants(session);
        }
示例#35
0
        private void LoadVenueList()
        {
            Venues vnues = new Venues();

            vnues.GetAll();

            vnues.Sort(delegate(Venue p1, Venue p2)
            {
                return p1.VenueName.CompareTo(p2.VenueName);
            });

            ddlVenues.DataSource = vnues;
            ddlVenues.DataTextField = "venueName";
            ddlVenues.DataValueField = "venueID";
            ddlVenues.DataBind();
            ddlVenues.Items.Insert(0, new ListItem(unknownValue));
            // Utilities.General.SortDropDownList(ddlVenues);
        }
示例#36
0
    /// <summary> 
    /// This function is used to search the venues in a particular
    /// location based on the given parameters
    /// </summary>
    /// <param name="keywords">The search criteria</param>
    /// <param name="location">Sets the geographical point of interest for the search</param>
    /// <param name="within">Sets a geographical radius for the search</param>
    /// <param name="key">key required to call the API</param>
    /// <returns>JSON in string format containg all the venues supplied as a result of the search</returns> 
    public string GetVenues(string keywords, String location, String within, string key)
    {
        //http://api.eventful.com/rest/venues/search?app_key=rPwttTPbhzGmX99K&keywords=Restaurant&location=San+Diego&within=20
        String apiCall = "http://api.eventful.com/rest/venues/search?app_key=" + key;
        string outputString = null;
        if (keywords != null)
        {
            apiCall = apiCall + "&keywords=" + keywords;
        }
        if (location != null)
        {
            apiCall = apiCall + "&location=" + location;
        }
        if (within != null)
        {
            apiCall = apiCall + "&within=" + within;
        }

        int count = 0;
        Venue venue = null;

        using (WebClient wc = new WebClient())
        {

            string xml = wc.DownloadString(apiCall);
            XmlDocument doc = new XmlDocument();
            doc.LoadXml(xml);
            XmlNodeList root = doc.GetElementsByTagName("venue");
            Venues VenuesAll = new Venues();
            count = root.Count;
            string json = JsonConvert.SerializeXmlNode(doc);
            JObject obj = JObject.Parse(json);
            int temp = 0;
            while (temp < count)
            {
                venue = new Venue();
                venue.venueUrl = (string)obj["search"]["venues"]["venue"][temp]["url"];
                venue.venueName = (string)obj["search"]["venues"]["venue"][temp]["name"];
                venue.venueAddress = (string)obj["search"]["venues"]["venue"][temp]["address"];
                venue.venueCity = (string)obj["search"]["venues"]["venue"][temp]["city_name"];
                venue.venueState = (string)obj["search"]["venues"]["venue"][temp]["region_name"];
                venue.venueStateAbbr = (string)obj["search"]["venues"]["venue"][temp]["region_abbr"];
                venue.venueZip = (string)obj["search"]["venues"]["venue"][temp]["postal_code"];
                venue.venueCountry = (string)obj["search"]["venues"]["venue"][temp]["country_name"];
                venue.venueLongitude = (string)obj["search"]["venues"]["venue"][temp]["longitude"];
                venue.venueLatitude = (string)obj["search"]["venues"]["venue"][temp]["latitude"];
                VenuesAll.venues.Add(venue);
                temp++;
            }
            outputString = JsonConvert.SerializeObject(VenuesAll);
        }
        return outputString;
    }
示例#37
0
    private void PopulateVenue(string venue_ID)
    {
        Guid newVenue_ID = new Guid(venue_ID);
        Venues venue = new Venues(newVenue_ID);

        txtVenueName.Text = venue.Venue_Name;
        divGetVenue.Visible = false;
        divVenueDetails.Visible = true;
    }
示例#38
0
        public ActionResult Frame()
        {
            CultureInfo usa = new CultureInfo("en-US");

            MembershipUser mu = Membership.GetUser();

                    SiteStructs.LatLong userLatLong = new SiteStructs.LatLong();
            userLatLong.latitude = 0;
            userLatLong.longitude = 0;
            UserAccountDetail uad = null;

            if (mu != null)
            {

                UserAccount ua = new UserAccount(mu.UserName);
                uad = new UserAccountDetail();
                uad.GetUserAccountDeailForUser(ua.UserAccountID);
                //if (!string.IsNullOrEmpty(uad.PostalCode))
                //{
                //    userLatLong = GeoData.GetLatLongForCountryPostal(uad.Country, uad.PostalCode);
                //}

                userLatLong.longitude = Convert.ToDouble(uad.Longitude);
                userLatLong.latitude = Convert.ToDouble(uad.Latitude);
            }

            Random rnd = new Random();

            // map

            MapModel mapPoints = new MapModel();

            mapPoints.MapPoints = new List<MapPoint>();
            MapPoint mPoint = null;

            // users
            UserAccounts uas = new UserAccounts();
            uas.GetMappableUsers();
            int offset = 0;

            // because of the foreign cultures, numbers need to stay in the English version unless a javascript encoding could be added
            string currentLang = Utilities.GetCurrentLanguageCode();

            Thread.CurrentThread.CurrentUICulture = CultureInfo.CreateSpecificCulture(SiteEnums.SiteLanguages.EN.ToString());
            Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(SiteEnums.SiteLanguages.EN.ToString());

            foreach (UserAccount u1 in uas)
            {
                uad = new UserAccountDetail();
                uad.GetUserAccountDeailForUser(u1.UserAccountID);

                if (uad.UserAccountDetailID == 0 || !uad.ShowOnMapLegal) continue;

                if (uad.Longitude == null || uad.Latitude == null || uad.Longitude == 0 || uad.Latitude == 0) continue;

                mPoint = new MapPoint();
                offset = rnd.Next(10, 100);

                // BUG: language adding incorrect
                mPoint.Latitude = Convert.ToDouble(Convert.ToDecimal(uad.Latitude) + Convert.ToDecimal("0.00" + offset));
                mPoint.Longitude = Convert.ToDouble(Convert.ToDecimal(uad.Longitude) + Convert.ToDecimal("0.00" + offset));

                u1.IsProfileLinkNewWindow = true;
                mPoint.Message = string.Format(@"<ul class=""user_list"">{0}</ul>",
               u1.ToUnorderdListItem);// in javascript, escape
                mPoint.Icon = uad.GenderIconLinkDark;
                mapPoints.MapPoints.Add(mPoint);
            }

            // venues

            Venues vnus = new Venues();
            vnus.GetAll();

            foreach (Venue v1 in vnus)
            {
                if (v1.Latitude == 0 || v1.Longitude == 0) continue;

                mPoint = new MapPoint();
                mPoint.Icon = v1.VenueTypeIcon;
                mPoint.Latitude = Convert.ToDouble(v1.Latitude);
                mPoint.Longitude = Convert.ToDouble(v1.Longitude);
                mPoint.Message = v1.MapText ;
                mapPoints.MapPoints.Add(mPoint);
            }

            string longI = userLatLong.longitude.ToString(usa);

            string latI = userLatLong.latitude.ToString(usa);

            StringBuilder sb = new StringBuilder();

            sb.Append(@"
            var map;
            var infowindow;
            function InitializeMap() { ");

            sb.AppendFormat(@"
            var latlng = new google.maps.LatLng({0}, {1});",
            latI, longI);

            if (mu != null && userLatLong.longitude != 0 && userLatLong.latitude != 0)
            {
                // zoom in on user
                sb.Append(@"
            var myOptions =
            {
            zoom: 8,
            center: latlng,
            mapTypeId: google.maps.MapTypeId.ROADMAP
            };");
            }
            else
            {
                // zoom out
                sb.Append(@"
            var myOptions =
            {
            zoom: 2,
            center: latlng,
            mapTypeId: google.maps.MapTypeId.ROADMAP
            };");
            }

            sb.Append(@"
            map = new google.maps.Map(document.getElementById(""map""), myOptions);
            }
             function markicons() {

            InitializeMap();

            var ltlng = [];
            var details = [];
            var iconType = [];");

            byte[] myarray2 = Encoding.Unicode.GetBytes(string.Empty);

            Encoding iso = Encoding.GetEncoding("ISO-8859-1");
            Encoding utf8 = Encoding.UTF8;

            foreach (DasKlub.Models.MapPoint mp1 in mapPoints.MapPoints)
            {

                if (mp1.Latitude == 0 || mp1.Longitude == 0) continue;

                byte[] utfBytes = utf8.GetBytes(mp1.Message.Replace(@"'", @"\'"));
                byte[] isoBytes = Encoding.Convert(utf8, iso, utfBytes);
                string msg = iso.GetString(isoBytes);

                  longI = mp1.Latitude.ToString(usa);

                  latI = mp1.Longitude.ToString(usa);

            //                sb.AppendFormat(@"
                    //ltlng.push(new google.maps.LatLng({0}, {1}));
                sb.Append(@" ltlng.push(new google.maps.LatLng(");
                sb.Append(longI);
                sb.Append(" , ");
                sb.Append(latI);
                sb.Append(@" )); ");

              //  {0}, {1}));

            sb.AppendFormat(@" details.push('{0}');
                    iconType.push('{1}');
                    " ,
                    msg, mp1.Icon);
            }

            sb.Append(@"
            for (var i = 0; i <= ltlng.length; i++) {

            marker = new google.maps.Marker({
                map: map,
                position: ltlng[i],
                icon: iconType[i]
            });

            (function (i, marker) {

                google.maps.event.addListener(marker, 'click', function () {

                    if (!infowindow) {
                        infowindow = new google.maps.InfoWindow();
                    }

                infowindow.setContent(details[i]);
                    infowindow.open(map, marker);

                });

            })(i, marker);
            }

            }

            window.onload = markicons; ");

            ViewBag.MapScript = sb.ToString( );

            Thread.CurrentThread.CurrentUICulture = CultureInfo.CreateSpecificCulture(currentLang);
            Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(currentLang);

            return View();
        }
示例#39
0
 private void PopulateVenueGridView()
 {
     Venues venue = new Venues();
     List<Venues> tblVenues = venue.GetVenues();
     VenueGridView.DataSource = tblVenues;
     VenueGridView.DataBind();
 }
示例#40
0
    protected void VenueGridView_SelectedIndexChanged(object sender, EventArgs e)
    {
        DivAddVenue.Visible = false;

        GridViewRow row = VenueGridView.SelectedRow;
        string v_id = VenueGridView.DataKeys[row.RowIndex]["Venue_ID"].ToString();
        string p_id = VenueGridView.DataKeys[row.RowIndex]["Venue_Contact"].ToString();
        string a_id = VenueGridView.DataKeys[row.RowIndex]["Address_ID"].ToString();
        Venue_ID = v_id;
        Common.Venue_ID = Venue_ID;
        Venue_Contact_ID = p_id;
        Common.Venue_Contact_ID = Venue_Contact_ID;
        Venue_Address_ID = a_id;
        Common.Venue_Address_ID = Venue_Address_ID;

        MembershipUser userInfo = Membership.GetUser();
        Guid user_ID = (Guid)userInfo.ProviderUserKey;

        Guid venue_ID = new Guid(Venue_ID);
        Venues venue = new Venues(venue_ID);
        Guid person_ID = new Guid(Venue_Contact_ID);
        People person = new People(person_ID);
        Guid address_ID = new Guid(Venue_Address_ID);
        Addresses address = new Addresses(address_ID);
        txtVenueName.Text = venue.Venue_Name;
        txtTitle.Text = person.Person_Title;
        txtForename.Text = person.Person_Forename;
        txtSurname.Text = person.Person_Surname;
        txtMobile.Text = person.Person_Mobile;
        txtLandline.Text = person.Person_Landline;
        txtEmail.Text = person.Person_Email;
        txtAddress1.Text = address.Address_1;
        txtAddress2.Text = address.Address_2;
        txtTown.Text = address.Address_Town;
        txtCity.Text = address.Address_City;
        txtCounty.Text = address.Address_County;
        txtPostcode.Text = address.Address_Postcode;

        DivReturn.Visible = true;
        divGetAddress.Visible = false;
        divAddressDetails.Visible = true;
        divGetPerson.Visible = false;
        divPersonDetails.Visible = true;
    }
示例#41
0
    protected void btnVenueSearch_Click(object sender, EventArgs e)
    {
        string searchValue = txtVenueFilter.Text;
        Venues venue = new Venues();
        List<Venues> tblVenues = null;

        if (VenueSearchType.SelectedValue == "c")
            searchValue = string.Format("%{0}", searchValue);

        tblVenues = venue.GetVenuesLikeVenue_Name(searchValue);

        VenueGridView.DataSource = tblVenues;
        VenueGridView.DataBind();
        txtVenueFilter.Text = string.Empty;
        VenueSearchType.SelectedIndex = -1;
    }