Пример #1
0
 private static string GetResultPath(IRecord record)
 {
     var candidate = record.Path;
     if (candidate.Contains(" "))
         return string.Format("\"{0}\"", candidate);
     return candidate;
 }
Пример #2
0
        public void Serialize(IRecord record)
        {
            var tr = record as ITypedRecord;
            if (tr == null) throw new NotSupportedException();
            var info = tr.GetInfo();
            var value = record.Value;
            var count = value.Count;

            //_s.WriteLine(count);

            for (int i = 0; i < count; i++)
            {
                _s.Write(info.GetKey(i));

                var x = value[i];
                if(x != null)
                {
                    var xr = x as IRecord;
                    if(xr == null)
                    {
                        _s.Write('\t');
                        _s.Write(x.ToString());
                        _s.WriteLine();
                    }
                    else
                    {
                        _s.WriteLine('\\');
                        Serialize(xr);
                    }
                }
            }
        }
Пример #3
0
 public new void StartRecord(IRecord r)
 {
     //RegisterStartRecord(r);
     _max = 0;
     _best = null;
     _current = r;
 }
Пример #4
0
 public new void Matches(IRecord r1, IRecord r2, double confidence)
 {
     if (confidence > _max)
     {
         _max = confidence;
         _best = r2;
     }
 }
Пример #5
0
        private bool FilterByType(IRecord record)
        {
            if (_types.Count == 0) // there is no filtering
                return true;

            bool found = false;
            return record.GetValues(RDF_TYPE).Any(value => _types.Contains(value));
        }
        protected IContent CreateContent(IRecord record)
        {
            var contentFactory = Diffusion.Content;

            // Create Content wrapping the Record
            var recordContentBuilder = contentFactory.NewBuilder<IRecordContentBuilder>();
            recordContentBuilder.PutRecords(record); // because PutRecord doesn't work
            return recordContentBuilder.Build();
        }
Пример #7
0
        /// <summary>
        /// Contructor
        /// </summary>
        public GameRun(string name)
        {
            _game1 = new Terrian1();
            log = SuperTripRecorder.Instance;
            _start = _game1.Start;
            player = new Player(name);

            GameStart();
        }
        /// <summary>
        /// Called when the record is to be updated
        /// </summary>
        /// <param name="record">The record.</param>
        protected override void OnUpdateRecord(IRecord record)
        {
            int iOne = record.GetFieldValue<int>("One", 0);
            int iTwo = record.GetFieldValue<int>("Two", 0);
            int iThree = record.GetFieldValue<int>("Three", 0);

            record.SetFieldValue<int>("One + Two", iOne + iTwo);
            record.SetFieldValue<int>("One + Three", iOne + iThree);
        }
 public LocalRecordStore GetStoreForRecord(IRecord record)
 {
     if (record == null)
     {
         throw new ArgumentException(null);
     }
     
     return this.EnsureRecordStoreObject(record);
 }
 protected override void OnUpdateRecord(IRecord record)
 {
     UpdateWeightAndPercentage(record, coarseMeasurements, "Coarse Coke Weight ({0})", "Coarse Coke Percentage ({0})");
     UpdateWeightAndPercentage(record, mediumMeasurements, "Medium Coke Weight ({0})", "Medium Coke Percentage ({0})");
     UpdateWeightAndPercentage(record, fineMeasurements, "Fine Coke Weight ({0})", "Fine Coke Percentage ({0})");
     UpdateWeightAndPercentage(record, ballmillMeasurements, "Ball Mill Product Weight ({0})", "Ball Mill Product Percentage ({0})");
     UpdateWeightAndPercentage(record, coarseButtMeasurements, "Coarse Butt Weight ({0})", "Coarse Butt Percentage ({0})");
     UpdateWeightAndPercentage(record, fineButtMeasurements, "Fine Butt Weight ({0})", "Fine Butt Percentage ({0})");
 }
 public string Evaluate(IRecord record)
 {
     IOwner parent = EntityFactory.GetById<IOwner>(_ownerId);
     if(parent == null)
         throw new Exception("Owner id " + _ownerId + " not found");
     StringBuilder buf = new StringBuilder();
     GetAllTeamMemberEmails(parent, buf);
     return buf.ToString();
 }
