Beispiel #1
0
        public static void Delete(int id)
        {
            MySQL mySQL = MySQL.getInstance();

            mySQL.TableName = tableName;
            mySQL.delete("id = " + id);
        }
Beispiel #2
0
 public PhoneType(int id)
 {
     mySQL           = MySQL.getInstance();
     mySQL.TableName = tableName;
     this.id         = id;
     this.name       = mySQL.select("id = " + id)[0][1];
 }
Beispiel #3
0
        public static void Add(string name, Producer producer)
        {
            MySQL mySQL = MySQL.getInstance();

            mySQL.TableName = tableName;
            mySQL.insert("`name`, `id_producer`", string.Format("'{0}', '{1}'", name, producer.id));
        }
Beispiel #4
0
        public static void Add(string name)
        {
            MySQL mySQL = MySQL.getInstance();

            mySQL.TableName = tableName;
            mySQL.insert("name", "'" + name + "'");
        }
Beispiel #5
0
        public static void Add(string name, string description, double price)
        {
            MySQL mySQL = MySQL.getInstance();

            mySQL.TableName = tableName;
            mySQL.insert("name, description, price", string.Format("'{0}', '{1}', '{2}'", name, description, price));
        }
Beispiel #6
0
        public static void Add(string name)
        {
            MySQL mySQL = MySQL.getInstance();

            mySQL.TableName = tableName;
            mySQL.insert("`name`", string.Format("'{0}'", name));
        }
Beispiel #7
0
 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]));
 }
Beispiel #8
0
 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]);
 }
Beispiel #9
0
        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);
        }
Beispiel #10
0
        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 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));
        }
Beispiel #13
0
        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));
        }
Beispiel #14
0
 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])));
     }
 }