Exemple #1
0
        public static Stylist Find(int id)
        {
            int    stylistId = -1;
            string name      = "";

            DB.OpenConnection();
            DB.SetCommand(@"SELECT * FROM stylists WHERE id=@thisId;");
            DB.AddParameter("@thisId", id);
            MySqlDataReader rdr = DB.ReadSqlCommand();

            while (rdr.Read())
            {
                stylistId = rdr.GetInt32(0);
                name      = rdr.GetString(1);
            }
            DB.CloseConnection();
            return(new Stylist(name, stylistId));
        }
Exemple #2
0
        public static Specialty Find(int id)
        {
            int    sid       = -1;
            string specialty = "";

            DB.OpenConnection();
            DB.SetCommand(@"SELECT * FROM " + _tableName + " WHERE id=@thisId;");
            DB.AddParameter("@thisId", id);
            MySqlDataReader rdr = DB.ReadSqlCommand();

            while (rdr.Read())
            {
                sid       = rdr.GetInt32(0);
                specialty = rdr.GetString(1);
            }
            DB.CloseConnection();
            return(new Specialty(specialty, sid));
        }
Exemple #3
0
        public List <Specialty> GetSpecialties(string orderBy = "id", string order = "ASC")
        {
            List <Specialty> specialties = new List <Specialty>()
            {
            };

            DB.OpenConnection();
            DB.SetCommand(@"SELECT * FROM " + _tableRelational + " WHERE stylistId=@thisId ORDER BY " + orderBy + " " + order + ";");
            DB.AddParameter("@thisId", _id);
            MySqlDataReader rdr = DB.ReadSqlCommand();

            while (rdr.Read())
            {
                Specialty newSpeciality = Specialty.Find(rdr.GetInt32(1));
                specialties.Add(newSpeciality);
            }
            DB.CloseConnection();
            return(specialties);
        }
Exemple #4
0
        public static List <Stylist> GetStylists(int id, string orderBy = "id", string order = "ASC")
        {
            List <Stylist> stylists = new List <Stylist>()
            {
            };

            DB.OpenConnection();
            DB.SetCommand(@"SELECT * FROM " + _tableRelational + " WHERE specialtyId=@thisId ORDER BY " + orderBy + " " + order + ";");
            DB.AddParameter("@thisId", id);
            MySqlDataReader rdr = DB.ReadSqlCommand();

            while (rdr.Read())
            {
                Stylist newStylist = Stylist.Find(rdr.GetInt32(2));
                stylists.Add(newStylist);
            }
            DB.CloseConnection();
            return(stylists);
        }
Exemple #5
0
        public static List <Specialty> GetAll(string orderBy = "id", string order = "ASC")
        {
            List <Specialty> specialties = new List <Specialty>()
            {
            };

            DB.OpenConnection();
            DB.SetCommand(@"SELECT * FROM " + _tableName + " ORDER BY " + orderBy + " " + order + ";");
            MySqlDataReader rdr = DB.ReadSqlCommand();

            while (rdr.Read())
            {
                int       id            = rdr.GetInt32(0);
                string    specialty     = rdr.GetString(1);
                Specialty newSpeciality = new Specialty(specialty, id);
                specialties.Add(newSpeciality);
            }
            DB.CloseConnection();
            return(specialties);
        }
Exemple #6
0
        public List <Client> GetClients(string orderBy = "id", string order = "ASC")
        {
            List <Client> clients = new List <Client>()
            {
            };

            DB.OpenConnection();
            DB.SetCommand(@"SELECT * FROM clients WHERE stylistId=@Id  ORDER BY " + orderBy + " " + order + ";");
            DB.AddParameter("@Id", _id);
            MySqlDataReader rdr = DB.ReadSqlCommand();

            while (rdr.Read())
            {
                int    id        = rdr.GetInt32(0);
                string name      = rdr.GetString(2);
                Client newClient = new Client(name, _id, id);
                clients.Add(newClient);
            }
            DB.CloseConnection();
            return(clients);
        }