Пример #12
0
 /// <summary>
 /// Updates the specified record.
 /// </summary>
 /// <param name="record">The record.</param>
 public void Update(IRecord record)
 {
     TraceInfo("{0} - {1}", record, this);
     if (record.IsNew)
     {
         OnUpdateNewRecord(record);
     }
     OnUpdateRecord(record);
 }
        public IAsyncAction DownloadAsync(IRecord record, IOutputStream destination)
        {
            if (record == null)
            {
                throw new ArgumentNullException("record");
            }

            return record.DownloadBlob(this, destination);
        }
 /// <summary>
 /// Updates the lookup.
 /// </summary>
 /// <param name="record">The record.</param>
 protected void UpdateMaterialFields(IRecord record)
 {
     string materialCode = record.GetFieldValue<string>("Material Code", null);
     if (!string.IsNullOrEmpty(materialCode))
     {
         string vendor = materialService.GetVendor(materialCode);
         record.SetFieldValue("Material Vendor", vendor);
     }
 }
 /// <summary>
 /// Called when the record is to be updated
 /// </summary>
 /// <param name="record">The record.</param>
 protected override void OnUpdateRecord(IRecord record)
 {
     bool refresh = record.GetFieldValue<bool>("Refresh Material", false);
     if (refresh)
     {
         UpdateMaterialFields(record);
         record.SetFieldValue("Refresh Material", false);
     }
 }
Пример #16
0
 internal static void MapList(IRecord record, List<SpamKeyword> list)
 {
     SpamKeyword m = new SpamKeyword();
     m.Id = record.GetInt32OrDefault(0, 0);
     m.Keyword = record.GetStringOrEmpty(1);
     m.Status = record.GetInt32OrDefault(2, 0);
     m.AddUserID = record.GetInt32OrDefault(3, 0);
     m.AddDate = record.GetDateTime(4);
     list.Add(m);
 }
Пример #17
0
        public LocalRecordStore(IRecord record, StorageFolder folder, string encryptionKey)
        {
            IObjectStore store = new FolderObjectStore(folder);
            if (!String.IsNullOrEmpty(encryptionKey))
            {
                store = new EncryptedObjectStore(store, new Cryptographer(), encryptionKey);
            }

            Initialize(record, store, null);
        }
 public SynchronizedViewSynchronizer(IRecord record, int maxAgeInSeconds)
 {
     if (record == null)
     {
         throw new ArgumentNullException("record");
     }
     m_record = record;
     this.MaxAgeInSeconds = maxAgeInSeconds;
     m_syncQueries = new List<ItemQuery>();
     m_queriesToRun = new List<ItemQuery>();
 }
Пример #19
0
        /// <summary>
        /// Adds the record to the component's queue.
        /// </summary>
        /// <param name="record">The record.</param>
        public void AddRecord(IRecord record)
        {
            if (record == null)
            {
                return;
            }

            if (RecordCount++ < 1)
            {
                Offset = AddTrace("Starting Pledge Run...", DateTime.MinValue, ClientId);
            }

            var recordHasErrors = false;
            Rules.CurrentRecord = record;

            foreach (var rule in Rules)
            {
                var result = EvaluateRule(record, rule);
                if (result.Type != ResultType.Passed)
                {
                    DocumentHasErrors = true;
                    recordHasErrors = true;

                    //we're only reporting errors from the first 500 records to the UI (or caller) 
                    //as this is more than enough to indicate a really messed up file
                    if (ErrorCount < 500)
                    {
                        foreach (var message in result.Dispositions)
                        {
                            EventsManager.ReportRuleFailure(record.RowNumber, message.Annotation, ClientId);
                        }
                    }
                }
            }

            if (!recordHasErrors)
            {
                record.IsValid = true;
                DocumentHasValidRecords = true;
                PassCount++;
            }
            else
            {
                ErrorCount++;
            }

            Successor.AddRecord(record);

            if (RecordCount % EventCounter == 0)
            {
                UpdateProgress(RecordCount, ClientId);
            }
        }
Пример #20
0
        internal static void MapBandInfoList(IRecord record, List<BandInfo> list)
        {
            BandInfo m = new BandInfo();
            m.BandId = record.GetInt32OrDefault(0, 0);
            m.BandName = record.GetStringOrEmpty(1);
            m.Info1 = record.GetStringOrEmpty(2);
            m.Info2 = record.GetStringOrEmpty(3);
            m.Info3 = record.GetStringOrEmpty(4);
            m.Remark = record.GetStringOrEmpty(5);

            list.Add(m);
        }
 /// <summary>
 /// Called when the record is to be updated
 /// </summary>
 /// <param name="record">The record.</param>
 protected override void OnUpdateRecord(IRecord record)
 {
     double source = record.GetFieldValue<double>(sourceField, 0);
     if (source > 0)
     {
         double log = System.Math.Log10(source);
         record.SetFieldValue<double>(logResultField, log);
     }
     else
     {
         TraceError("{0} - Unable to calculate ['{1}'] = Math.Log10({2})  ({2} = {3})", this, logResultField, sourceField, source);
     }
 }
