Ejemplo n.º 1
0
        public void AddStylist(Stylist newStylist)
        {
            MySqlConnection conn = DB.Connection();

            conn.Open();
            var cmd = conn.CreateCommand() as MySqlCommand;

            cmd.CommandText = @"INSERT INTO stylist_specialty (stylists_id, specialties_id) VALUES (@StylistId, @SpecialtyId);";
            MySqlParameter category_id = new MySqlParameter();

            cmd.Parameters.AddWithValue("@SpecialtyId", this._id);
            cmd.Parameters.AddWithValue("@StylistId", newStylist.GetId());
            cmd.ExecuteNonQuery();
            conn.Close();
            if (conn != null)
            {
                conn.Dispose();
            }
        }
Ejemplo n.º 2
0
        public void RemoveStylist(Stylist stylist)
        {
            int             stylistId = stylist.GetId();
            MySqlConnection conn      = DB.Connection();

            conn.Open();
            var cmd = conn.CreateCommand() as MySqlCommand;

            cmd.CommandText = @"DELETE FROM specialties_stylists WHERE stylist_id = @stylistId;";
            MySqlParameter stylistIdParameter = new MySqlParameter("@stylistId", stylistId);

            cmd.Parameters.Add(stylistIdParameter);
            cmd.ExecuteNonQuery();
            conn.Close();
            if (conn != null)
            {
                conn.Dispose();
            }
        }
Ejemplo n.º 3
0
        public void AddStylist(Stylist stylist)
        {
            MySqlConnection conn = DB.Connection();

            conn.Open();

            MySqlCommand cmd = conn.CreateCommand();

            cmd.CommandText = @"INSERT INTO stylists_specialties (stylist_id, specialty_id) VALUES (@StylistId, @SpecialtyId)";
            cmd.Parameters.AddWithValue("@StylistId", stylist.GetId());
            cmd.Parameters.AddWithValue("@SpecialtyId", _id);
            cmd.ExecuteNonQuery();

            conn.Close();
            if (conn != null)
            {
                conn.Dispose();
            }
        }
Ejemplo n.º 4
0
 public override bool Equals(System.Object otherStylist)
 {
     if (!(otherStylist is Stylist))
     {
         return(false);
     }
     else
     {
         Stylist newStylist          = (Stylist)otherStylist;
         bool    nameEquality        = this.GetName().Equals(newStylist.GetName());
         bool    idEquality          = this.GetId().Equals(newStylist.GetId());
         bool    descriptionEquality = this.GetDescription().Equals(newStylist.GetDescription());
         bool    timestampEquality   = this.GetTimestamp().Equals(newStylist.GetTimestamp());
         if (nameEquality == true && idEquality == true && descriptionEquality == true)
         {
             return(true);
         }
         return(false);
     }
 }
Ejemplo n.º 5
0
        public void AddStylist(Stylist newStylist)
        {
            MySqlConnection conn = DB.Connection();

            conn.Open();

            var cmd = conn.CreateCommand() as MySqlCommand;

            cmd.CommandText = @"INSERT INTO specialties_stylists (specialty_id, stylist_id) VALUES (@SpecialtyId, @StylistId);";

            cmd.Parameters.Add(new MySqlParameter("@SpecialtyId", _id));
            cmd.Parameters.Add(new MySqlParameter("@StylistId", newStylist.GetId()));

            cmd.ExecuteNonQuery();

            conn.Close();
            if (conn != null)
            {
                conn.Dispose();
            }
        }
Ejemplo n.º 6
0
        public void AddStylist(Stylist newStylist)
        {
            MySqlConnection conn = DB.Connection();

            conn.Open();

            var cmd = conn.CreateCommand() as MySqlCommand;

            cmd.CommandText = @"INSERT INTO stylists_specialties(stylist_id, specialty_id) VALUES (@stylistId, @Id);";

            cmd.Parameters.AddWithValue("@Id", this.Id);
            cmd.Parameters.AddWithValue("@stylistId", newStylist.GetId());

            cmd.ExecuteNonQuery();
            Id = (int)cmd.LastInsertedId;
            conn.Close();
            if (conn != null)
            {
                conn.Dispose();
            }
        }
Ejemplo n.º 7
0
        public void AddStylist(Stylist stylist)
        {
            MySqlConnection conn = DB.Connection();

            conn.Open();
            MySqlCommand cmd = conn.CreateCommand();

            cmd.CommandText = @"INSERT INTO stylists_clients (client_id, stylist_id) VALUES (@ClientId, @StylistId);";
            MySqlParameter clientIdParameter  = new MySqlParameter("@ClientId", this._id);
            MySqlParameter stylistIdParameter = new MySqlParameter("@StylistId", stylist.GetId());

            cmd.Parameters.Add(clientIdParameter);
            cmd.Parameters.Add(stylistIdParameter);


            cmd.ExecuteNonQuery();
            conn.Close();
            if (conn != null)
            {
                conn.Dispose();
            }
        }
Ejemplo n.º 8
0
        public void AddStylist(Stylist newStylist)
        {
            MySqlConnection conn = DB.Connection();

            conn.Open();
            MySqlCommand cmd = new MySqlCommand(@"INSERT INTO specialties_stylists (specialty_id, stylist_id) VALUES (@SpecialtyId, @StylistId);", conn);

            cmd.Parameters.Add(new MySqlParameter("@SpecialtyId", _id));

            MySqlParameter stylist_id = new MySqlParameter();

            stylist_id.ParameterName = "@StylistId";
            stylist_id.Value         = newStylist.GetId();
            cmd.Parameters.Add(stylist_id);

            cmd.ExecuteNonQuery();
            conn.Close();
            if (conn != null)
            {
                conn.Dispose();
            }
        }
Ejemplo n.º 9
0
    public void AddStylist(Stylist newStylist)
    {
      MySqlConnection conn = DB.Connection();
      conn.Open();
      var cmd = conn.CreateCommand() as MySqlCommand;
      cmd.CommandText = @"INSERT INTO stylists_clients (stylist_id, client_id) VALUES (@StylistId, @ClientId);";

      MySqlParameter stylist_id = new MySqlParameter();
      stylist_id.ParameterName = "@StylistId";
      stylist_id.Value = newStylist.GetId();
      cmd.Parameters.Add(stylist_id);

      MySqlParameter client_id = new MySqlParameter();
      client_id.ParameterName = "@ClientId";
      client_id.Value = _id;
      cmd.Parameters.Add(client_id);

      cmd.ExecuteNonQuery();
      conn.Close();
      if(conn != null)
      {
        conn.Dispose();
      }
    }
Ejemplo n.º 10
0
 public void ToDictionary(Stylist stylist)
 {
     _Styler.Add(stylist.GetId(), stylist.GetStylistName());
 }
Ejemplo n.º 11
0
        public void AddStylist(Stylist stylist)
        {
            MySqlConnection conn = DB.Connection();

            conn.Open();
            var cmd = conn.CreateCommand() as MySqlCommand;

            cmd.CommandText = @"INSERT INTO stylists_specialties (specialty_id, stylist_id) VALUES ('" + _id + "', '" + stylist.GetId() + "');";
            cmd.ExecuteNonQuery();
            conn.Close();
            if (conn != null)
            {
                conn.Dispose();
            }
        }