public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, IServiceProvider provider, object value) { IWindowsFormsEditorService editorService = null; if (null != context && null != context.Instance) { sectionClass pcc = context.Instance as sectionClass; if (null != pcc && null != pcc.SourceField) { editorService = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); if (editorService != null) { FieldTreeViewData sfAll = (PMS.Libraries.ToolControls.PMSPublicInfo.CurrentPrjInfo.GetCurrentReportDataDefine()) as FieldTreeViewData; RelationFieldChoose rfc = new RelationFieldChoose(editorService); rfc.strRField = pcc.BindingField; List <PmsField> lp = new List <PmsField>(); List <SourceField> lpdb = pcc.SourceField.GetSubSourceField(sfAll); foreach (SourceField pdb in lpdb) { try { if (!string.IsNullOrEmpty(pdb.DataType)) { string typ = pdb.DataType.ToUpper(); if (typ.Equals("INT", StringComparison.InvariantCultureIgnoreCase) || typ.Equals("FLOAT", StringComparison.InvariantCultureIgnoreCase) || typ.Equals("REAL", StringComparison.InvariantCultureIgnoreCase) || typ.Equals("INT32", StringComparison.InvariantCultureIgnoreCase) || typ.Equals("INT16", StringComparison.InvariantCultureIgnoreCase) || typ.Equals("INT64", StringComparison.InvariantCultureIgnoreCase) || typ.Equals("SYSTEM.SINGLE", StringComparison.InvariantCultureIgnoreCase) || typ.Equals("SYSTEM.DOUBLE", StringComparison.InvariantCultureIgnoreCase) || typ.Equals("SYSTEM.INT32", StringComparison.InvariantCultureIgnoreCase) || typ.Equals("SYSTEM.DECIMAL", StringComparison.InvariantCultureIgnoreCase)) { PmsField pf = new PmsField(); pf.fieldName = pdb.RecordField; pf.fieldDescription = pdb.Name; lp.Add(pf); } } } catch { } } rfc.pmsFieldList = lp; editorService.DropDownControl(rfc); if (!string.IsNullOrEmpty(rfc.strRField)) { value = rfc.strRField; } return(value); } } } return(base.EditValue(context, provider, value)); }
private void FieldBindDialogLoad(object sender, EventArgs e) { FieldTreeViewData fvd = CurrentPrjInfo.GetCurrentReportDataDefine() as FieldTreeViewData; if (null == fvd) { return; } if (null != SourceField) { FieldTreeNodeData currentNode = fvd.FindNodeBySource(SourceField); if (null != currentNode) { fvd.PopulateTree(this.DataSourceTreeView, currentNode, true); } } else { fvd.PopulateTree(this.DataSourceTreeView, true, BindingSourceField); } AddParamVar(); //LoadSysParams(); SelectNode(); //this.DataSourceTreeView.ExpandAll(); if (!string.IsNullOrEmpty(this.FieldTextTb.Text)) { this.FieldTextTb.Focus(); this.FieldTextTb.Select(0, this.FieldTextTb.Text.Length); } }
/// <summary> /// 初始化X轴数据源绑定ComboBox /// </summary> private void cboXBindingFieldInit() { //测试用数据 //cboXBindingField.Items.Add("XBindingField1"); //cboXBindingField.Items.Add("XBindingField2"); //cboXBindingField.Items.Add("XBindingField3"); cboXBindingField.Items.Clear(); if (ChartParent.SourceField == null) { return; } FieldTreeViewData ftvd = PMS.Libraries.ToolControls.PMSPublicInfo.CurrentPrjInfo.GetCurrentReportDataDefine() as FieldTreeViewData; List <SourceField> fields = ChartParent.SourceField.GetSubSourceField(ftvd); if (fields == null) { return; } List <PmsField> lp = new List <PmsField>(); foreach (SourceField sf in fields) { if (!string.IsNullOrEmpty(sf.DataType)) { PmsField pf = new PmsField(); pf.fieldName = sf.RecordField; pf.fieldDescription = sf.Name; lp.Add(pf); cboXBindingField.Items.Add(pf.fieldName); } } }
protected virtual void DealWithDataTable() { IPmsReportDataBind pd = this as IPmsReportDataBind; SourceField parent = GetSourceField(this); using (SourceBindDialog fbd = new SourceBindDialog(parent, pd.SourceField, true)) { if (fbd.ShowDialog() == System.Windows.Forms.DialogResult.OK) { bool contain = false; if (fbd.SourceField != null) { FieldTreeViewData sfAll = (PMS.Libraries.ToolControls.PMSPublicInfo.CurrentPrjInfo.GetCurrentReportDataDefine()) as FieldTreeViewData; List <SourceField> lpdb = fbd.SourceField.GetSubSourceField(sfAll); foreach (SourceField pdb in lpdb) { try { if (!string.IsNullOrEmpty(pdb.DataType)) { string typ = pdb.DataType.ToUpper(); if (typ.Equals("INT", StringComparison.InvariantCultureIgnoreCase) || typ.Equals("FLOAT", StringComparison.InvariantCultureIgnoreCase) || typ.Equals("REAL", StringComparison.InvariantCultureIgnoreCase) || typ.Equals("INT32", StringComparison.InvariantCultureIgnoreCase) || typ.Equals("INT16", StringComparison.InvariantCultureIgnoreCase) || typ.Equals("INT64", StringComparison.InvariantCultureIgnoreCase) || typ.Equals("SYSTEM.SINGLE", StringComparison.InvariantCultureIgnoreCase) || typ.Equals("SYSTEM.DOUBLE", StringComparison.InvariantCultureIgnoreCase) || typ.Equals("SYSTEM.INT32", StringComparison.InvariantCultureIgnoreCase) || typ.Equals("SYSTEM.DECIMAL", StringComparison.InvariantCultureIgnoreCase) || typ.Equals("SYSTEM.DateTime", StringComparison.InvariantCultureIgnoreCase)) { contain = true; } } } catch { throw new Exception("lpdb"); } } if (contain) { this.SourceField = fbd.SourceField; } else { MessageBox.Show("没有合适的数据集!"); } } else { this.SourceField = null; } NotifyDesignSurfaceChange(); } } }
private void RefreshTree() { FieldTreeViewData fvd = CurrentPrjInfo.GetCurrentReportDataDefine() as FieldTreeViewData; if (null == fvd) { return; } if (cb_CustomMode.Checked) { this.tb_TablePath.Enabled = true; fvd.PopulateTree(this.DataSourceTreeView); } else { this.tb_TablePath.Enabled = false; if (null != _allField) { FieldTreeNodeData currentNode = fvd.FindNodeBySource(_allField); if (null != currentNode) { fvd.PopulateTreeAddRoot(this.DataSourceTreeView, currentNode); } } else { fvd.PopulateTree(this.DataSourceTreeView); } } FilterTreeView(); bool isSelect = false; foreach (TreeNode node in this.DataSourceTreeView.Nodes) { isSelect |= SelectNode(SourceField, node); } if (!isSelect) { if (this.DataSourceTreeView.Nodes.Count > 0) { this.DataSourceTreeView.ExpandAll(); } } if (null != this.DataSourceTreeView.SelectedNode) { this.DataSourceTreeView.SelectedNode.EnsureVisible(); } }
private void EditTextBindiDialogLoad(object sender, EventArgs e) { FieldTreeViewData fvd = CurrentPrjInfo.GetCurrentReportDataDefine() as FieldTreeViewData; if (null != fvd && fvd.Nodes.Length > 0) { ReportVar rv = fvd.Nodes[0].Tag as ReportVar; if (null != rv) { foreach (PMSVar pmsVar in rv.PMSVarList) { this.VarTreeView.Nodes.Add(new TreeNode(pmsVar.VarName, 0, 0)); } } } }
/// <summary> /// 初始化次统计数据源绑定ComboBox /// </summary> private void cboMinorBindingInit() { ArrayList al = new ArrayList(); cboMinorBinding.Items.Clear(); //cboMinorBinding.Items.Add(""); al.Add(new ComboxItem()); if (ChartParent.SourceField == null) { return; } FieldTreeViewData ftvd = PMS.Libraries.ToolControls.PMSPublicInfo.CurrentPrjInfo.GetCurrentReportDataDefine() as FieldTreeViewData; List <SourceField> fields = ChartParent.SourceField.GetSubSourceField(ftvd); if (fields == null) { return; } List <PmsField> lp = new List <PmsField>(); foreach (SourceField sf in fields) { if (!string.IsNullOrEmpty(sf.DataType)) { PmsField pf = new PmsField(); pf.fieldName = sf.RecordField; pf.fieldDescription = sf.Name; lp.Add(pf); al.Add(new ComboxItem(pf.fieldDescription, pf.fieldName)); //cboMinorBinding.Items.Add(pf.fieldName); string typ = sf.DataType.ToUpper(); if (typ.Equals("SYSTEM.DATETIME", StringComparison.InvariantCultureIgnoreCase)) { SplitDateTime(lp, sf, cboMinorBinding, al, "Year"); SplitDateTime(lp, sf, cboMinorBinding, al, "Month"); SplitDateTime(lp, sf, cboMinorBinding, al, "Day"); SplitDateTime(lp, sf, cboMinorBinding, al, "Hour"); SplitDateTime(lp, sf, cboMinorBinding, al, "Minute"); SplitDateTime(lp, sf, cboMinorBinding, al, "Second"); } } } cboMinorBinding.DataSource = al; cboMinorBinding.DisplayMember = "Name"; cboMinorBinding.ValueMember = "Value"; }
/// <summary> /// 初始化Y轴数据源绑定ComboBox /// </summary> private void cboYBindingFieldInit() { //测试用数据 //cboYBindingField.Items.Add("YBindingField1"); //cboYBindingField.Items.Add("YBindingField2"); //cboYBindingField.Items.Add("YBindingField3"); cboYBindingField.Items.Clear(); if (ChartParent.SourceField == null) { return; } FieldTreeViewData ftvd = PMS.Libraries.ToolControls.PMSPublicInfo.CurrentPrjInfo.GetCurrentReportDataDefine() as FieldTreeViewData; List <SourceField> fields = ChartParent.SourceField.GetSubSourceField(ftvd); if (fields == null) { return; } List <PmsField> lp = new List <PmsField>(); foreach (SourceField sf in fields) { if (!string.IsNullOrEmpty(sf.DataType)) { string typ = sf.DataType.ToUpper(); if (typ.Equals("INT", StringComparison.InvariantCultureIgnoreCase) || typ.Equals("FLOAT", StringComparison.InvariantCultureIgnoreCase) || typ.Equals("REAL", StringComparison.InvariantCultureIgnoreCase) || typ.Equals("INT32", StringComparison.InvariantCultureIgnoreCase) || typ.Equals("INT16", StringComparison.InvariantCultureIgnoreCase) || typ.Equals("INT64", StringComparison.InvariantCultureIgnoreCase) || typ.Equals("SYSTEM.SINGLE", StringComparison.InvariantCultureIgnoreCase) || typ.Equals("SYSTEM.DOUBLE", StringComparison.InvariantCultureIgnoreCase) || typ.Equals("SYSTEM.INT32", StringComparison.InvariantCultureIgnoreCase) || typ.Equals("SYSTEM.DECIMAL", StringComparison.InvariantCultureIgnoreCase)) { PmsField pf = new PmsField(); pf.fieldName = sf.RecordField; pf.fieldDescription = sf.Name; lp.Add(pf); cboYBindingField.Items.Add(pf.fieldName); } } } }
public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, IServiceProvider provider, object value) { IWindowsFormsEditorService editorService = null; if (null != context && null != context.Instance) { CurveX pcc = context.Instance as CurveX; if (null != pcc && null != pcc.SourceField) { editorService = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); if (editorService != null) { FieldTreeViewData sfAll = (PMS.Libraries.ToolControls.PMSPublicInfo.CurrentPrjInfo.GetCurrentReportDataDefine()) as FieldTreeViewData; RelationFieldChoose rfc = new RelationFieldChoose(editorService); rfc.strRField = (string)pcc.xRecordField; List <PmsField> lp = new List <PmsField>(); List <SourceField> lpdb = pcc.SourceField.GetSubSourceField(sfAll); foreach (SourceField pdb in lpdb) { if (string.IsNullOrEmpty(pdb.SqlText)) { PmsField pf = new PmsField(); pf.fieldName = pdb.RecordField; pf.fieldDescription = pdb.Name; lp.Add(pf); } } rfc.pmsFieldList = lp; editorService.DropDownControl(rfc); if (!string.IsNullOrEmpty(rfc.strRField)) { value = rfc.strRField; } return(value); } } } return(base.EditValue(context, provider, value)); }
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { IWindowsFormsEditorService editorService = null; if (context != null && context.Instance != null && provider != null) { editorService = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); if (editorService != null) { if (editorService != null) { SourceFieldDataTable cbx = context.Instance as SourceFieldDataTable; SampleDistanceVar rfc = new SampleDistanceVar(editorService); if (cbx != null) { rfc.CurrentVarName = cbx.SampleDistanceVar; List <PMSVar> lp = new List <PMSVar>(); FieldTreeViewData sfAll = (PMS.Libraries.ToolControls.PMSPublicInfo.CurrentPrjInfo.GetCurrentReportDataDefine()) as FieldTreeViewData; if (sfAll != null && sfAll.Nodes != null && sfAll.Nodes.Length > 0) { ReportVar temp = sfAll.Nodes[0].Tag as ReportVar; if (temp != null) { lp = temp.PMSVarList; } } rfc.ReportVarList = lp; editorService.DropDownControl(rfc); value = rfc.CurrentVarName; return(value); } } } } return(value); }
public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, IServiceProvider provider, object value) { try { if (null != context && null != context.Instance && null != context.Container) { ChartBase element = context.Instance as ChartBase; if (null != element) { SourceField parent = GetSourceField(element); using (SourceBindDialog fbd = new SourceBindDialog(parent, element.SourceField, true)) { if (fbd.ShowDialog() == System.Windows.Forms.DialogResult.OK) { bool contain = false; if (fbd.SourceField != null) { FieldTreeViewData sfAll = (PMS.Libraries.ToolControls.PMSPublicInfo.CurrentPrjInfo.GetCurrentReportDataDefine()) as FieldTreeViewData; List <SourceField> lpdb = fbd.SourceField.GetSubSourceField(sfAll); foreach (SourceField pdb in lpdb) { try { if (!string.IsNullOrEmpty(pdb.DataType)) { string typ = pdb.DataType.ToUpper(); if (typ.Equals("INT", StringComparison.InvariantCultureIgnoreCase) || typ.Equals("FLOAT", StringComparison.InvariantCultureIgnoreCase) || typ.Equals("REAL", StringComparison.InvariantCultureIgnoreCase) || typ.Equals("INT32", StringComparison.InvariantCultureIgnoreCase) || typ.Equals("INT16", StringComparison.InvariantCultureIgnoreCase) || typ.Equals("INT64", StringComparison.InvariantCultureIgnoreCase) || typ.Equals("SYSTEM.SINGLE", StringComparison.InvariantCultureIgnoreCase) || typ.Equals("SYSTEM.DOUBLE", StringComparison.InvariantCultureIgnoreCase) || typ.Equals("SYSTEM.INT32", StringComparison.InvariantCultureIgnoreCase) || typ.Equals("SYSTEM.DECIMAL", StringComparison.InvariantCultureIgnoreCase) || typ.Equals("SYSTEM.DateTime", StringComparison.InvariantCultureIgnoreCase)) { contain = true; } } } catch { throw new Exception("lpdb"); } } if (contain) { value = fbd.SourceField; } else { MessageBox.Show("没有合适的数据集!"); } } else { value = null; } IComponentChangeService cs = provider.GetService(typeof(IComponentChangeService)) as IComponentChangeService; if (null != cs) { cs.OnComponentChanged(this, null, null, null); } } } } return(value); } return(base.EditValue(context, provider, value)); } catch { throw new Exception("BindingEditor"); } }