Пример #22
0
        internal static void MapSeachResultList(IRecord record, List<SearchResult> list,ObjectTypeDefine objectType)
        {
            SearchResult m = new SearchResult();
            m.ObjectType = objectType;
            m.ObjectId = record.GetInt32OrDefault(0, 0);
            m.Title = record.GetStringOrEmpty(1);
            m.Body = record.GetStringOrEmpty(2);
            m.SImage = record.GetStringOrEmpty(3);
            m.BandId = record.GetInt32OrDefault(4, 0);
            m.PublishDate = record.GetDateTimeOrEmpty(5);

            list.Add(m);
        }
        /// <summary>
        /// Called when the record is a new record.
        /// </summary>
        /// <param name="record">The record.</param>
        protected override void OnUpdateNewRecord(IRecord record)
        {
            string currentValue = record.GetFieldValue<string>("Shift", null);

            if (string.IsNullOrEmpty(currentValue))
            {
                DateTime utcSample = record.GetFieldValue<DateTime>("SampleDateTime", DateTime.UtcNow);
                TimeSpan time = utcSample.ToLocalTime().TimeOfDay;

                string shift = time >= MorningShift && time < EveningShift ? "Day" : "Night";
                record.SetFieldValue("Shift", shift);
            }
        }
Пример #24
0
 public SynchronizedStore(IRecord record, LocalItemStore itemStore)
 {
     if (record == null)
     {
         throw new ArgumentNullException("record");
     }
     if (itemStore == null)
     {
         throw new ArgumentNullException("itemStore");
     }
     m_record = record;
     m_itemStore = itemStore;
     SectionsToFetch = ItemSectionType.Standard;
 }
Пример #25
0
 public Simulator(double deltatime, double durationtime,INetwork targetnetwork,ISolver solver,IRecord recorder)
 {
     deltaT = deltatime;
     durationT = durationtime;
     currentT = 0.0;
     t0 = currentT;
     network = targetnetwork;
     this.solver = solver;
     this.recorder = recorder;
     this.recorder.HostSimulator = this;
     runthread = null;
     hpause = new ManualResetEvent(true);
     hstop = new ManualResetEvent(false);
     isrunning = false;
     ispaused = false;
 }
Пример #26
0
        public static String RecordToString(IRecord r)
        {
            var sb = new StringBuilder();
            foreach (var p in r.GetProperties())
            {
                var vs = r.GetValues(p);
                if (vs == null || vs.Count == 0)
                    continue;

                sb.Append(p + ": ");
                foreach (var v in vs)
                {
                    sb.Append(String.Format("'{0}', ", v));
                }
            }

            return sb.ToString();
        }
Пример #27
0
        public List<IRecord> Lookup(IRecord record)
        {
            // first we build the combined query for all lookup properties
            var query = new BooleanQuery();
            foreach (var lookupProperty in _config.GetLookupProperties())
            {
                var values = record.GetValues(lookupProperty.Name);
                if (values == null)
                    continue;
                foreach (var value in values)
                {
                    ParseTokens(query, lookupProperty.Name, value);
                }
            }

            // then we perform the actual search
            return DoQuery(query);
        }
Пример #28
0
        public IAsyncOperation<bool> Display(IRecord record)
        {
            if (record == null)
            {
                throw new ArgumentNullException("record");
            }

            return AsyncInfo.Run(cancelToken => Task.Run(async () =>
                {
                    Blob blob = await RefreshAndGetDefaultBlobAsync(record, cancelToken);
                    if (blob == null)
                    {
                        return false;
                    }

                    return await blob.DisplayAsync().AsTask(cancelToken);
                }));
        }
