public string UpdateJudge(int id, string firstName, string lastName, string fathersName, string sex,
           DateTime dateOfBirth,
           string primaryPhoneNo, string secondaryPhoneNo, string email,
           string addressStreetName, string addressStreetNumber, string addressPostalCode, string countryCode, string City,
           string rank, string judge_class)
        {
            string sql = "";
             DataSet dr = null;

             this._UpdateJudge(id, rank, judge_class);

             // getting the athlete_address id
             sql = "select address_id from persons where id = '" + id + "'; ";

             dr = this.Query(sql);
             int addressId = int.Parse(dr.Tables[0].Rows[0][0].ToString());

             this.updatePerson(id, firstName, lastName, fathersName, sex, dateOfBirth,
             primaryPhoneNo, secondaryPhoneNo, email, addressId);

             AddressConnection addConn = new AddressConnection();
             addConn.UpdateAddress(addressId, addressStreetName, addressStreetNumber, City, addressPostalCode, countryCode);

             return "";
        }
        public string InsertNewEvent(string name, DateTime eventdate, string addressStreetName,
           string addressStreetNumber, string addressPostalCode, string location, string phone,
           string email, string city , string countryCode, Boolean official)
        {
            AddressConnection addConn = new AddressConnection();
            string addressId = addConn.InsertNewAddress(addressStreetName, addressStreetNumber, city, addressPostalCode, countryCode);

            LocationConnection locationConnection = new LocationConnection();
            string locationId = locationConnection.InsertNewLocation(location, phone, email, "" + addressId);

            string eventId = this._InsertEvent(name, eventdate, official , locationId);

            return eventId;
        }
        public string InsertNewJudge(string firstName, string lastName, string fathersName, string sex,
           DateTime dateOfBirth,
           string primaryPhoneNo, string secondaryPhoneNo, string email,
           string addressStreetName, string addressStreetNumber, string addressPostalCode, string countryCode, string City, 
           string rank, string judge_class)
        {
            AddressConnection addConn = new AddressConnection();
            string addressId = addConn.InsertNewAddress(addressStreetName, addressStreetNumber, City,  addressPostalCode, countryCode);

            string personId = this.insertNewPerson(firstName, lastName, fathersName, sex, dateOfBirth,
            primaryPhoneNo, secondaryPhoneNo, email, "" + addressId);
            int id = int.Parse(personId);
            this._InsertJudge(id, rank , judge_class);

            return personId;
        }
        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;
        }
Beispiel #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);
            }
        }
Beispiel #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;
        }
        public string UpdateEvent(int eventId, string name, DateTime eventdate, string addressStreetName,
           string addressStreetNumber, string addressPostalCode, string location, string phone,
           string email, string city, string countryCode, Boolean official)
        {
            string sql = "";
            DataSet drA = null;
            DataSet drL = null;

            LocationConnection locationConnection = new LocationConnection();
            sql = "select location_id from events where id = '" + eventId + "'; ";

            drL = this.Query(sql);
            int locationId = int.Parse(drL.Tables[0].Rows[0][0].ToString());
            // getting the location_address id
            sql = "select address_id from locations where id = '" + locationId + "'; ";

            drA = this.Query(sql);
            int addressId = int.Parse(drA.Tables[0].Rows[0][0].ToString());

            this._UpdateEvent(eventId, name, eventdate, official, locationId);

            locationConnection.UpdateLocation(locationId, location, phone, email, addressId);
            AddressConnection addConn = new AddressConnection();
            addConn.UpdateAddress(addressId, addressStreetName, addressStreetNumber, city, addressPostalCode, countryCode);

            return "";
        }