Example #1
0
 public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
 {
     if (context != null && context.Instance != null && provider != null)
     {
         IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
         if (edSvc != null)
         {
             EasyGridDetail dg = context.Instance as EasyGridDetail;
             if (dg != null)
             {
                 UserControlSelectFieldNames fns = new UserControlSelectFieldNames();
                 string[] ss = value as string[];
                 fns.LoadData(edSvc, dg.GetFieldNames(context.PropertyDescriptor.Name), ss);
                 edSvc.DropDownControl(fns);
                 if (fns.SelectedStrings != null)
                 {
                     value = fns.SelectedStrings;
                 }
             }
             else
             {
                 EasyDataSet eds = context.Instance as EasyDataSet;
                 if (eds != null)
                 {
                     EasyDataSet master = eds.Master as EasyDataSet;
                     if (master != null)
                     {
                         if (eds.Field_Name != null && master.Field_Name != null)
                         {
                             List <string> commonFlds = new List <string>();
                             for (int i = 0; i < master.Field_Name.Length; i++)
                             {
                                 for (int j = 0; j < eds.Field_Name.Length; j++)
                                 {
                                     if (string.Compare(eds.Field_Name[j], master.Field_Name[i], StringComparison.OrdinalIgnoreCase) == 0)
                                     {
                                         commonFlds.Add(master.Field_Name[i]);
                                         break;
                                     }
                                 }
                             }
                             if (commonFlds.Count > 0)
                             {
                                 UserControlSelectFieldNames fns = new UserControlSelectFieldNames();
                                 string[] ss = value as string[];
                                 fns.LoadData(edSvc, commonFlds.ToArray(), ss);
                                 edSvc.DropDownControl(fns);
                                 if (fns.SelectedStrings != null)
                                 {
                                     value = fns.SelectedStrings;
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     return(value);
 }
        public void OnDeserialize(object context)
        {
            if (Site == null || !Site.DesignMode)
            {
                return;
            }
            FieldList   flds = null;
            EasyDataSet eds  = getEasyDataSet();

            if (eds != null)
            {
                flds = eds.Fields;
            }
            for (int i = 0; i < this.Columns.Count; i++)
            {
                bool set = false;
                if (_cols != null && _cols.Count > 0)
                {
                    for (int j = 0; j < _cols.Count; j++)
                    {
                        if (string.Compare(this.Columns[i].DataPropertyName, _cols[j].DataPropertyName, StringComparison.OrdinalIgnoreCase) == 0)
                        {
                            set = true;
                            this.Columns[i].HeaderText            = _cols[j].HeaderText;
                            this.Columns[i].AutoSizeMode          = _cols[j].AutoSizeMode;
                            this.Columns[i].DefaultCellStyle      = _cols[j].DefaultCellStyle;
                            this.Columns[i].DefaultHeaderCellType = _cols[j].DefaultHeaderCellType;
                            this.Columns[i].DividerWidth          = _cols[j].DividerWidth;
                            this.Columns[i].FillWeight            = _cols[j].FillWeight;
                            this.Columns[i].Frozen       = _cols[j].Frozen;
                            this.Columns[i].MinimumWidth = _cols[j].MinimumWidth;
                            this.Columns[i].Name         = _cols[j].Name;
                            this.Columns[i].ReadOnly     = _cols[j].ReadOnly;
                            if (_cols[j].Resizable != DataGridViewTriState.NotSet)
                            {
                                this.Columns[i].Resizable = _cols[j].Resizable;
                            }
                            this.Columns[i].SortMode    = _cols[j].SortMode;
                            this.Columns[i].Tag         = _cols[j].Tag;
                            this.Columns[i].ToolTipText = _cols[j].ToolTipText;
                            if (_cols[j].ValueType == null)
                            {
                                this.Columns[i].ValueType = _cols[j].ValueType;
                            }
                            this.Columns[i].Visible = _cols[j].Visible;
                            this.Columns[i].Width   = _cols[j].Width;
                            break;
                        }
                    }
                }
                if (!set)
                {
                    EPField f = flds[this.Columns[i].DataPropertyName];
                    if (f != null && !string.IsNullOrEmpty(f.FieldCaption) && string.CompareOrdinal(f.FieldCaption, this.Columns[i].HeaderText) != 0)
                    {
                        this.Columns[i].HeaderText = f.FieldCaption;
                    }
                }
            }
        }
 public PropertyDescriptorFieldProp(EasyDataSet owner, int idx, Type type)
     : base(owner.Field_Name[idx], new Attribute[] { })
 {
     _owner = owner;
     _idx   = idx;
     _type  = type;
 }
 public void OnChangeColumns(DataGridViewColumnCollection cs)
 {
     if (cs != null)
     {
         EasyDataSet eds = getEasyDataSet();
         if (eds != null)
         {
             FieldList flds0 = eds.Fields;
             FieldList flds  = new FieldList();
             for (int c = 0; c < cs.Count; c++)
             {
                 EPField f = flds0[cs[c].DataPropertyName];
                 if (f == null)
                 {
                     f      = new EPField();
                     f.Name = cs[c].DataPropertyName;
                 }
                 f.FieldCaption = cs[c].HeaderText;
                 f.OleDbType    = EPField.ToOleDBType(cs[c].ValueType);
                 flds.Add(f);
             }
             eds.Fields = flds;
         }
     }
 }
Example #5
0
 protected virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         ProfileNode = null;
         Data.Dispose();
         Data = null;
     }
 }
        private FieldList getFields()
        {
            FieldList   flds = new FieldList();
            EasyDataSet eds  = getEasyDataSet();

            if (eds != null)
            {
                flds = eds.Fields;
            }
            return(flds);
        }
Example #7
0
 private void BuildMasterDataSet()
 {
     if (DatasetParsers.Count == 1)
     {
         Data = DatasetParsers.First().Data;
     }
     else
     {
         Data = new RegexDataSet();
         foreach (DatasetParser extractor in DatasetParsers)
         {
             Data.Merge(extractor.Data);
         }
     }
 }
        private EasyDataSet getEasyDataSet()
        {
            EasyDataSet eds = this.DataSource as EasyDataSet;

            if (eds != null)
            {
                return(eds);
            }
            BindingSource bs = this.DataSource as BindingSource;

            if (bs != null)
            {
                return(bs.DataSource as EasyDataSet);
            }
            return(null);
        }
        public override void CreateJavaScript(StringCollection methodCode, Dictionary <string, StringCollection> formSubmissions, string nextActionInput, string indent)
        {
            EventAction ea = AssignedActions;

            if (ea != null)
            {
                if (ea.IsExtendWebClientEvent())
                {
                    methodCode.Add("JsonDataBinding.detachExtendedEvent('");
                    methodCode.Add(ea.Event.Name);
                    methodCode.Add("','");
                    EasyDataSet eds = ea.Event.Owner.ObjectInstance as EasyDataSet;
                    if (eds != null)
                    {
                        methodCode.Add(eds.TableName);
                    }
                    else
                    {
                        methodCode.Add(ea.Event.Owner.CodeName);
                    }
                    methodCode.Add("',");
                    methodCode.Add(ea.GetLocalHandlerName());
                    methodCode.Add(");\r\n");
                }
                else
                {
                    methodCode.Add("var ");
                    methodCode.Add(ea.Event.Owner.CodeName);
                    methodCode.Add(" = document.getElementById('");
                    methodCode.Add(ea.Event.Owner.CodeName);
                    methodCode.Add("');\r\n");
                    //
                    methodCode.Add("JsonDataBinding.DetachEvent(");
                    methodCode.Add(ea.Event.Owner.CodeName);
                    methodCode.Add(",'");
                    methodCode.Add(ea.Event.Name);
                    methodCode.Add("',");
                    methodCode.Add(ea.GetLocalHandlerName());
                    methodCode.Add(");\r\n");
                }
            }
        }
 public void AddUpdateTableNamesFromExpression(MathNodeRoot r)
 {
     if (r != null)
     {
         Dictionary <UInt32, IMethodPointerNode> mps = new Dictionary <uint, IMethodPointerNode>();
         r.GetMethodPointers(mps);
         if (mps.Count > 0)
         {
             foreach (KeyValuePair <UInt32, IMethodPointerNode> kv in mps)
             {
                 if (string.CompareOrdinal("Update", kv.Value.MethodName) == 0)
                 {
                     EasyDataSet eds = kv.Value.MethodExecuter as EasyDataSet;
                     if (eds != null)
                     {
                         this.AddUpdateTableName(eds.TableName);
                     }
                 }
             }
         }
     }
 }
Example #11
0
        public EasyDataSet Parse()
        {
            Data = new RegexDataSet();
            string parserType = ParserType;
            string connString = String.Empty;
            string sqlString  = String.Empty;
            string msmqName   = String.Empty;

            if (ProfileNode == null)
            {
                if (String.IsNullOrEmpty(parserType))
                {
                    if (File.Exists(FileToParse))
                    {
                        switch (Path.GetExtension(FileToParse).ToUpper())
                        {
                        case ".XLS":
                        case ".XLSX":
                            parserType = "EXCEL";
                            break;

                        case ".JSON":
                            parserType = "JSON";
                            break;

                        case ".HTM":
                        case ".HTML":
                            parserType = "HTML";
                            break;

                        case ".XML":
                            parserType = "XML";
                            break;
                        }
                    }
                }
            }
            else
            {
                foreach (XmlAttribute xAttr in ProfileNode.Attributes)
                {
                    switch (xAttr.Name.ToUpper())
                    {
                    case "PARSER":
                    case "TYPE":
                        parserType = xAttr.Value;
                        break;

                    case "CONNECTIONSTRING":
                    case "CONNSTRING":
                        connString = xAttr.Value;
                        connString = connString.Replace("[FileName]", FileToParse);
                        break;

                    case "SQLSTRING":
                    case "SQL":
                        sqlString = xAttr.Value;
                        break;

                    case "MSMQNAME":
                    case "NAME":
                    case "QUEUENAME":
                    case "QUEUE":
                    case "MSMQ":
                        msmqName = xAttr.Value;
                        break;
                    }
                }
            }

            switch (parserType.ToUpper())
            {
            case "JSON":
                Data = new JsonDataSet();
                break;

            case "HTML":
                Data = new HtmlDataSet();
                break;

            case "EXCEL":
                Data = new ExcelDataSet();
                break;

            case "ODBC":
            case "OLEDB":
            case "SQL":
                Data = new DatabaseDataSet((DatabaseType)Enum.Parse(typeof(DatabaseType), parserType, true), connString, sqlString);
                break;

            case "MSMQ":
                Data = new MsMqDataSet(msmqName);
                break;

            case "XML":
                Data = new XmlDataSet();
                break;

            case "DELIMITED":
                Data = new DelimitedDataSet();
                break;

            case "HL7":
                Data = new HL7DataSet();
                break;

            default:
                Data = new RegexDataSet();
                break;
            }
            Data.LoadProfileSettings(ProfileNode);
            Data.RowReadAndProcessed += resultDataSet_RowReadAndProcessed;
            if ((!String.IsNullOrWhiteSpace(FileToParse)) && (File.Exists(FileToParse)))
            {
                if (Data is EasyDataSet)
                {
                    ((EasyDataSet)Data).Fill(FileToParse);
                }
            }
            return(Data);
        }
 public void SetOwner(EasyDataSet ds)
 {
     _owner = ds;
 }
 public DataBatch(EasyDataSet ds)
 {
     _owner = ds;
 }
 public FieldsPropertyCollection(EasyDataSet owner)
 {
     _owner = owner;
 }