private void jSuggestionList_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            string name             = null;
            string sex              = null;
            string rank             = null;
            int    country_position = 0;
            int    city_position    = 0;
            string judge_class      = null;
            int    rank_position    = 0;
            int    class_position   = 0;
            int    address_id;

            addressConnection = new AddressConnection();
            DataSet ds;

            if (jSuggestionList.ItemsSource != null)
            {
                jSuggestionList.Visibility  = System.Windows.Visibility.Collapsed;
                judgeFirstName.TextChanged -= new TextChangedEventHandler(judgeFirstName_TextChanged);

                int index = jSuggestionList.SelectedIndex;

                if (jSuggestionList.SelectedIndex != -1)
                {
                    name        = jSuggestionList.SelectedItem.ToString();
                    sex         = filteredJudges.Tables[0].Rows[index][4].ToString();
                    rank        = filteredJudges.Tables[0].Rows[index][11].ToString();
                    judge_class = filteredJudges.Tables[0].Rows[index][12].ToString();
                    address_id  = int.Parse(filteredJudges.Tables[0].Rows[index][9].ToString());

                    //
                    //giati mazoxizese re mike??
                    //
                    //this.athleteFirstName.Text = name.Substring(0, name.IndexOf(" "));
                    //

                    this.judgeFirstName.Text  = filteredJudges.Tables[0].Rows[index][1].ToString();
                    this._judgeFirstName      = this.judgeFirstName.Text;
                    this.judgeLastName.Text   = filteredJudges.Tables[0].Rows[index][2].ToString();
                    this.judgeFatherName.Text = filteredJudges.Tables[0].Rows[index][3].ToString();

                    if (sex.Equals("male"))
                    {
                        this.JrdButton1.IsChecked = true;
                    }
                    else
                    {
                        this.JrdButton2.IsChecked = true;
                    }

                    this.judgeDateOfBirth.SelectedDate = (DateTime)filteredJudges.Tables[0].Rows[index][5];
                    this.judgeFirstPhone.Text          = filteredJudges.Tables[0].Rows[index][6].ToString();
                    this.judgeSecondPhone.Text         = filteredJudges.Tables[0].Rows[index][7].ToString();
                    this.judgeEmail.Text = filteredJudges.Tables[0].Rows[index][8].ToString();

                    ds = addressConnection.getAddress(address_id);

                    this.judgeStreetName.Text = ds.Tables[0].Rows[0][1].ToString();
                    this.judgeAddressNum.Text = ds.Tables[0].Rows[0][2].ToString();
                    this.judgeTK.Text         = ds.Tables[0].Rows[0][4].ToString();

                    string athCity    = ds.Tables[0].Rows[0][3].ToString();
                    int    ix         = ds.Tables[0].Columns.Count;
                    string athCountry = ds.Tables[0].Rows[0][5].ToString();


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



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


                    this.cmbJCountryChooses.SelectedIndex = country_position;


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

                    for (int i = 0; i < this.cmbAthleteCityChooses.Items.Count; i++)
                    {
                        if (athCity.Equals(cmbAthleteCityChooses.Items[i].ToString()))
                        {
                            city_position = i;
                            break;
                        }
                    }
                    this.cmbJCityChooses.SelectedIndex = city_position;


                    //vriskei tin zwni pou exei o kathenas se poia thesi einai
                    for (int i = 0; i < cmbJudgeRankChooses.Items.Count; i++)
                    {
                        if (rank.Equals(cmbJudgeRankChooses.Items[i]))
                        {
                            rank_position = i;
                            break;
                        }
                    }
                    this.cmbJudgeRankChooses.SelectedIndex = rank_position;

                    for (int i = 0; i < cmbJClassChooses.Items.Count; i++)
                    {
                        if (judge_class.Equals(cmbJClassChooses.Items[i]))
                        {
                            class_position = i;
                            break;
                        }
                    }
                    this.cmbJClassChooses.SelectedIndex = class_position;
                }
                judgeFirstName.TextChanged += new TextChangedEventHandler(judgeFirstName_TextChanged);
            }
            //this.sugestioListScroler.Visibility = System.Windows.Visibility.Hidden;
        }
        private void cSuggestionList_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            string name = null;
            int country_position = 0;
            int city_position = 0;
            int index;
            int address_id;
            addressConnection = new AddressConnection();
            DataSet ds;

            if (cSuggestionList.ItemsSource != null)
            {
                cSuggestionList.Visibility = System.Windows.Visibility.Collapsed;
                clubName.TextChanged -= new TextChangedEventHandler(clubName_TextChanged);

                index = cSuggestionList.SelectedIndex;

                if (cSuggestionList.SelectedIndex != -1)
                {
                    name = cSuggestionList.SelectedItem.ToString();
                    address_id = int.Parse(filteredClubs.Tables[0].Rows[index][5].ToString());

                    this.clubName.Text = filteredClubs.Tables[0].Rows[index][1].ToString();
                    this.clubPhone.Text = filteredClubs.Tables[0].Rows[index][2].ToString();
                    this.clubEmail.Text = filteredClubs.Tables[0].Rows[index][3].ToString();

                    ds = addressConnection.getAddress(address_id);

                    this.clubAddress.Text = ds.Tables[0].Rows[0][1].ToString();
                    this.clubAddressNum.Text = ds.Tables[0].Rows[0][2].ToString();
                    this.clubTK.Text = ds.Tables[0].Rows[0][4].ToString();

                    string clubCity = ds.Tables[0].Rows[0][3].ToString();
                    int ix = ds.Tables[0].Columns.Count;
                    string clubCountry = ds.Tables[0].Rows[0][5].ToString();

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

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

                    this.cmbCCountryChooses.SelectedIndex = country_position;

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

                    for (int i = 0; i < this.cmbCCityChooses.Items.Count; i++)
                    {
                        if (clubCity.Equals(cmbCCityChooses.Items[i].ToString()))
                        {
                            city_position = i;
                            break;
                        }
                    }
                    this.cmbCCityChooses.SelectedIndex = city_position;
                }
                clubName.TextChanged += new TextChangedEventHandler(clubName_TextChanged);
            }
            //this.sugestioListScroler.Visibility = System.Windows.Visibility.Hidden;
        }
