public ClubManagement()
        {
            WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
            InitializeComponent();

            clubConnection = new ClubConnection();

            countryConnection = new CountryConnection();
            this.countries    = countryConnection.GetCountries();

            foreach (DataRow dr in countries.Tables[0].Rows)
            {
                cmbCCountryChooses.Items.Add(dr[1].ToString());
            }
            cmbCCountryChooses.SelectedIndex = 0;

            this.clubUpdateCities("CY");
        }
        public ClubManagement()
        {
            WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
            InitializeComponent();

            clubConnection = new ClubConnection();

            countryConnection = new CountryConnection();
            this.countries = countryConnection.GetCountries();

            foreach (DataRow dr in countries.Tables[0].Rows)
            {
                cmbCCountryChooses.Items.Add(dr[1].ToString());

            }
            cmbCCountryChooses.SelectedIndex = 0;

            this.clubUpdateCities("CY");
        }
        //
        //mixali min frikaris afto einai gia na grouparis kodika
        //arxizi me #region <name>
        //lai telion me #endregion
        //


        public PersonManagement()
        {
            //auto anoigei to parathiro sto kentro tis othonis
            WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
            //here should be the loading of the locations and clubs and countries
            InitializeComponent();

            athleteConnection = new AthleteConnection();
            judgeConnection   = new JudgeConnection();
            //
            //NOTE
            //
            //mixali listeners vaze katefthian apo to xaml oxi karfota mesa ston kodika
            //
            //athleteFirstName.TextChanged += new TextChangedEventHandler(athleteFirstName_TextChanged);
            //prostetoume cities oses theloume



            countryConnection = new CountryConnection();
            this.countries    = countryConnection.GetCountries();

            foreach (DataRow dr in countries.Tables[0].Rows)
            {
                cmbACountryChooses.Items.Add(dr[1].ToString());
                cmbJCountryChooses.Items.Add(dr[1].ToString());
            }
            cmbACountryChooses.SelectedIndex = 0;
            cmbJCountryChooses.SelectedIndex = 0;

            this.athleteUpdateCities("CY");

            //9th dan - 10th dan- Wide Red optional as Sensei Ilija Yorga himself wore a Black Belt, Master's title
            //6th dan - 8th dan - White and Red, Master's title
            //1st dan - 5th dan - Black
            //1st kyu - Brown (at least 25 Month of traning or more)
            //2nd kyu - Blue (at least 18 Month of traning or more)
            //3rd kyu - Green (at least 15 Month of traning or more)
            //4th kyu - Orange (at least 9 Month of traning or more)
            //5th kyu - Yellow (at least 7 Month of traning or more)
            //6th kyu - White (at least 5 Month of traning or more)

            //prosthetoume athlete_rank
            cmbAthleteRankChooses.Items.Add("White        - 6th kyu");
            cmbAthleteRankChooses.Items.Add("Yellow       - 5th kyu");
            cmbAthleteRankChooses.Items.Add("Orange       - 4th kyu");
            cmbAthleteRankChooses.Items.Add("Green        - 3th kyu");
            cmbAthleteRankChooses.Items.Add("Blue         - 2nd kyu");
            cmbAthleteRankChooses.Items.Add("Brown        - 1st kyu");
            cmbAthleteRankChooses.Items.Add("Black        - 1st dan");
            cmbAthleteRankChooses.Items.Add("Black        - 2nd dan");
            cmbAthleteRankChooses.Items.Add("Black        - 3th dan");
            cmbAthleteRankChooses.Items.Add("Black        - 4th dan");
            cmbAthleteRankChooses.Items.Add("Black        - 5th dan");
            cmbAthleteRankChooses.Items.Add("White/Red    - 6th dan");
            cmbAthleteRankChooses.Items.Add("White/Red    - 7th dan");
            cmbAthleteRankChooses.Items.Add("White/Red    - 8th dan");
            cmbAthleteRankChooses.Items.Add("Red          - 9th dan");
            cmbAthleteRankChooses.Items.Add("Red          - 10th dan");
            cmbAthleteRankChooses.SelectedIndex = 0;

            //prosthetoume judge class
            cmbJudgeRankChooses.Items.Add("White        - 6th kyu");
            cmbJudgeRankChooses.Items.Add("Yellow       - 5th kyu");
            cmbJudgeRankChooses.Items.Add("Orange       - 4th kyu");
            cmbJudgeRankChooses.Items.Add("Green        - 3th kyu");
            cmbJudgeRankChooses.Items.Add("Blue         - 2nd kyu");
            cmbJudgeRankChooses.Items.Add("Brown        - 1st kyu");
            cmbJudgeRankChooses.Items.Add("Black        - 1st dan");
            cmbJudgeRankChooses.Items.Add("Black        - 2nd dan");
            cmbJudgeRankChooses.Items.Add("Black        - 3th dan");
            cmbJudgeRankChooses.Items.Add("Black        - 4th dan");
            cmbJudgeRankChooses.Items.Add("Black        - 5th dan");
            cmbJudgeRankChooses.Items.Add("White/Red    - 6th dan");
            cmbJudgeRankChooses.Items.Add("White/Red    - 7th dan");
            cmbJudgeRankChooses.Items.Add("White/Red    - 8th dan");
            cmbJudgeRankChooses.Items.Add("Red          - 9th dan");
            cmbJudgeRankChooses.Items.Add("Red          - 10th dan");
            cmbJudgeRankChooses.SelectedIndex = 0;

            //prosthetoume clubs
            this.clubs = clubConnection.GetClubs();

            foreach (DataRow dr in clubs.Tables[0].Rows)
            {
                cmbAClubChooses.Items.Add(dr[1]);
            }
            cmbAClubChooses.SelectedIndex = 0;
            //cmbAClubChooses.Items.Add("Pro Kata Club (P.K.C.)");

            //cmbAClubChooses.Items.Add("Allo Club");

            //prosthetoume judge classes
            cmbJClassChooses.Items.Add("A");
            cmbJClassChooses.Items.Add("B");
            cmbJClassChooses.SelectedIndex = 0;
        }
        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;
        }
