Exemplo n.º 1
0
        public void AddSpecialty(Specialty newSpecialty)
        {
            MySqlConnection conn = DB.Connection();

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

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

            MySqlParameter stylist_id = new MySqlParameter();

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

            MySqlParameter specialty_id = new MySqlParameter();

            specialty_id.ParameterName = "@SpecialtyId";
            specialty_id.Value         = _id;
            cmd.Parameters.Add(specialty_id);

            cmd.ExecuteNonQuery();
            conn.Close();
            if (conn != null)
            {
                conn.Dispose();
            }
        }
Exemplo n.º 2
0
        public override bool Equals(System.Object otherSpecialty)
        {
            if (!(otherSpecialty is Specialty))
            {
                return(false);
            }
            else
            {
                Specialty newSpecialty        = (Specialty)otherSpecialty;
                bool      idEquality          = this.GetId() == newSpecialty.GetId();
                bool      descriptionEquality = this.GetDescription() == newSpecialty.GetDescription();
                Console.WriteLine("newSpecialty" + newSpecialty.GetId());
                Console.WriteLine("this" + this.GetId());

                return(idEquality && descriptionEquality);
            }
        }
Exemplo n.º 3
0
 public override bool Equals(System.Object otherItem)
 {
     if (otherItem is Specialty)
     {
         Specialty newItem = (Specialty)otherItem;
         return(this.GetId().Equals(newItem.GetId()));
     }
     else
     {
         return(false);
     }
 }
Exemplo n.º 4
0
 public override bool Equals(System.Object otherSpecialty)
 {
     if (!(otherSpecialty is Specialty))
     {
         return(false);
     }
     else
     {
         Specialty newSpecialty = (Specialty)otherSpecialty;
         return(this.GetId().Equals(newSpecialty.GetId()));
     }
 }
        public override bool Equals(System.Object otherSpecialty)
        {
            if (!(otherSpecialty is Specialty))
            {
                return(false);
            }
            Specialty newSpecialty = (Specialty)otherSpecialty;
            bool      idEquality   = (this.GetId() == newSpecialty.GetId());
            bool      nameEquality = (this.GetName() == newSpecialty.GetName());

            return(idEquality && nameEquality);
        }
Exemplo n.º 6
0
 public override bool Equals(System.Object speciality2)
 {
     if (!(speciality2 is Specialty))
     {
         return(false);
     }
     else
     {
         Specialty speciality1  = (Specialty)speciality2;
         bool      idEquality   = (this.GetId() == speciality1.GetId());
         bool      specialityEq = (this.GetSpecialty() == speciality1.GetSpecialty());
         return(idEquality && specialityEq);
     }
 }
Exemplo n.º 7
0
 public override bool Equals(System.Object otherSpecialty)
 {
     if (!(otherSpecialty is Specialty))
     {
         return(false);
     }
     else
     {
         Specialty newSpecialty      = (Specialty)otherSpecialty;
         bool      idEquality        = (this.GetId() == newSpecialty.GetId());
         bool      specialtyEquality = (this.GetSpecialty() == newSpecialty.GetSpecialty());
         return(idEquality && specialtyEquality);
     }
 }
Exemplo n.º 8
0
 public override bool Equals(System.Object otherSpecialty)
 {
     if (!(otherSpecialty is Specialty))
     {
         return(false);
     }
     else
     {
         Specialty newSpecialty  = (Specialty)otherSpecialty;
         bool      areIdsEqual   = (this.GetId() == newSpecialty.GetId());
         bool      areNamesEqual = (this.GetName() == newSpecialty.GetName());
         return(areIdsEqual && areNamesEqual);
     }
 }
Exemplo n.º 9
0
 public override bool Equals(System.Object otherSpecialty)
 {
     if (!(otherSpecialty is Specialty))
     {
         return(false);
     }
     else
     {
         Specialty newSpecialty        = (Specialty)otherSpecialty;
         bool      idEquality          = (GetId() == newSpecialty.GetId());
         bool      descriptionEquality = (GetDescription() == newSpecialty.GetDescription());
         return(descriptionEquality && idEquality);
     }
 }
