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("");
        }
Exemplo n.º 2
0
        //public string InserrtNewAthleteFromOther(string id, string firstName, string middleName, string lastName,
        //  DateTime dateOfBirth,
        //  string primaryPhoneNo, string secondaryPhoneNo, string email,
        //  string countryCode, string City, string addressStreetName, string addressStreetNumber, string addressPostalCode,
        //  string rank, string localClubId)
        //{
        //    string sql = "";
        //    DataSet dr = null;

        //    //this.updatePerson(id, firstName, middleName, lastName,
        //    //dateOfBirth,
        //    //primaryPhoneNo, secondaryPhoneNo, email);

        //    this._InsertAthlete(id, rank, localClubId);

        //    // 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());

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

        //    return "";
        //}



        public string UpdateAthlete(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 localClubId)
        {
            string  sql = "";
            DataSet dr  = null;

            this._UpdatetAthlete(id, rank, localClubId);

            // 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);
        }
Exemplo n.º 4
0
        public string InsertNewAthlete(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 localClubId)
        {
            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);

            this._InsertAthlete(personId, rank, localClubId);

            return(personId);
        }
        public string InsertNewCLub(string name, string phone, string email, string logosource, string addressStreetName, string addressStreetNumber, string addressPostalCode, string countryCode, string City)
        {
            //FileStream fs = new FileStream(logosource, FileMode.Open, FileAccess.Read);
            //BinaryReader binr = new BinaryReader(new BufferedStream(fs));
            //byte[] logoinbites = binr.ReadBytes(Convert.ToInt32(fs.Length));

            ImageConverter    ic        = new ImageConverter();
            AddressConnection addConn   = new AddressConnection();
            string            addressId = addConn.InsertNewAddress(addressStreetName, addressStreetNumber, City, addressPostalCode, countryCode);

            sql = "insert into Clubs (name, phone, email, logo, address_id, country_code) values (" +
                  "'" + name + "', " +
                  "'" + phone + "', " +
                  "'" + email + "', " +
                  "'" + ic.ToByteTable(logosource) + "' , " +
                  "'" + addressId + "', " +
                  "'" + countryCode + "' " +
                  ")";
            this.NonQuery(sql);

            return("");
        }