private void btnCancel_Click(object sender, EventArgs e) { TheConnectType = ""; TheFilterToConnectWith = null; this.Hide(); }
public frmAddSortOps(List <string> flds, TAIObjectCanvas2.CanvasObject obj) { InitializeComponent(); taig.Cols = 3; taig.Rows = 0; taig.set_HeaderLabel(0, "FIELD"); taig.set_HeaderLabel(1, "SORT"); taig.set_HeaderLabel(2, "DIRECTION"); foreach (string s in flds) { taig.Rows += 1; taig.set_item(taig.Rows - 1, 0, s); taig.set_item(taig.Rows - 1, 1, "NO"); } taig.AutoSizeCellsToContents = true; taig.Refresh(); TheFields = flds; if (obj.MetaData2 != string.Empty) { //Each sorted field is separated by a | string[] meta = obj.MetaData2.Split('|'); populateData(meta); GenerateClause(); } else { showError("Unable to load object data"); } }
private void HandleCheckChanges(object sender, EventArgs e) { CheckBox b = (CheckBox)sender; if (b.Name == "chkAND" && b.Checked) { TheFilterToConnectWith = null; } }
public frmAddEditLookup(string Connection, List <string> fields, bool HC, TAIObjectCanvas2.CanvasObject obj) { InitializeComponent(); Dbase = Connection; foreach (string s in fields) { lbFields.Items.Add(s); } rbInner.Visible = false; rbLeftOuter.Visible = false; SqlConnection cn = new SqlConnection(Dbase); cn.Open(); SqlCommand cmd = new SqlCommand("SELECT TABLE_NAME,TABLE_TYPE from INFORMATION_SCHEMA.Tables ORDER BY TABLE_NAME", cn); SqlDataReader r = cmd.ExecuteReader(); while (r.Read()) { string tn = r["TABLE_NAME"] + ""; lbTables.Items.Add(tn); } r.Close(); cmd.Dispose(); cn.Close(); cn.Dispose(); string[] meta = obj.MetaData.Split(System.Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries); if (meta.GetUpperBound(0) == 4) { string[] jt = meta[4].Split(":".ToCharArray()); string[] idxf = meta[0].Split(":".ToCharArray()); string[] jtbl = meta[1].Split(":".ToCharArray()); string[] jf = meta[2].Split(":".ToCharArray()); string[] rf = meta[3].Split(":".ToCharArray()); lbFields.SelectedItem = idxf[1]; lbTables.SelectedItem = jtbl[1]; HandleTableSelection(this, new EventArgs()); lbJoinFields.SelectedItem = jf[1]; string[] rff = rf[1].Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); foreach (string s in rff) { lbReturnFields.SelectedItems.Add(s); } } }
public frmAddLimiter(TAIObjectCanvas2.CanvasObject obj) { InitializeComponent(); if (obj.MetaData2 != string.Empty) { txtLimit.Text = obj.MetaData2; } else { MessageBox.Show("Unable to load object data", "TAI Query Reporter", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
private void HandleRowSelected(object sender, int RowSelected) { string filtname = taig.get_item(taig.SelectedRow, 0); foreach (TAIObjectCanvas2.CanvasObject o in TheFilters) { if (o.Name == filtname) { TheFilterToConnectWith = o; break; } } chkAND.Checked = false; TheConnectType = taig.get_item(taig.SelectedRow, 1); }
private void btnAccept_Click(object sender, EventArgs e) { if (chkAND.Checked) { TheConnectType = "AND"; TheFilterToConnectWith = null; } else { if (taig.SelectedRow != -1) { string filtname = taig.get_item(taig.SelectedRow, 0); TheConnectType = "OR"; foreach (TAIObjectCanvas2.CanvasObject o in TheFilters) { if (o.Name == filtname) { TheFilterToConnectWith = o; break; } } } else { //TheFilterToConnectWith = null; //If no existing filter is selected, automatically join to the last filter in the list string filtname = taig.get_item(taig.Rows - 1, 0); TheConnectType = "OR"; foreach (TAIObjectCanvas2.CanvasObject o in TheFilters) { if (o.Name == filtname) { TheFilterToConnectWith = o; break; } } //TheConnectType = "OR"; } } this.Hide(); }
public frmAddSyntheticFields(string Connection, List <string> TableNames, TAIObjectCanvas2.CanvasObject obj) { InitializeComponent(); Dbase = Connection; tnames = TableNames; //Check if saved data is stored in the object if (obj.MetaData2 != string.Empty) { string[] meta = obj.MetaData2.Split("|".ToCharArray()); PopulateExistingSyntheticField(meta); } else { ShowError("Unable to load object data."); } }
public frmAddEditCalculation(string Connection, List <string> fields, TAIObjectCanvas2.CanvasObject obj) { InitializeComponent(); Dbase = Connection; foreach (string s in fields) { lbFields.Items.Add(s); } //Check if saved data is stored in the object if (obj.MetaData2 != String.Empty) { string[] meta = obj.MetaData2.Split("|".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); PopulateExistingCalculations(meta); } else { ShowError("Unable to load object data."); } }
public frmAddFilter(string Connection, List <string> TableNames, TAIObjectCanvas2.CanvasObject obj) { InitializeComponent(); Dbase = Connection; tnames = TableNames; taig.PopulateGridWithData(Dbase, GenerateSelectionClause()); if (obj.MetaData2 != string.Empty) { string[] fields = obj.MetaData2.Split('|'); FilterItem fi = new FilterItem(); List <string> values = new List <string>(); fi.GridRowID = int.Parse(fields[0].ToString()); fi.FilterType = getFilterTypeFromString(fields[1]); fi.FilterField = fields[2]; if (fi.FilterType != FilterItem.FilterTypes.None && fi.FilterType != FilterItem.FilterTypes.AllowNull && fi.FilterType != FilterItem.FilterTypes.NotNull) { string[] fieldvalues = fields[3].Split(','); foreach (string v in fieldvalues) { values.Add(v); } fi.FilterValues = values; } populateData(fi); Filter = fi; GenerateClauseFromObject(); } else { showError("Unable to load object data"); } }
public frmAddEditLookup(string Connection, List <string> fields, TAIObjectCanvas2.CanvasObject obj) { InitializeComponent(); Dbase = Connection; foreach (string s in fields) { lbFields.Items.Add(s); } SqlConnection cn = new SqlConnection(Dbase); cn.Open(); SqlCommand cmd = new SqlCommand("SELECT TABLE_NAME,TABLE_TYPE from INFORMATION_SCHEMA.Tables ORDER BY TABLE_NAME", cn); SqlDataReader r = cmd.ExecuteReader(); while (r.Read()) { string tn = r["TABLE_NAME"] + ""; lbTables.Items.Add(tn); } r.Close(); cmd.Dispose(); cn.Close(); cn.Dispose(); string[] meta = obj.MetaData.Split(System.Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries); if (meta.GetUpperBound(0) == 4) { string[] jt = meta[4].Split(":".ToCharArray()); string[] idxf = meta[0].Split(":".ToCharArray()); string[] jtbl = meta[1].Split(":".ToCharArray()); string[] jf = meta[2].Split(":".ToCharArray()); string[] rf = meta[3].Split(":".ToCharArray()); lbFields.SelectedItem = idxf[1]; lbTables.SelectedItem = jtbl[1]; HandleTableSelection(this, new EventArgs()); lbJoinFields.SelectedItem = jf[1]; string[] rff = rf[1].Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); foreach (string s in rff) { lbReturnFields.SelectedItems.Add(s); } //foreach (string s in lbFields.Items) //{ // if (s == idxf[1]) // { // lbFields.SelectedItems.Add(s);// = s; // } //} //foreach (string s in lbTables.Items) //{ // if (s == jtbl[1]) // { // lbTables.SelectedItems.Add(s);// = s; // } //} //HandleTableSelection(this, new EventArgs()); //foreach (string s in lbJoinFields.Items) //{ // if (s == jf[1]) // { // lbJoinFields.SelectedItems.Add(s);// = s; // } //} //string look = jt[1] + " " + jtbl[1] + " AS " + lt + " ON "; //// if we are looking up against a lookup already we need to not prepend the base table name //if (idxf[1].Split(".".ToCharArray()).GetUpperBound(0) == 0) // look += GetBaseQueryTableName() + "." + idxf[1] + "=" + lt + "." + jf[1] + System.Environment.NewLine; //else // look += idxf[1] + "=" + lt + "." + jf[1] + System.Environment.NewLine; //TheLookups += look; //string[] rff = rf[1].Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); //for (int i = 0; i <= rff.GetUpperBound(0); i++) //{ // string fline = lt + "." + rff[i] + " AS '" + idxf[1] + "_" + rff[i] + "'"; // if (i < rff.GetUpperBound(0)) // fline += "," + System.Environment.NewLine; // if (i == 0) // TheFields += "," + System.Environment.NewLine + fline; // else // TheFields += fline; //} } }
public frmAddConstraint(List <string> TheAggregates, TAIObjectCanvas2.CanvasObject obj) { InitializeComponent(); taig.Cols = 1; taig.set_HeaderLabel(0, "Aggregation to constrain"); taig.Rows = 0; foreach (string s in TheAggregates) { taig.Rows += 1; taig.set_item(taig.Rows - 1, 0, s); } if (obj.MetaData2 != string.Empty) { ConstraintItem ci = new ConstraintItem(); List <string> constraintValues = new List <string>(); //parse through the meta info to papulate the ConstraintItem object string[] meta = obj.MetaData2.Split('|'); string[] values = meta[2].Split(','); taig.AutoSizeCellsToContents = true; taig.Refresh(); ci.ConstraintType = meta[0]; ci.ConstraintField = meta[1]; for (int i = 0; i < values.Length; i++) { constraintValues.Add(values[i]); } ci.ConstraintValues = constraintValues; //Populate the appropriate text box according to the constraint type switch (ci.ConstraintType) { case "EQUAL": txtNumEqual.Text = ci.ConstraintValues[0]; break; case "NOTEQUAL": txtNumNotEqual.Text = ci.ConstraintValues[0]; break; case "GREATERTHAN": txtNumGreaterThan.Text = ci.ConstraintValues[0]; break; case "LESSTHAN": txtNumLessThan.Text = ci.ConstraintValues[0]; break; case "BETWEEN": txtNumBetweenLower.Text = ci.ConstraintValues[0]; txtNumBetweenUpper.Text = ci.ConstraintValues[1]; break; } //Find the corresponding row id and select the row (if a row was found) int row = taig.FindInColumn(ci.ConstraintField, taig.GetColumnIDByName("Aggregation to constrain"), false); if (row != -1) { taig.SelectedRow = row; } //generate the SQL clause GenerateClause(); } else { showError("Unable to load object data"); } }