public PhoneType(int id) { mySQL = MySQL.getInstance(); mySQL.TableName = tableName; this.id = id; this.name = mySQL.select("id = " + id)[0][1]; }
public ModelPhone(int id) { mySQL = MySQL.getInstance(); mySQL.TableName = tableName; this.Id = id; string[][] result = mySQL.select("`id` = " + id); this.name = result[0][2]; this._producer = new Producer(int.Parse(result[0][1])); }
public Service(int id) { mySQL = MySQL.getInstance(); mySQL.TableName = tableName; string[][] result = mySQL.select("id = " + id); this.id = id; name = result[0][1]; description = result[0][2]; price = double.Parse(result[0][3]); }
public static List <PhoneType> getList() { List <PhoneType> list = new List <PhoneType>(); MySQL mySQL = MySQL.getInstance(); mySQL.TableName = tableName; string[][] result = mySQL.select(); foreach (string[] res in result) { list.Add(new PhoneType(int.Parse(res[0]))); } return(list); }
public static List <ModelPhone> GetListByProducerId(int id) { List <ModelPhone> list = new List <ModelPhone>(); MySQL mySQL = MySQL.getInstance(); mySQL.TableName = tableName; string[][] result = mySQL.select("id_producer = " + id); foreach (string[] res in result) { list.Add(new ModelPhone(int.Parse(res[0]))); } return(list); }
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 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]))); } }