예제 #1
0
        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();
                }
            }
        }
예제 #2
0
 public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, IServiceProvider provider, object value)
 {
     if (null != context && null != context.Instance && null != context.Container)
     {
         IElement element = context.Instance as IElement;
         if (null != element)
         {
             SourceField        sf  = GetSourceField(element);
             IPmsReportDataBind rdb = element as IPmsReportDataBind;
             if (null != rdb)
             {
                 SourceBindDialog fbd = new SourceBindDialog(sf, rdb.SourceField, true);
                 if (fbd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                 {
                     return(fbd.SourceField);
                 }
             }
         }
     }
     return(base.EditValue(context, provider, value));
 }
예제 #3
0
        private void SourceBindAction()
        {
            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)
                {
                    if (null != pd)
                    {
                        if (null != fbd.SourceField)
                        {
                            pd.SourceField = fbd.SourceField.Clone();
                        }
                        else
                        {
                            pd.SourceField = null;
                        }
                        NotifyDesignSurfaceChange();
                    }
                }
            }
        }
예제 #4
0
 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"); }
 }