Exemple #1
0
        private void autocomplete(string eventName)
        {
            DataSet dsE = null;
            DataSet dsL = null;
            DataSet dsA = null;
            DataSet dsC = null;
            int     locationId;
            int     addressId;
            int     cityId;

            dsE = eventConnection.getEventsByName(eventName);
            _tournamentEventId = int.Parse(dsE.Tables[0].Rows[0][0].ToString());
            locationId         = int.Parse(dsE.Tables[0].Rows[0][4].ToString());
            dsL       = locationConnection.getLocation(locationId);
            addressId = int.Parse(dsL.Tables[0].Rows[0][4].ToString());
            dsA       = addressConnection.getAddress(addressId);
            cityId    = int.Parse(dsA.Tables[0].Rows[0][3].ToString());
            dsC       = cityConnection.GetCityNameByCityId(cityId);

            _eventInfo  = "Name: " + dsE.Tables[0].Rows[0][1].ToString() + "\n";
            _eventInfo += "Date: " + dsE.Tables[0].Rows[0][2].ToString() + "\n";
            _eventInfo += "City: " + dsC.Tables[0].Rows[0][0].ToString() + "\n";
            _eventInfo += "Address: " + dsA.Tables[0].Rows[0][1].ToString() + "\n";
            _eventInfo += "Num: " + dsA.Tables[0].Rows[0][2].ToString() + "    Postal Code:" + dsA.Tables[0].Rows[0][4].ToString() + "\n";
            _eventInfo += "Location: " + dsL.Tables[0].Rows[0][1].ToString() + "\n";
            _eventInfo += "Phone: " + dsL.Tables[0].Rows[0][2].ToString() + "\n";
            _eventInfo += "Email: " + dsL.Tables[0].Rows[0][3].ToString();

            eventInfo.Text = _eventInfo;
        }
Exemple #2
0
        private void eSuggestionList_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            int country_position = 0;
            int city_position    = 0;
            int index;
            int location_id;
            int address_id;

            addressConnection  = new AddressConnection();
            locationConnection = new LocationConnection();
            DataSet dsA;
            DataSet dsL;

            if (eSuggestionList.ItemsSource != null)
            {
                eSuggestionList.Visibility = System.Windows.Visibility.Collapsed;
                eventName.TextChanged     -= new TextChangedEventHandler(eventName_TextChanged);

                index = eSuggestionList.SelectedIndex;

                if (eSuggestionList.SelectedIndex != -1)
                {
                    ListData item = (ListData)eSuggestionList.SelectedItem;
                    _eventId    = item.id;
                    location_id = int.Parse(filteredEvents.Tables[0].Rows[index][4].ToString());

                    this.eventName.Text          = filteredEvents.Tables[0].Rows[index][1].ToString();
                    this.eventDate.SelectedDate  = (DateTime)filteredEvents.Tables[0].Rows[index][2];
                    this.eventOfficial.IsChecked = (Boolean)filteredEvents.Tables[0].Rows[index][3];

                    dsL = locationConnection.getLocation(location_id);

                    this.eventLocation.Text = dsL.Tables[0].Rows[0][1].ToString();
                    this.eventPhone.Text    = dsL.Tables[0].Rows[0][2].ToString();
                    this.eventEmail.Text    = dsL.Tables[0].Rows[0][3].ToString();
                    address_id = int.Parse(dsL.Tables[0].Rows[0][4].ToString());

                    dsA = addressConnection.getAddress(address_id);

                    this.eventAddress.Text    = dsA.Tables[0].Rows[0][1].ToString();
                    this.eventAddressNum.Text = dsA.Tables[0].Rows[0][2].ToString();
                    this.eventTK.Text         = dsA.Tables[0].Rows[0][4].ToString();

                    string eventCity    = dsA.Tables[0].Rows[0][3].ToString();
                    int    ix           = dsA.Tables[0].Columns.Count;
                    string eventCountry = dsA.Tables[0].Rows[0][5].ToString();


                    //
                    //the fix for the country selection error
                    //
                    CountryConnection countryconn = new CountryConnection();
                    DataSet           countriname = countryconn.getCountryNameByCode(eventCountry);
                    eventCountry = countriname.Tables[0].Rows[0][0].ToString();



                    for (int i = 0; i < this.cmbECountryChooses.Items.Count; i++)
                    {
                        if (eventCountry.Equals(cmbECountryChooses.Items[i].ToString()))
                        {
                            country_position = i;
                            break;
                        }
                    }


                    this.cmbECountryChooses.SelectedIndex = country_position;


                    CityConnection cityConnection = new CityConnection();
                    DataSet        cityNa         = cityConnection.GetCityNameByCityId(int.Parse(eventCity));
                    eventCity = cityNa.Tables[0].Rows[0][0].ToString();

                    for (int i = 0; i < this.cmbECityChooses.Items.Count; i++)
                    {
                        if (eventCity.Equals(cmbECityChooses.Items[i].ToString()))
                        {
                            city_position = i;
                            break;
                        }
                    }
                    this.cmbECityChooses.SelectedIndex = city_position;
                }
                eventName.TextChanged += new TextChangedEventHandler(eventName_TextChanged);
            }
        }