Пример #29
0
        /// <summary>Converts the specified <paramref name="record" /> usig the specified element set.</summary>
        /// <param name="record">The record to convert.</param>
        /// <param name="elementSet">The element set to use.</param>
        /// <returns>The converted record.</returns>
        public Types.AbstractRecord Convert(IRecord record, string elementSet)
        {
            var elements=new List<string>();

            string csw=_NamespaceManager.LookupPrefix(Namespaces.OgcWebCatalogCswV202);
            if (string.IsNullOrEmpty(csw))
            {
                _NamespaceManager.AddNamespace("csw", Namespaces.OgcWebCatalogCswV202);
                csw="csw";
            }

            string dc=_NamespaceManager.LookupPrefix(Namespaces.DublinCoreElementsV11);
            if (string.IsNullOrEmpty(dc))
            {
                _NamespaceManager.AddNamespace("dc", Namespaces.DublinCoreElementsV11);
                dc="dc";
            }

            string dct=_NamespaceManager.LookupPrefix(Namespaces.DublinCoreTerms);
            if (string.IsNullOrEmpty(dct))
            {
                _NamespaceManager.AddNamespace("dct", Namespaces.DublinCoreTerms);
                dct="dct";
            }

            elements.Add(string.Format(CultureInfo.InvariantCulture, "/{0}:Record/{1}:identifier", csw, dc));
            elements.Add(string.Format(CultureInfo.InvariantCulture, "/{0}:Record/{1}:title", csw, dc));
            elements.Add(string.Format(CultureInfo.InvariantCulture, "/{0}:Record/{1}:type", csw, dc));
            if (elementSet=="brief")
                return Convert(record, elements, false, typeof(Types.BriefRecord));

            elements.Add(string.Format(CultureInfo.InvariantCulture, "/{0}:Record/{1}:abstract", csw, dct));
            elements.Add(string.Format(CultureInfo.InvariantCulture, "/{0}:Record/{1}:format", csw, dc));
            elements.Add(string.Format(CultureInfo.InvariantCulture, "/{0}:Record/{1}:modified", csw, dct));
            elements.Add(string.Format(CultureInfo.InvariantCulture, "/{0}:Record/{1}:relation", csw, dc));
            elements.Add(string.Format(CultureInfo.InvariantCulture, "/{0}:Record/{1}:spatial", csw, dct));
            elements.Add(string.Format(CultureInfo.InvariantCulture, "/{0}:Record/{1}:subject", csw, dc));
            if (elementSet=="summary")
                return Convert(record, elements, false, typeof(Types.SummaryRecord));

            elements.Clear();
            elements.Add(string.Format(CultureInfo.InvariantCulture, "/{0}:Record/*", csw, dc));
            return Convert(record, elements, false, typeof(Types.Record));
        }
Пример #30
0
        private static void WriteSerializedData(IRecord record)
        {
            byte[] buffer;
            using (var s = new MemoryStream())
            using (var sw = new StreamWriter(s))
            {
                var serializer = new Serialization.MySerializer(sw);
                serializer.Serialize(record);
                sw.Flush();

                var len = s.Length;
                s.Seek(0, SeekOrigin.Begin);
                buffer = new byte[len];
                s.Read(buffer, 0, (int)len);
            }

            var serialized = Encoding.UTF8.GetString(buffer);
            Console.WriteLine(serialized);
        }
Пример #31
0
        internal static void Update(MgPropertyCollection props, IRecord record)
        {
            if (props.Count != record.FieldCount)
            {
                throw new InvalidOperationException("Number of values to update does not match. Ensure the MgPropertyCollection was initialized first with PropertyUtil.Populate() first and that the input IRecord comes from the same source used to initialize this MgPropertyCollection"); //LOCALIZEME
            }
            //Flip the null bit first
            for (int i = 0; i < props.Count; i++)
            {
                var p  = props.GetItem(i);
                var np = p as MgNullableProperty;
                if (np != null)
                {
                    np.SetNull(true);
                }

                string name = p.Name;
                if (!record.IsNull(name))
                {
                    switch (p.PropertyType)
                    {
                    case MgPropertyType.Blob:
                    {
                        var bytes = record.GetBlob(name);
                        var bs    = new MgByteSource(bytes, bytes.Length);
                        ((MgBlobProperty)p).SetValue(bs.GetReader());
                    }
                    break;

                    case MgPropertyType.Boolean:
                    {
                        ((MgBooleanProperty)p).SetValue(record.GetBoolean(name));
                    }
                    break;

                    case MgPropertyType.Byte:
                    {
                        ((MgByteProperty)p).SetValue(record.GetByte(name));
                    }
                    break;

                    case MgPropertyType.Clob:
                    {
                        var bytes = record.GetBlob(name);
                        var bs    = new MgByteSource(bytes, bytes.Length);
                        ((MgClobProperty)p).SetValue(bs.GetReader());
                    }
                    break;

                    case MgPropertyType.DateTime:
                    {
                        var dt  = record.GetDateTime(i);
                        var mdt = new MgDateTime((short)dt.Year, (short)dt.Month, (short)dt.Day, (short)dt.Hour, (short)dt.Minute, (short)dt.Second, dt.Millisecond * 1000);
                        ((MgDateTimeProperty)p).SetValue(mdt);
                    }
                    break;

                    case MgPropertyType.Decimal:
                    case MgPropertyType.Double:
                    {
                        ((MgDoubleProperty)p).SetValue(record.GetDouble(name));
                    }
                    break;

                    case MgPropertyType.Geometry:
                    {
                        var agf = GeomConverter.GetAgf(record.GetGeometry(name));
                        ((MgGeometryProperty)p).SetValue(agf);
                    }
                    break;

                    case MgPropertyType.Int16:
                    {
                        ((MgInt16Property)p).SetValue(record.GetInt16(name));
                    }
                    break;

                    case MgPropertyType.Int32:
                    {
                        ((MgInt32Property)p).SetValue(record.GetInt32(name));
                    }
                    break;

                    case MgPropertyType.Int64:
                    {
                        ((MgInt64Property)p).SetValue(record.GetInt64(name));
                    }
                    break;

                    case MgPropertyType.Single:
                    {
                        ((MgSingleProperty)p).SetValue(record.GetSingle(name));
                    }
                    break;

                    case MgPropertyType.String:
                    {
                        ((MgStringProperty)p).SetValue(record.GetString(name));
                    }
                    break;

                    default:
                        throw new NotSupportedException();
                    }
                }
            }
        }
