private void cmdOpOk_Click(object sender, EventArgs e) { StringBuilder theErrorMsg = new StringBuilder(); if (Convert.ToInt32(cmbOpCategory.SelectedValue) < 0) { theErrorMsg.Append("Select Report Category first.").AppendLine(); } if (Convert.ToInt32(cmbOpRepName.SelectedValue) < 0) { theErrorMsg.Append("Select Report Name first.").AppendLine(); } if (theErrorMsg.Length > 0) { MessageBox.Show("Following are mandatory:" + theErrorMsg.ToString(), "IQCare Management", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } DataTable theDt = (DataTable)cmbOpRepName.DataSource; DataView theDV = new DataView(theDt); theDV.RowFilter = "CategoryId= " + cmbOpCategory.SelectedValue + " and ReportId = " + cmbOpRepName.SelectedValue; if (theDV.Count > 0) { QBControl.Clear(); txtQBQuery.Text = ""; txtQBQuery.Text = theDV[0]["ReportQuery"].ToString(); ReportId = Convert.ToInt32(theDV[0]["ReportId"]); CategoryId = Convert.ToInt32(theDV[0]["CategoryId"]); RepName = theDV[0]["ReportName"].ToString(); } QBControl.Enabled = true; pnlOpen.Visible = false; }
private void Init_Form() { txtQBQuery.Text = ""; txtNewCategory.Text = ""; txtReportName.Text = ""; ReportId = 0; CategoryId = 0; RepName = ""; txtNewCategory.Visible = false; pnlSave.Visible = false; pnlOpen.Visible = false; tbQBuilder.Focus(); QBControl.Clear(); }