Exemplo n.º 3
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);
            }
        }
        private void cSuggestionList_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            string name             = null;
            int    country_position = 0;
            int    city_position    = 0;
            int    index;
            int    address_id;

            addressConnection = new AddressConnection();
            DataSet ds;

            if (cSuggestionList.ItemsSource != null)
            {
                cSuggestionList.Visibility = System.Windows.Visibility.Collapsed;
                clubName.TextChanged      -= new TextChangedEventHandler(clubName_TextChanged);

                index = cSuggestionList.SelectedIndex;

                if (cSuggestionList.SelectedIndex != -1)
                {
                    name       = cSuggestionList.SelectedItem.ToString();
                    address_id = int.Parse(filteredClubs.Tables[0].Rows[index][5].ToString());

                    this.clubName.Text  = filteredClubs.Tables[0].Rows[index][1].ToString();
                    this.clubPhone.Text = filteredClubs.Tables[0].Rows[index][2].ToString();
                    this.clubEmail.Text = filteredClubs.Tables[0].Rows[index][3].ToString();

                    ds = addressConnection.getAddress(address_id);

                    this.clubAddress.Text    = ds.Tables[0].Rows[0][1].ToString();
                    this.clubAddressNum.Text = ds.Tables[0].Rows[0][2].ToString();
                    this.clubTK.Text         = ds.Tables[0].Rows[0][4].ToString();

                    string clubCity    = ds.Tables[0].Rows[0][3].ToString();
                    int    ix          = ds.Tables[0].Columns.Count;
                    string clubCountry = ds.Tables[0].Rows[0][5].ToString();


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



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


                    this.cmbCCountryChooses.SelectedIndex = country_position;


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

                    for (int i = 0; i < this.cmbCCityChooses.Items.Count; i++)
                    {
                        if (clubCity.Equals(cmbCCityChooses.Items[i].ToString()))
                        {
                            city_position = i;
                            break;
                        }
                    }
                    this.cmbCCityChooses.SelectedIndex = city_position;
                }
                clubName.TextChanged += new TextChangedEventHandler(clubName_TextChanged);
            }
            //this.sugestioListScroler.Visibility = System.Windows.Visibility.Hidden;
        }