Пример #32
0
        public void ComputeWastedSpace( )
        {
            ITable testTable = m_database.GetTable("People");

            for (int i = 0; i < 1000; i++)
            {
                IRecord record = testTable.NewRecord();
                record.SetValue(1, i.ToString());
                record.Commit();
            }
            RecordsCounts recCounts = testTable.ComputeWastedSpace();

            Assert.AreEqual(1000, recCounts.NormalRecordCount);
            Assert.AreEqual(1000, recCounts.TotalRecordCount);
            ICountedResultSet resultSet = testTable.CreateModifiableResultSet(1, "5");

            foreach (IRecord record in resultSet)
            {
                record.Delete();
            }
            resultSet.Dispose();
            recCounts = testTable.ComputeWastedSpace();
            Assert.AreEqual(999, recCounts.NormalRecordCount);
            Assert.AreEqual(1000, recCounts.TotalRecordCount);
            m_database.Shutdown();
            DBStructure database = new DBStructure("", "MyPal");

            database.LoadStructure();

            m_database = database.OpenDatabase( );
            testTable  = m_database.GetTable("People");

            for (int i = 1000; i < 2000; i++)
            {
                IRecord record = testTable.NewRecord();
                record.SetValue(1, i.ToString());
                record.Commit();
            }
            recCounts = testTable.ComputeWastedSpace();
            Assert.AreEqual(1999, recCounts.NormalRecordCount);
            Assert.AreEqual(2000, recCounts.TotalRecordCount);
            for (int i = 500; i < 1500; i++)
            {
                ICountedResultSet resultSet1 = testTable.CreateModifiableResultSet(1, i.ToString());
                foreach (IRecord record in resultSet1)
                {
                    record.Delete();
                }
                resultSet1.Dispose();
            }
            recCounts = testTable.ComputeWastedSpace();
            Assert.AreEqual(999, recCounts.NormalRecordCount);
            Assert.AreEqual(1001, recCounts.TotalRecordCount - recCounts.NormalRecordCount);
            testTable.SortedColumn = -1;
            testTable.Defragment();
            testTable.SortedColumn = 1;
            testTable.Defragment();
            testTable.SortedColumn = 0;
            testTable.Defragment();
            recCounts = testTable.ComputeWastedSpace();
            Assert.AreEqual(999, recCounts.NormalRecordCount);
            Assert.AreEqual(999, recCounts.TotalRecordCount);
            Assert.AreEqual(0, recCounts.TotalRecordCount - recCounts.NormalRecordCount);
        }
Пример #33
0
 internal Neo4jRawRecord(IRecord record)
 {
     Record = record;
 }
