private void buttonNew_Click(object sender, EventArgs e) { String strName; String strCriteria; FormSegmentationCriteria form = new FormSegmentationCriteria("", "", ""); if (form.ShowDialog() == DialogResult.OK) { m_hashFamily.Clear(); listBoxSubset.Items.Clear(); String strQuery = "SELECT FAMILY_NAME, FAMILY_EXPRESSION FROM CRITERIA_SEGMENT ORDER BY FAMILY_NAME"; DataSet ds; try { ds = DBMgr.ExecuteQuery(strQuery); foreach (DataRow row in ds.Tables[0].Rows) { strName = row.ItemArray[0].ToString(); strCriteria = row.ItemArray[1].ToString(); strCriteria = strCriteria.Replace("|", "'"); m_hashFamily.Add(strName, strCriteria); listBoxSubset.Items.Add(strName); } listBoxSubset.Text = form.m_strName; strCriteria = (String)m_hashFamily[form.m_strName].ToString(); textBoxCriteria.Text = strCriteria; } catch (Exception sqlE) { MessageBox.Show(sqlE.ToString()); } } }
private void buttonEditSubset_Click(object sender, EventArgs e) { int nBegin = -1; int nEnd = -1; String strCriteria = textBoxCriteria.Text; if (listBoxSubset.SelectedItem != null) { String strName = listBoxSubset.SelectedItem.ToString(); if (strCriteria != "" && strName != "") { nBegin = strCriteria.IndexOf("["); nEnd = strCriteria.IndexOf("]"); //if (nEnd >= 0 && nBegin >= 0) { String strAttribute = ""; if (nEnd >= 0 && nBegin >= 0) { strAttribute = strCriteria.Substring(nBegin + 1, nEnd - nBegin - 1); } FormSegmentationCriteria form = new FormSegmentationCriteria(strName, strCriteria, strAttribute); if (form.ShowDialog() == DialogResult.OK) { m_hashFamily.Clear(); listBoxSubset.Items.Clear(); String strQuery = "SELECT FAMILY_NAME, FAMILY_EXPRESSION FROM CRITERIA_SEGMENT ORDER BY FAMILY_NAME"; DataSet ds; try { ds = DBMgr.ExecuteQuery(strQuery); foreach (DataRow row in ds.Tables[0].Rows) { strName = row.ItemArray[0].ToString(); strCriteria = row.ItemArray[1].ToString(); strCriteria = strCriteria.Replace("|", "'"); m_hashFamily.Add(strName, strCriteria); listBoxSubset.Items.Add(strName); } listBoxSubset.Text = strName; strCriteria = (String)m_hashFamily[strName].ToString(); textBoxCriteria.Text = strCriteria; } catch (Exception sqlE) { MessageBox.Show(sqlE.ToString()); } } } } } else { String strName; FormSegmentationCriteria form = new FormSegmentationCriteria("", "", ""); if (form.ShowDialog() == DialogResult.OK) { m_hashFamily.Clear(); listBoxSubset.Items.Clear(); String strQuery = "SELECT FAMILY_NAME, FAMILY_EXPRESSION FROM CRITERIA_SEGMENT ORDER BY FAMILY_NAME"; DataSet ds; try { ds = DBMgr.ExecuteQuery(strQuery); foreach (DataRow row in ds.Tables[0].Rows) { strName = row.ItemArray[0].ToString(); strCriteria = row.ItemArray[1].ToString(); strCriteria = strCriteria.Replace("|", "'"); m_hashFamily.Add(strName, strCriteria); listBoxSubset.Items.Add(strName); } listBoxSubset.Text = form.m_strName; strCriteria = (String)m_hashFamily[form.m_strName].ToString(); textBoxCriteria.Text = strCriteria; } catch (Exception sqlE) { MessageBox.Show(sqlE.ToString()); } } } }