public AntivirusIdsFirewall(Aif aif)
 {
     InitializeComponent();
     Text = "Изменить";
     objectName.Text = aif.Name;
     objectPrice.Text = aif.Price.ToString();
     if (aif.Support.IndexOf("Win") != -1)
     {
         windowsSupport.Checked = true;
     }
     if (aif.Support.IndexOf("Unix") != -1)
     {
         unixSupport.Checked = true;
     }
     objectClass.SelectedIndex = aif.ClassId - 1;
 }
        public void ChangeObject(Aif oldAif, Aif newAif, string table)
        {
            string updateObject =
                string.Format("UPDATE {0} SET Name = @name, Price = @price, Support = @support, Class_Id = @classId WHERE Id = @id", table);

            using (SqlCommand sqlCommand = new SqlCommand(updateObject, _sqlConnection))
            {
                sqlCommand.Parameters.AddWithValue("@name", newAif.Name);
                sqlCommand.Parameters.AddWithValue("@price", newAif.Price);
                sqlCommand.Parameters.AddWithValue("@support", newAif.Support);
                sqlCommand.Parameters.AddWithValue("@classId", newAif.ClassId);
                sqlCommand.Parameters.AddWithValue("@id", oldAif.Id);

                if (sqlCommand.ExecuteNonQuery() > 0)
                {
                    MessageBox.Show("Изменено");
                }
                else
                {
                    MessageBox.Show("Ошибка при изменении");
                }
            }
        }
        public void DeleteObject(Aif aif, string table)
        {
            string removeObject = string.Format("DELETE FROM {0} WHERE Id = @id", table);

            using (SqlCommand sqlCommand = new SqlCommand(removeObject, _sqlConnection))
            {
                sqlCommand.Parameters.AddWithValue("@id", aif.Id);

                if (sqlCommand.ExecuteNonQuery() > 0)
                {
                    MessageBox.Show("Удалено");
                }
                else
                {
                    MessageBox.Show("Ошибка при удалении");
                }
            }
        }
        public void AddObject(Aif aif, string table)
        {
            string insertObject = string.Format("INSERT INTO {0} (Name, Price, Support, Class_Id) VALUES (@name, @price, @support, @classId)", table);
            using (SqlCommand sqlCommand = new SqlCommand(insertObject, _sqlConnection))
            {
                sqlCommand.Parameters.AddWithValue("@name", aif.Name);
                sqlCommand.Parameters.AddWithValue("@price", aif.Price);
                sqlCommand.Parameters.AddWithValue("@support", aif.Support);
                sqlCommand.Parameters.AddWithValue("@classId", aif.ClassId);

                if (sqlCommand.ExecuteNonQuery() > 0)
                {
                    //            MessageBox.Show("Добвленно");
                }
                else
                {
                    MessageBox.Show("Ошибка при добавлении");
                }
            }
        }