Пример #34
0
        public object CreateNewFieldValue(string fieldName, string recordType, IRecordService recordService,
                                          IRecord currentRecord)
        {
            var currentValueNull = currentRecord.GetField(fieldName) == null;
            var fieldType        = recordService.GetFieldType(fieldName, recordType);

            switch (fieldType)
            {
            case (RecordFieldType.String):
            {
                return(currentValueNull ? "BLAH" : "BLAHBLAH");
            }

            case (RecordFieldType.Date):
            {
                return(currentValueNull ? new DateTime(1980, 11, 15) : new DateTime(2001, 1, 1));
            }

            case (RecordFieldType.Lookup):
            {
                var     lookupTargetType = recordService.GetLookupTargetType(fieldName, recordType);
                IRecord referenceRecord  = null;
                if (currentValueNull)
                {
                    referenceRecord = recordService.GetFirst(lookupTargetType);
                }
                else
                {
                    var rs = recordService.GetFirstX(lookupTargetType, 2, null, null, null);
                    if (rs.Any(r => r.Id != currentRecord.GetLookupId(fieldName)))
                    {
                        referenceRecord = rs.First(r => r.Id != currentRecord.GetLookupId(fieldName));
                    }
                }
                if (referenceRecord == null)
                {
                    referenceRecord = recordService.NewRecord(lookupTargetType);
                    referenceRecord.SetField(recordService.GetPrimaryField(lookupTargetType), "TestLookup",
                                             recordService);
                    recordService.Create(referenceRecord);
                }
                return(referenceRecord.Id);
            }

            case (RecordFieldType.Picklist):
            case (RecordFieldType.Status):
            {
                var options = recordService.GetPicklistKeyValues(fieldName, recordType);
                var option1 = options.First().Key;
                var option2 = options.Count() > 1 ? options.ElementAt(1).Key : options.First().Key;
                if (currentValueNull)
                {
                    return(option1);
                }
                else
                {
                    return(currentRecord.GetOptionKey(fieldName) == option1 ? option2 : option1);
                }
            }

            case (RecordFieldType.Boolean):
            {
                return(currentValueNull);
            }

            case (RecordFieldType.Integer):
            {
                if (XrmRecordService.GetFieldMetadata(fieldName, recordType).IntegerFormat == IntegerType.TimeZone)
                {
                    var timezoneRecords = XrmRecordService.GetFirstX("timezonedefinition", 2, null, null);
                    if (timezoneRecords.Count() < 2)
                    {
                        throw new Exception("At least 2 Records Required");
                    }
                    var option1 = timezoneRecords.ElementAt(0).GetIntegerField("timezonecode");
                    var option2 = timezoneRecords.ElementAt(1).GetIntegerField("timezonecode");
                    if (currentValueNull)
                    {
                        return(option1);
                    }
                    else
                    {
                        return(currentRecord.GetIntegerField(fieldName) == option1 ? option2 : option1);
                    }
                }
                else
                {
                    return(currentValueNull ? 111 : 222);
                }
            }

            case (RecordFieldType.Decimal):
            {
                return(currentValueNull ? new Decimal(111) : new decimal(222));
            }

            case (RecordFieldType.Money):
            {
                return(currentValueNull ? new Decimal(111) : new decimal(222));
            }

            case (RecordFieldType.Double):
            {
                return(currentValueNull ? 111 : 222);
            }

            case (RecordFieldType.Uniqueidentifier):
            {
                return(currentValueNull ? Guid.NewGuid().ToString() : currentRecord.Id);
            }

            default:
            {
                throw new ArgumentOutOfRangeException("Unmatched field type " + fieldType);
            }
            }
        }
Пример #35
0
 public Record(IRecord record)
 {
     this.SetProperty(record);
     ConstructorExecuted();
 }
Пример #36
0
 public virtual IEnumerable <Condition> GetLookupConditions(string fieldName, string recordType, string reference, IRecord record)
 {
     return(new Condition[0]);
 }
Пример #37
0
 public void Add(IRecord record)
 {
     records.Add(record);
 }
Пример #38
0
 public void EndRecord(IRecord r, string tag)
 {
 }
Пример #39
0
 public static ulong Timestamp(this IRecord record) => record.Timestamp;
Пример #40
0
 public void StartRecord(IRecord r, string tag)
 {
 }
        private IRecord InitializeRecordByKeyValueList(SyneryParser.RecordInitializerContext context, IRecord record, IDictionary <string[], IValue> listOfValues)
        {
            foreach (var item in listOfValues)
            {
                if (item.Key.Count() == 1)
                {
                    string fieldName = item.Key[0];
                    IValue value     = item.Value;

                    try
                    {
                        record.SetFieldValue(fieldName, value);
                    }
                    catch (Exception ex)
                    {
                        throw new SyneryInterpretationException(context, String.Format(
                                                                    "Error while initializing the field '{0}' of record type='{1}'. Given value-type: {2}.",
                                                                    fieldName,
                                                                    record.RecordType.FullName,
                                                                    value.Type.PublicName), ex);
                    }
                }
                else
                {
                    throw new SyneryInterpretationException(context, String.Format(
                                                                "Error while initializing the record type='{0}'. No complex identifers allowed (given: '{1}').",
                                                                record.RecordType.FullName,
                                                                String.Join(".", item.Key)));
                }
            }

            return(record);
        }
 /// <summary>
 /// Avalia se os dados do registro são compatíveis com o observer.
 /// </summary>
 /// <param name="record"></param>
 /// <returns></returns>
 public override bool Evaluate(IRecord record)
 {
     return(false);
 }
Пример #43
0
 public Packet QueuePacket(RequestHeader h, ReplyHeader r, IRecord request, IRecord response, string clientPath, string serverPath, ZooKeeper.WatchRegistration watchRegistration, object callback, object ctx)
 {
     return(producer.QueuePacket(h, r, request, response, clientPath, serverPath, watchRegistration));
 }
Пример #44
0
        internal IEnumerable <IRecord> GetLookupPicklist(string fieldName, string recordType, string reference, IRecord record, IRecordService lookupService, string recordTypeToLookup)
        {
            var conditions = GetLookupConditions(fieldName, recordType, reference, record);

            lock (_lockObject)
            {
                if (!_cachedPicklist.ContainsKey(fieldName) || _cachedPicklist[fieldName].LookupService != lookupService)
                {
                    var displayField = GetPicklistDisplayField(fieldName, recordType, lookupService, recordTypeToLookup);

                    var picklist = lookupService.RetrieveAllAndClauses(recordTypeToLookup, conditions,
                                                                       new[] { displayField });
                    var cache = new CachedPicklist(picklist, conditions, lookupService);
                    if (_cachedPicklist.ContainsKey(fieldName))
                    {
                        _cachedPicklist[fieldName] = cache;
                    }
                    else
                    {
                        _cachedPicklist.Add(fieldName, cache);
                    }
                }
                return(_cachedPicklist[fieldName].Picklist);
            }
        }
