private void DisplayFieldListBox() { listBoxFields.Items.Clear(); if (fieldDictionary.Count > 0) { foreach (string key in fieldDictionary.Keys) { if (key == selField) { continue; } FieldProperties fp = fieldDictionary[key]; if (calType == CalculationType.String) { if (fp.ParamFormat == "ElementId") { continue; } listBoxFields.Items.Add(fp.ParamName); } if (calType == CalculationType.Math && fp.ParamFormat == "Double") { listBoxFields.Items.Add(fp.ParamName); } } listBoxFields.Sorted = true; } }
private void form_FieldName_Load(object sender, EventArgs e) { textBoxField.Text = fieldName; if (fieldDictionary.Count > 0) { foreach (string field in fieldDictionary.Keys) { FieldProperties fp = fieldDictionary[field]; if (fp.ReadOnly) { continue; } if (fp.ParamFormat == "ElementId") { continue; } if (calType == CalculationType.String) { comboBoxFields.Items.Add(field); } else if (calType == CalculationType.Math) { if (fp.ParamFormat == "Double") { comboBoxFields.Items.Add(field); } } } } }
private void CollectFieldData() { try { string categoryName = tableName.Substring(5); if (tableName.Contains("Rvt_")) { categoryName = tableName.Substring(4); } //rooms and space string strSql = "SELECT * FROM " + paramTable + " WHERE CategoryName ='" + categoryName + "' AND IsVisible = 'True'"; Recordset recordset = daoDB.OpenRecordset(strSql); while (!recordset.EOF) { string paramName = recordset.Fields["ParamName"].Value; string paramId = recordset.Fields["ParamID"].Value; string paramFormat = recordset.Fields["ParamFormat"].Value; FieldProperties fp = new FieldProperties(paramName, paramId, paramFormat); //to set values for preview fp.StrValue = selDataTable.Rows[0][paramName].ToString(); fp.ReadOnly = selDataTable.Columns[paramName].ReadOnly; if (!fieldDictionary.ContainsKey(paramName)) { fieldDictionary.Add(paramName, fp); } recordset.MoveNext(); } recordset.Close(); } catch (Exception ex) { MessageBox.Show("Failed to collect field data.\n" + ex.Message, "Expression Builder Error:", MessageBoxButtons.OK, MessageBoxIcon.Error); } }