Example #1
0
        public DataCollection AddDataCollection(
            IEnumerable <IFreeDocument> source, string collectionName = null, bool isCover = false)
        {
            if (collectionName == null)
            {
                collectionName = "数据集" + DateTime.Now.ToShortTimeString();
            }

            DataCollection collection = DataCollections.FirstOrDefault(d => d.Name == collectionName);

            if (collection != null)
            {
                if (!isCover)
                {
                    foreach (IFreeDocument computeable in source)
                    {
                        collection.ComputeData.Add(computeable);
                    }
                    collection.OnPropertyChanged("Count");
                }
                else
                {
                    XLogSys.Print.Warn(collectionName + "数据源已经存在,不进行覆盖,没有保存");
                }
                return(collection);
            }
            var data = new DataCollection(source.ToList())
            {
                Name = collectionName
            };

            DataCollections.Add(data);
            return(data);
        }
Example #2
0
 public DataCollection GetCollection(string name)
 {
     if (DataCollections.Count == 0)
     {
         return(null);
     }
     return(string.IsNullOrWhiteSpace(name) ? DataCollections.FirstOrDefault() : DataCollections.FirstOrDefault(rc => rc.Name == name));
 }
Example #3
0
        public void SaveFile(string dataCollectionName, string path = null, string format = null)
        {
            DataCollection data = DataCollections.FirstOrDefault(d => d.Name == dataCollectionName);

            if (data == null)
            {
                return;
            }
            SaveFile(data, path, format);
        }
Example #4
0
        public IList <IFreeDocument> Get(string name)
        {
            if (DataCollections.Count == 0)
            {
                return(new List <IFreeDocument>());
            }
            if (string.IsNullOrWhiteSpace(name))
            {
                return(DataCollections.First().ComputeData.ToList());
            }
            DataCollection p = DataCollections.FirstOrDefault(rc => rc.Name == name);

            return(p?.ComputeData);
        }
Example #5
0
        public DataCollection AddDataCollection(
            IEnumerable <IFreeDocument> source, string collectionName = null, bool isCover = false)
        {
            if (collectionName == null)
            {
                collectionName = GlobalHelper.Get("key_250") + DateTime.Now.ToShortTimeString();
            }

            var collection = DataCollections.FirstOrDefault(d => d.Name == collectionName);

            if (collection != null)
            {
                if (!isCover)
                {
                    foreach (var computeable in source)
                    {
                        collection.ComputeData.Add(computeable);
                    }
                    collection.OnPropertyChanged("Count");
                }
                else
                {
                    XLogSys.Print.Warn(collectionName + GlobalHelper.Get("key_251"));
                }
                return(collection);
            }
            var data = new DataCollection(source.ToList())
            {
                Name = collectionName
            };

            Analytics.TrackEvent(GlobalHelper.Get("key_231"), new Dictionary <string, string> {
                { "Parameter", collectionName },
            });
            DataCollections.Add(data);
            return(data);
        }