Пример #45
0
 protected Field(IRecord record, int startIndexOnesBased, int inclusiveEndIndexOnesBased)
 {
     _record = record;
     _startIndexOnesBased        = startIndexOnesBased;
     _inclusiveEndIndexOnesBased = inclusiveEndIndexOnesBased;
 }
Пример #46
0
 public virtual bool IsFieldInContext(string fieldName, IRecord record)
 {
     return(true);
 }
Пример #47
0
 public bool Remove(IRecord record)
 {
     return(records.Remove(record));
 }
Пример #48
0
 public virtual bool IsSectionInContext(string sectionIdentifier, IRecord record)
 {
     return(true);
 }
Пример #49
0
        public override IEnumerable <Condition> GetLookupConditions(string fieldName, string recordType, string reference, IRecord record)
        {
            var conditions = new List <Condition>();

            switch (recordType)
            {
            case Entities.solution:
            {
                switch (fieldName)
                {
                case Fields.solution_.publisherid:
                {
                    conditions.Add(new Condition(Fields.publisher_.isreadonly, ConditionType.Equal, false));
                    conditions.Add(new Condition(Fields.publisher_.uniquename, ConditionType.NotEqual, "MicrosoftCorporation"));
                    break;
                }

                case Fields.solution_.configurationpageid:
                {
                    conditions.Add(new Condition(Fields.webresource_.webresourcetype, ConditionType.Equal, OptionSets.WebResource.Type.WebpageHTML));
                    break;
                }
                }
                break;
            }
            }
            return(conditions);
        }
Пример #50
0
 public TriggerHost(GameEngine engine, IRecord logRecord, string owningPlayer, Trigger triggerType, string triggerParameter) : base(engine, logRecord, owningPlayer)
 {
     TriggerType      = triggerType;
     TriggerParameter = triggerParameter;
 }
Пример #51
0
 public static bool RecordEquals(IRecord r1, IRecord r2)
 {
     return(r1.Keys.SequenceEqual(r2.Keys) && r1.Keys.All(key => CypherValueEquals(r1[key], r2[key])));
 }
Пример #52
0
 protected override IActionHost CloneHost(IRecord logRecord, string owningPlayer)
 {
     return(new TriggerHost(engine, logRecord, owningPlayer, TriggerType, TriggerParameter));
 }
Пример #53
0
        public override void SetUp()
        {
            IBTree._bUseOldKeys = false;

            DBStructure dbStructure =
                new DBStructure("", "OmniaMeaPerformanceTest", DatabaseMode.Create);

            TableStructure table = dbStructure.CreateTable("IntProps");

            table.CreateColumn("Id", ColumnType.Integer, false);
            table.CreateColumn("PropType", ColumnType.Integer, false);
            table.CreateColumn("PropValue", ColumnType.Integer, false);
            table.CreateIndex("Id");

            table = dbStructure.CreateTable("StringProps");
            table.CreateColumn("Id", ColumnType.Integer, false);
            table.CreateColumn("PropType", ColumnType.Integer, false);
            table.CreateColumn("PropValue", ColumnType.String, false);
            table.SetCompoundIndex("PropValue", "PropType");

            table = dbStructure.CreateTable("DateProps");
            table.CreateColumn("Id", ColumnType.Integer, false);
            table.CreateColumn("PropType", ColumnType.Integer, false);
            table.CreateColumn("PropValue", ColumnType.DateTime, false);
            table.SetCompoundIndex("PropValue", "PropType");

            dbStructure.SaveStructure();
            dbStructure.Shutdown();

            _dbStructure = new DBStructure("", "OmniaMeaPerformanceTest");
            _dbStructure.LoadStructure();

            IDatabase db = _dbStructure.OpenDatabase();

            _intPropsTable    = db.GetTable("IntProps");
            _stringPropsTable = db.GetTable("StringProps");
            _datePropsTable   = db.GetTable("DateProps");

            Random rnd = new Random();

            for (int i = 0; i < 200000; i++)
            {
                IRecord rec = _intPropsTable.NewRecord();
                rec.SetValue(0, rnd.Next());
                rec.SetValue(1, i % 100);
                rec.SetValue(2, i);
                rec.Commit();
            }
            for (int i = 0; i < 200000; i++)
            {
                IRecord rec = _stringPropsTable.NewRecord();
                rec.SetValue(0, i);
                rec.SetValue(1, i % 100);
                rec.SetValue(2, rnd.NextDouble().ToString());
                rec.Commit();
            }
            for (int i = 0; i < 200000; i++)
            {
                IRecord rec = _datePropsTable.NewRecord();
                rec.SetValue(0, i % 1000);
                rec.SetValue(1, i);
                rec.SetValue(2, new DateTime(rnd.Next()));
                rec.Commit();
            }
        }
