Esempio n. 1
0
        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));
        }
Esempio n. 2
0
            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));
            }