public MobilePhone(int id) { mySQL = MySQL.getInstance(); mySQL.TableName = tableName; this.id = id; string[] result = mySQL.select("id = " + id)[0]; _producer = new Producer(int.Parse(result[1])); _phoneType = new PhoneType(int.Parse(result[2])); _os = new OS(int.Parse(result[3])); _modelPhone = new ModelPhone(int.Parse(result[4])); _photoUrl = result[5]; _price = double.Parse(result[6]); }
public static void Add( Producer producer, PhoneType phoneType, OS os, ModelPhone modelPhone, string photoUrl, double price) { MySQL mySQL = MySQL.getInstance(); mySQL.TableName = tableName; mySQL.insert("`id_producer`, `id_phone_type`, `id_os`, `id_model_phone`, `photo_url`, `price`", string.Format("'{0}', '{1}', '{2}', '{3}', '{4}', '{5}'", producer.id, phoneType.id, os.id, modelPhone.Id, photoUrl, price)); }