internal void DeleteParameterSet(ParameterSet parameterSet) { int result = 0; using (MySqlConnection connection = new MySqlConnection(GetConnectionString())) { MySqlCommand cmd = new MySqlCommand("usp_DeleteParameterSet", connection); cmd.CommandType = CommandType.StoredProcedure; AddSqlParameter(cmd, "iParameterSetID", MySqlDbType.Int32, parameterSet.ParameterSetID); connection.Open(); result = Convert.ToInt32(cmd.ExecuteScalar()); cmd.Dispose(); } }
internal ParameterSet UpdateParameterSet(ParameterSet parameterSet) { using (MySqlConnection connection = new MySqlConnection(GetConnectionString())) { MySqlCommand cmd = new MySqlCommand("usp_UpdateParameterSet", connection); cmd.CommandType = CommandType.StoredProcedure; AddSqlParameter(cmd, "iParameterSetID", MySqlDbType.Int32, parameterSet.ParameterSetID); AddSqlParameter(cmd, "iReportID", MySqlDbType.Int32, parameterSet.ReportID); AddSqlParameter(cmd, "iParameterSetName", MySqlDbType.VarChar, 4000, parameterSet.ParameterSetName); AddSqlParameter(cmd, "iParameterSetDescription", MySqlDbType.VarChar, 4000, parameterSet.ParameterSetDescription); connection.Open(); cmd.ExecuteScalar(); cmd.Dispose(); } for (int i = 0; i < parameterSet.Parameters.Count; i++) { parameterSet.Parameters[i].ParameterSetID = parameterSet.ParameterSetID; if (parameterSet.Parameters[i].ParameterID == 0) parameterSet.Parameters[i] = InsertParameter(parameterSet.Parameters[i]); else parameterSet.Parameters[i] = UpdateParameter(parameterSet.Parameters[i]); } return parameterSet; }
internal ParameterSet GetParameterSetByReportIDParameterSetName(int reportID, string parameterSetName) { ParameterSet parameterSet = new ParameterSet(); using (MySqlConnection connection = new MySqlConnection(GetConnectionString())) { MySqlDataReader dr = null; MySqlCommand cmd = new MySqlCommand("usp_GetParameterSetByReportIDParameterSetName", connection); cmd.CommandType = CommandType.StoredProcedure; AddSqlParameter(cmd, "iReportID", MySqlDbType.Int32, reportID); AddSqlParameter(cmd, "iParameterSetName", MySqlDbType.VarChar, 45, parameterSetName); connection.Open(); dr = cmd.ExecuteReader(); while (dr.Read()) { parameterSet.ParameterSetID = (int)dr["ParameterSetID"]; parameterSet.ReportID = (int)dr["ReportID"]; parameterSet.ParameterSetName = dr["ParameterSetName"].ToString(); parameterSet.ParameterSetDescription = dr["ParameterSetDescription"].ToString(); parameterSet.Parameters = GetParametersByParameterSetID(parameterSet.ParameterSetID); break; } cmd.Dispose(); } return parameterSet; }
internal List<ParameterSet> GetParameterSetsByReportID(int reportID) { List<ParameterSet> parameterSets = new List<ParameterSet>(); using (MySqlConnection connection = new MySqlConnection(GetConnectionString())) { MySqlDataReader dr = null; MySqlCommand cmd = new MySqlCommand("usp_GetParameterSetsByReportID", connection); cmd.CommandType = CommandType.StoredProcedure; AddSqlParameter(cmd, "iReportID", MySqlDbType.Int32, reportID); connection.Open(); dr = cmd.ExecuteReader(); while (dr.Read()) { ParameterSet parameterSet = new ParameterSet(); parameterSet.ParameterSetID = (int)dr["ParameterSetID"]; parameterSet.ReportID = (int)dr["ReportID"]; parameterSet.ParameterSetName = dr["ParameterSetName"].ToString(); parameterSet.ParameterSetDescription = dr["ParameterSetDescription"].ToString(); parameterSet.Parameters = GetParametersByParameterSetID(parameterSet.ParameterSetID); parameterSets.Add(parameterSet); } cmd.Dispose(); } return parameterSets; }
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; } }
public void SetParameterSetNameArg(string parameterSetName) { _parameterSetArg = _reporterDA.GetParameterSetByReportIDParameterSetName(SelectedReport.ReportID, parameterSetName); HasParameterSetNameArg = true; }
public ParameterSet SaveParameterSet(ParameterSet parameterSet) { if (parameterSet.ParameterSetID == 0) parameterSet = _reporterDA.InsertParameterSet(parameterSet); else parameterSet = _reporterDA.UpdateParameterSet(parameterSet); return parameterSet; }
public void DeleteParameterSet(ParameterSet parameterSet) { _reporterDA.DeleteParameterSet(parameterSet); }
public ComboBoxItem(string name, ParameterSet parameterSet) { this.Name = name; this.ParameterSet = parameterSet; }