Пример #54
0
 /// <summary>
 /// Create a new empty change set for a <typeparamref name="TRecord"/> record.
 /// </summary>
 /// <typeparam name="TRecord">The record type.</typeparam>
 /// <param name="record"></param>
 /// <returns>A new change set object.</returns>
 public static IPropertyChangeSet <TRecord> StartChangeSet <TRecord>(this IRecord <TRecord> record)
 {
     return(new PropertyChangeSet <TRecord>());
 }
Пример #55
0
        public RecordingManager(ObservableList <ApplicationPOMModel> lstApplicationPOM, BusinessFlow bFlow, Context context, IRecord platformDriver, IPlatformInfo pInfo)
        {
            try
            {
                PlatformInfo        = pInfo;
                PlatformDriver      = platformDriver;
                mApplicationPOMList = lstApplicationPOM;
                BusinessFlow        = bFlow;
                Context             = context;

                //if lstApplicationPOM == null then dont create POM or if applicationPOM.Name has some value then use the existing POM
                //or else create new POM
                if (mApplicationPOMList == null)
                {
                    LearnAdditionalDetails = false;
                    CreatePOM  = false;
                    CurrentPOM = null;
                }
                else
                {
                    LearnAdditionalDetails = true;
                    CreatePOM = true;
                    if (mApplicationPOMList.Count > 0)
                    {
                        CurrentPOM = mApplicationPOMList[0];
                    }
                    else
                    {
                        CurrentPOM = AddNewEmptyPOM("NewEmptyPOM");
                    }
                    ListPOMObjectHelper = new List <POMObjectRecordingHelper>();
                    foreach (var cPom in mApplicationPOMList)
                    {
                        ListPOMObjectHelper.Add(new POMObjectRecordingHelper()
                        {
                            PageTitle = cPom.Name, PageURL = cPom.PageURL, ApplicationPOM = cPom
                        });
                    }
                }

                PlatformDriver.ResetRecordingEventHandler();
                PlatformDriver.RecordingEvent += PlatformDriver_RecordingEvent;
            }
            catch (Exception ex)
            {
                Reporter.ToLog(eLogLevel.ERROR, "Error in Recording Manager while instantiating", ex);
            }
        }
Пример #56
0
        /// <summary>
        /// Copies <paramref name="record"/> and applies the changes in <paramref name="changeSet"/>.
        /// If there are no changes then <paramref name="record"/> is returned.
        /// </summary>
        /// <typeparam name="TRecord">The record type.</typeparam>
        /// <param name="changeSet"></param>
        /// <param name="record"></param>
        /// <returns>
        /// A copy of <paramref name="record"/> with changes or <paramref name="record"/> if there
        /// are no changes to apply.
        /// </returns>
        public static TRecord ToNewRecord <TRecord>(this IPropertyChangeSet <TRecord> changeSet, IRecord <TRecord> record)
        {
            // potentially unsafe cast?
            var original = (TRecord)record;

            if (changeSet.Mutators.Count > 0)
            {
                var copy = record.ShallowCopy();
                foreach (var mutator in changeSet.Mutators)
                {
                    mutator.ApplyMutation(original, copy);
                }

                record.ThrowIfConstraintsAreViolated(copy);

                return(copy);
            }
            else
            {
                return(original);
            }
        }
Пример #57
0
 public void Write(IRecord r)
 {
     r.Serialize(archive, "");
 }
Пример #58
0
 /// <summary>
 /// If there are changes in <paramref name="changeset"/> a copy is made and the changeset is
 /// applied to the copy.
 /// </summary>
 /// <typeparam name="TRecord">The record type.</typeparam>
 /// <param name="record"></param>
 /// <param name="changeset"></param>
 /// <returns>
 /// A copy of <paramref name="record"/> with changes or <paramref name="record"/> if there
 /// are no changes to apply.
 /// </returns>
 public static TRecord CopyAndApply <TRecord>(this IRecord <TRecord> record, IPropertyChangeSet <TRecord> changeset)
 {
     return(changeset.ToNewRecord(record));
 }
 /// <summary>
 /// Event called on record change.
 /// </summary>
 private void OnRecordChange(IRecord record) => SetupCounters();
Пример #60
0
 public void AppendRecord(IRecord record)
 {
     FileWriter.WriteLine(record.ValueComponentsString(Separator));
 }