private void simpleButton2_Click(object sender, EventArgs e) { if (this.te_Name.EditValue == null || this.te_Name.EditValue.ToString().Trim() == "") { XtraMessageBox.Show("请输入字段名称!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (this.cb_Field.SelectedItem == null) { XtraMessageBox.Show("请选择被统计字段!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } ColumnListItem _item = this.cb_Field.SelectedItem as ColumnListItem; string _msg = ""; if (CreateQueryString(_item, ref _msg)) { this.DialogResult = DialogResult.OK; this.Close(); } else { XtraMessageBox.Show("统计函数错误!" + _msg, "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } }
public string GetInput() { if (this.comboBoxEdit1.SelectedIndex != -1) { ColumnListItem _item = this.comboBoxEdit1.SelectedItem as ColumnListItem; return(_item.FieldAliasName); } else { string _inputStr = (this.comboBoxEdit1.EditValue == null) ? "" : this.comboBoxEdit1.EditValue.ToString(); if (_inputStr.Length > 1 && _inputStr.StartsWith("$") && _inputStr.EndsWith("$")) { return(_inputStr.Substring(1, _inputStr.Length - 2)); } switch (CurrentType) { case "VARCHAR": case "CHAR": case "VARCHAR2": case "NVARCHAR": case "NVARCHAR2": return(string.Format("'{0}'", _inputStr)); case "NUMBER": return(_inputStr); case "DATE": return(string.Format("to_date('{0}','yyyymmdd')", _inputStr)); } return(""); } }
private void AddALLField(MDModel_Table _table) { foreach (MDModel_Table_Column _tc in _table.Columns) { ColumnListItem _item = new ColumnListItem(_tc); this.cb_Field.Properties.Items.Add(_item); } }
private void cb_Field_SelectedIndexChanged(object sender, EventArgs e) { if (cb_Field.SelectedItem == null) { return; } ColumnListItem _selectedItem = this.cb_Field.SelectedItem as ColumnListItem; this.te_Des.EditValue = string.Format("求{0}的{1}", _selectedItem.FieldDisplayName, this.currentFun.DisplayTitle); }
private void AddNumField(MDModel_Table _table) { foreach (MDModel_Table_Column _tc in _table.Columns) { ColumnListItem _item = new ColumnListItem(_tc); switch (_tc.ColumnDataType.ToUpper()) { case "NUMBER": this.comboBoxEdit1.Properties.Items.Add(_item); break; } } }
private void AddDateField(MDModel_Table _table) { foreach (MDModel_Table_Column _tc in _table.Columns) { ColumnListItem _item = new ColumnListItem(_tc); switch (_tc.ColumnDataType.ToUpper()) { case "DATE": this.cb_Field.Properties.Items.Add(_item); break; } } }
private bool CreateQueryString(ColumnListItem _item, ref string _msg) { _msg = ""; try { string _mainSql = ""; using (MetaDataQueryServiceClient _msc = new MetaDataQueryServiceClient()) { _msc.TestStatisticsExpress(this.currentTable.TableName, _item.Column, this.currentFun, ref _mainSql, ref resultDataType); } this.queryString = string.Format("{0} where {1}", _mainSql, this.currentTable.TableDefine.RelationString); return(true); } catch (Exception e) { _msg = e.Message; return(false); } }