Exemplo n.º 5
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);
            }
        }
Exemplo n.º 6
0
        private void initialize()
        {
            addressConnection  = new AddressConnection();
            locationConnection = new LocationConnection();
            //cities kai countries
            cityConnection    = new CityConnection();
            countryConnection = new CountryConnection();
            this.countries    = countryConnection.GetCountries();

            foreach (DataRow dr in countries.Tables[0].Rows)
            {
                cmbECountryChooses.Items.Add(dr[1].ToString());
            }
            cmbECountryChooses.SelectedIndex = 0;

            this.eventUpdateCities("CY");


            //events
            eventConnection = new EventConnection();
            this.events     = eventConnection.getEvents();
            cmbTEventChooser.Items.Add("Select Event");

            foreach (DataRow dr in events.Tables[0].Rows)
            {
                cmbTEventChooser.Items.Add(dr[1].ToString());
            }
            cmbTEventChooser.SelectedIndex = 0;

            //ages
            cmbTAgeFrom.Items.Add("From");
            cmbTAgeTo.Items.Add("To");
            for (int i = 5; i <= 60; i++)
            {
                cmbTAgeFrom.Items.Add(i.ToString());
                cmbTAgeTo.Items.Add(i.ToString());
            }
            cmbTAgeFrom.SelectedIndex = 0;
            cmbTAgeTo.SelectedIndex   = 0;

            //levels
            cmbTLevelFrom.Items.Add("From");
            cmbTLevelFrom.Items.Add("A");
            cmbTLevelFrom.Items.Add("B");
            cmbTLevelFrom.Items.Add("C");
            cmbTLevelFrom.Items.Add("D");

            cmbTLevelTo.Items.Add("To");
            cmbTLevelTo.Items.Add("A");
            cmbTLevelTo.Items.Add("B");
            cmbTLevelTo.Items.Add("C");
            cmbTLevelTo.Items.Add("D");

            cmbTLevelFrom.SelectedIndex = 0;
            cmbTLevelTo.SelectedIndex   = 0;


            //games
            cmbTGame.Items.Add("Select game type");
            cmbTGame.Items.Add("Game A");
            cmbTGame.Items.Add("Game B");
            cmbTGame.Items.Add("Game C");
            cmbTGame.Items.Add("Game D");
            cmbTGame.Items.Add("Game E");

            cmbTGame.SelectedIndex = 0;
        }
        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;
        }
        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;
        }