Exemplo n.º 10
0
 public override bool Equals(System.Object otherSpecialty)
 {
     if (!(otherSpecialty is Specialty))
     {
         return(false);
     }
     else
     {
         Specialty newSpecialty = (Specialty)otherSpecialty;
         bool      idEquality   = this.GetId().Equals(newSpecialty.GetId());
         bool      typeEquality = this.GetType().Equals(newSpecialty.GetType());
         return(idEquality && typeEquality);
     }
 }
Exemplo n.º 11
0
        public void AddSpecialty(Specialty newSpecialty)
        {
            MySqlConnection conn = DB.Connection();

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

            cmd.CommandText = @"INSERT INTO specialty_stylist (specialty_id, stylist_id) VALUES (@SpecialtyId, @StylistId);";
            MySqlParameter specialty_id = new MySqlParameter("@SpecialtyId", newSpecialty.GetId());
            MySqlParameter stylist_id   = new MySqlParameter("@StylistId", _id);

            cmd.Parameters.Add(specialty_id);
            cmd.Parameters.Add(stylist_id);
            cmd.ExecuteNonQuery();
            conn.Dispose();
        }
Exemplo n.º 12
0
        public void AddSpecialty(Specialty newSpecialty)
        {
            string        columns    = "speciltyId,stylistId";
            List <string> valueNames = new List <string>()
            {
                "@SpecialtyId,@StylistId"
            };
            List <Object> values = new List <Object>()
            {
                newSpecialty.GetId(), _id
            };

            DB.OpenConnection();
            DB.SaveToTable(_tableName, columns, valueNames, values);
            DB.CloseConnection();
        }
Exemplo n.º 13
0
        public void AddSpecialty(Specialty newSpecialty)
        {
            MySqlConnection conn = DB.Connection();

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

            cmd.Parameters.AddWithValue("@StylistId", _id);
            cmd.Parameters.AddWithValue("@SpecialtyId", newSpecialty.GetId());
            cmd.ExecuteNonQuery();
            conn.Close();
            if (conn != null)
            {
                conn.Dispose();
            }
        }
Exemplo n.º 14
0
        public void AddSpecialty(Specialty newSpecialty)
        {
            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);";
            cmd.Parameters.AddWithValue("@StylistId", this._id);
            cmd.Parameters.AddWithValue("@SpecialtyId", newSpecialty.GetId());
            cmd.ExecuteNonQuery();

            conn.Close();
            if (conn != null)
            {
                conn.Dispose();
            }
        }
Exemplo n.º 15
0
 public override bool Equals(System.Object otherSpecialty)
 {
     if (!(otherSpecialty is Specialty))
     {
         return(false);
     }
     else
     {
         Specialty newSpecialty          = (Specialty)otherSpecialty;
         bool      idEquality            = this.GetId().Equals(newSpecialty.GetId());
         bool      specialtyTypeEquality = this.GetSpecialtyType().Equals(newSpecialty.GetSpecialtyType());
         if (idEquality == true && specialtyTypeEquality == true)
         {
             return(true);
         }
         return(false);
     }
 }
Exemplo n.º 16
0
        public void AddSpecialty(Specialty specialty)
        {
            MySqlConnection conn = DB.Connection();

            conn.Open();

            MySqlCommand cmd = conn.CreateCommand();

            cmd.CommandText = @"INSERT INTO stylists_specialties (specialty_id, stylist_id) VALUES (@SpecialtyId, @StylistId)";
            cmd.Parameters.Add(new MySqlParameter("@SpecialtyId", specialty.GetId()));
            cmd.Parameters.Add(new MySqlParameter("@StylistId", _id));
            cmd.ExecuteNonQuery();

            conn.Close();
            if (conn != null)
            {
                conn.Dispose();
            }
        }
Exemplo n.º 17
0
        public void RemoveSpecialty(Specialty specialty)
        {
            MySqlConnection conn = DB.Connection();

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

            cmd.CommandText = @"DELETE FROM specialties_stylists WHERE specialty_id = @specialtyId;";
            int            specialtyId          = specialty.GetId();
            MySqlParameter specialtyIdParameter = new MySqlParameter("@specialtyID", specialtyId);

            cmd.Parameters.Add(specialtyIdParameter);
            cmd.ExecuteNonQuery();
            conn.Close();
            if (conn != null)
            {
                conn.Dispose();
            }
        }