internal void DeleteParameter(Parameter parameter)
        {
            int result = 0;

            using (MySqlConnection connection = new MySqlConnection(GetConnectionString()))
            {
                MySqlCommand cmd = new MySqlCommand("usp_DeleteParameter", connection);
                cmd.CommandType = CommandType.StoredProcedure;

                AddSqlParameter(cmd, "iParameterID", MySqlDbType.Int32, parameter.ParameterID);

                connection.Open();

                result = Convert.ToInt32(cmd.ExecuteScalar());
                cmd.Dispose();
            }
        }
        internal Parameter UpdateParameter(Parameter parameter)
        {
            int result = 0;

            using (MySqlConnection connection = new MySqlConnection(GetConnectionString()))
            {
                MySqlCommand cmd = new MySqlCommand("usp_UpdateParameter", connection);
                cmd.CommandType = CommandType.StoredProcedure;

                AddSqlParameter(cmd, "iParameterID", MySqlDbType.Int32, parameter.ParameterID);
                AddSqlParameter(cmd, "iParameterSetID", MySqlDbType.Int32, parameter.ParameterSetID);
                AddSqlParameter(cmd, "iParameterName", MySqlDbType.VarChar, 4000, parameter.ParameterName);
                AddSqlParameter(cmd, "iParameterValue", MySqlDbType.VarChar, 4000, parameter.ParameterValue);

                connection.Open();

                result = Convert.ToInt32(cmd.ExecuteScalar());
                cmd.Dispose();
            }
            return parameter;
        }
        internal List<Parameter> GetParametersByParameterSetID(int parameterSetID)
        {
            List<Parameter> parameters = new List<Parameter>();

            using (MySqlConnection connection = new MySqlConnection(GetConnectionString()))
            {
                MySqlDataReader dr = null;

                MySqlCommand cmd = new MySqlCommand("usp_GetParametersByParameterSetID", connection);
                cmd.CommandType = CommandType.StoredProcedure;

                AddSqlParameter(cmd, "iParameterSetID", MySqlDbType.Int32, parameterSetID);

                connection.Open();
                dr = cmd.ExecuteReader();

                while (dr.Read())
                {
                    Parameter parameter = new Parameter();
                    parameter.ParameterID = (int)dr["ParameterID"];
                    parameter.ParameterSetID = (int)dr["ParameterSetID"];
                    parameter.ParameterName = dr["ParameterName"].ToString();
                    parameter.ParameterValue = dr["ParameterValue"].ToString();

                    parameters.Add(parameter);
                }
                cmd.Dispose();
            }

            return parameters;
        }
        private void btnSaveParameterSet_Click(object sender, EventArgs e)
        {
            if (IsParameterSetBlankOrDuplicate())
            {
                lblParamSetNameError.Visible = true;
                cboParameterSetName.Focus();
            }
            else if (cboParameterSetName.Text.Length > 0)
            {
                ParameterSet parameterSet;

                if (_newParameterSet)
                {
                    parameterSet = new ParameterSet();
                    parameterSet.ParameterSetName = cboParameterSetName.Text;
                }
                else
                {
                    parameterSet = (((ComboBoxItem)cboParameterSetName.SelectedItem).ParameterSet);
                }

                parameterSet.ParameterSetDescription = txtParameterSetDescription.Text;
                parameterSet.ReportID = _reporterBO.SelectedReport.ReportID;

                parameterSet.Parameters.Clear();

                foreach (ListViewItem item in lvwParameters.Items)
                {
                    Parameter parameter = new Parameter();
                    parameter.ParameterID = Convert.ToInt32(item.Tag);
                    parameter.ParameterName = item.Text;
                    parameter.ParameterValue = item.SubItems[1].Text;
                    parameterSet.Parameters.Add(parameter);
                }

                parameterSet = _reporterBO.SaveParameterSet(parameterSet);

                _parameterSets = _reporterBO.AvailableParameterSets;

                DisplayParameterSets();

                for (int i = 0; i < cboParameterSetName.Items.Count; i++)
                {
                    if (parameterSet.ParameterSetName == cboParameterSetName.Items[i].ToString())
                    {
                        cboParameterSetName.SelectedIndex = i;
                    }
                }

                lblParamSetNameError.Visible = false;
                btnNewParameterSet.Enabled = true;
                _newParameterSet = false;
            }
        }