public static void Add( MobilePhone mobilePhone, Tariff tariff, string surname, string middleName, string firstName, bool sex, string photoUrl, string passportNubmer, string mobileNumber ) { MySQL mySQL = MySQL.getInstance(); mySQL.TableName = tableName; mySQL.insert( "`id_mobile_phone`, `id_tariff`, `name`, `middle_name`, `surname`, `sex`, `photo_url`, `passport_number`, `number_phone`", string.Format("'{0}', '{1}', '{2}', '{3}', '{4}', '{5}', '{6}', '{7}', '{8}'", mobilePhone.id, tariff.id, firstName, middleName, surname, sex, photoUrl, passportNubmer, mobileNumber)); }
public Owner(int id) { _services = new List <Service>(); mySQL = MySQL.getInstance(); mySQL.TableName = tableName; string[] result = mySQL.select("id = " + id)[0]; this.id = id; _mobilePhone = new MobilePhone(int.Parse(result[1])); _tariff = new Tariff(int.Parse(result[2])); _firstName = result[3]; _middleName = result[4]; _surname = result[5]; _sex = bool.Parse(result[6]); _photoUrl = result[7]; _passportNumber = result[8]; _mobileNumber = result[9]; mySQL.TableName = "owner_include_service"; string[][] res = mySQL.select("id_owner = " + id); foreach (var r in res) { services.Add(new Service(int.Parse(r[1]))); } }