public ViewCounter(IData data, Dictionary<string, string> preValues)
        {
            _data = data;

            if (preValues != null)
            {
                if (preValues.ContainsKey("hideCounter"))
                    _hideCounter = (preValues["hideCounter"] == "1" ? true : false);

                if (preValues.ContainsKey("enableHistory"))
                    _enableHistory = (preValues["enableHistory"] == "1" ? true : false);

                if (preValues.ContainsKey("disableReset"))
                    _disableReset = (preValues["disableReset"] == "1" ? true : false);

                if (preValues.ContainsKey("category"))
                    _category = preValues["category"];
                else
                    _category = string.Empty;
            }

            int.TryParse(HttpContext.Current.Request["id"], out _nodeId);

            _currentViewCount = ViewCount.GetViewCount(_nodeId, _category);
        }
Exemple #2
0
        public static StateExpression<IData, IData[], IData> Create(IExpression arg, DataInteger lagOffset, IData argDefault)
        {
            //return new StateExpression<IData, Tuple<IData, IData>, IData>(
            //    (a) => new Tuple<IData, IData>(DataTypeUtil.GetDefaultFromDataType(arg.GetResultType()), a),
            //    delegate (Tuple<IData, IData> s, IData a) { s = new Tuple<IData, IData>(s.Item2, a); return s; },
            //    (s) => s.Item1,
            //    ConvertExpression.CreateData(arg)
            //    );

            return new StateExpression<IData, IData[], IData>(
                delegate (IData a)
                {
                    var s = new IData[lagOffset + 1];
                    for (int i = 0; i < lagOffset; i++)
                        s[i] = argDefault;
                    s[lagOffset] = a;
                    return s;
                },
                delegate (IData[] s, IData a)
                {
                    for (int i = 0; i < lagOffset; i++)
                        s[i] = s[i + 1];
                    s[lagOffset] = a;
                    return s;
                },
                (s) => s[0],
                ConvertExpression.CreateData(arg)
                );
        }
        public override IData Process(IData data)
        {
            DispatcherHelper.RunAsync(() =>
            {
                if (_dataStats.All(s => s.Type != data.GetType()))
                {
                    var stat = new Stat
                           {
                               Type = data.GetType(),
                               Count = 1
                           };
                    stat.Watch.Start();
                    DataStats.Add(stat);
                }
                else
                {
                    var stat = _dataStats.Single(s => s.Type == data.GetType());
                    stat.Fps = 1000.0 / stat.Watch.ElapsedMilliseconds;
                    stat.Watch.Restart();
                    stat.Count++;
                }
            });

            return data;
        }
        /// <exclude />
        public IData GetParent(IData data)
        {
            if (data == null) throw new ArgumentNullException("data");

            Entry entry = GetEntry(data.GetType());
            object propertyValue = entry.PropertyValueMethodInfo.Invoke(data, null);

            if (entry.PropertyValueMethodInfo.ReturnType == typeof(Guid))
            {
                if (Equals(propertyValue, Guid.Empty)) return null;
            }
            else
            {
                if (Equals(propertyValue, entry.NullValue)) return null;
            }

            using (DataScope dataScope = new DataScope(data.DataSourceId.DataScopeIdentifier))
            {
                List<object> queryResult = GetQueryResult(entry.ParentDataType, entry.ParentIdPropertyName, propertyValue);

                if (queryResult.Count == 0) throw new InvalidOperationException(string.Format("The parent of the type {0} with the id ({1}) value of {2} was not found", entry.ParentDataType, entry.ParentIdPropertyName, propertyValue));
                if (queryResult.Count > 1) throw new InvalidOperationException(string.Format("More than one parent of the type {0} with the id ({1}) value of {2} was found", entry.ParentDataType, entry.ParentIdPropertyName, propertyValue));

                return (IData)queryResult[0];
            }
        }
Exemple #5
0
        public List<State> Process(IData data)
        {
            var currentStates = GetPersistedOrInitial(data);

            bool allSet = true;
            foreach (var currentStateTemp in currentStates)
            {
                var currentState = currentStateTemp;

                currentState.Execute(data);

                RuleElement ruleElement = _rules.Select(x => x.GetRuleElement(currentState.GetType())).FirstOrDefault(x => x != null);
                if (ruleElement == null)
                    Debug.Fail("Should always have an event or machine will never stop processing");

                bool currentSet = (from FieldInfo fieldInfo in ruleElement.SourceEvents select (Event) fieldInfo.GetValue(currentState)).All(@event => @event.IsSet);
                if (!currentSet)
                {
                    allSet = false;
                }
            }

            if (allSet)
            {
                Rule rule = _rules.FirstOrDefault(r => r.RuleElements.Any(x => x.SourceType == currentStates.First().GetType()));
                var newStates = _stateFactory.GetStates().Where(x => rule.DestinationTypes.Any(dest => dest == x.GetType()));
                currentStates = newStates.ToList();
            }

            _persister.Set(data.Id, currentStates);

            return currentStates;
        }
 public static void DataTableDataAdd(DataTable Table, IData Data, string FName)
 {
     DataRow row = Table.NewRow();
     string str = "";
     if (Data.Status == DataStatus.Recept)
     {
         str = Resources.ResourceManager.GetString("CORE108");
         if (Data.UserFolder.Trim().Length > 0)
         {
             str = Data.UserFolder.Substring(6);
         }
     }
     else if (Data.Status == DataStatus.Sent)
     {
         str = Resources.ResourceManager.GetString("CORE109");
     }
     row["clFolder"] = str;
     row["clAirSea"] = UDataView.GetASType(Data);
     row["clJobCode"] = Data.JobCode;
     row["clOutCode"] = Data.OutCode;
     row["clInputNo"] = Data.Header.InputInfo;
     row["clJobInfo"] = Data.Header.Subject;
     row["clTimeStamp"] = Data.TimeStamp.ToString("dd/MM/yyyy HH:mm:ss", DateTimeFormatInfo.InvariantInfo);
     row["clFileName"] = FName;
     Table.Rows.Add(row);
 }
 private void StoreItemId(IData Data)
 {
     if (_data != null && _data.Value != null && !String.IsNullOrEmpty(_data.Value.ToString()))
     {
         int.TryParse(_data.Value.ToString(), out StoredItemId);
     }
 }
Exemple #8
0
        public Primitives.Container Create( IData data, Settings settings )
        {
            if( data == null )
            {
                throw new ArgumentNullException( "data" );
            }
            if( settings == null )
            {
                throw new ArgumentNullException( "settings" );
            }

            Primitives.Container container = new Primitives.Container();

            Primitives.BoundsMarker bounds = new Primitives.BoundsMarker( new Types.Rectangle( 0, 0, settings.Width, settings.Height ) );

            bounds.Style.Add( "GraphContainer" );

            container.AddBack( bounds );

            double minVertData = double.MaxValue;
            double maxVertData = double.MinValue;

            for( int i = 0; i < data.RowCount; ++i )
            {
                for( int j = 0; j < data.ColumnCount; ++j )
                {
                    double v = data[i, j];

                    minVertData = Math.Min( minVertData, v );
                    maxVertData = Math.Max( maxVertData, v );
                }
            }

            return container;
        }
Exemple #9
0
 private DataEntityToken(string serializedDataSourceId)
 {
     _data = null;
     _dataInitialized = false;
     _serializedDataSourceId = serializedDataSourceId;
     _dataSourceId = null;
 }
 public static int CalculateDataSize(string name, IData value)
 {
     var dataSize = ClientMessage.HeaderSize;
     dataSize += ParameterUtil.CalculateDataSize(name);
     dataSize += ParameterUtil.CalculateDataSize(value);
     return dataSize;
 }
Exemple #11
0
 private static void DebugData(IData data)
 {
     foreach (var a in data.Data)
     {
         Console.WriteLine(Resources.Program_Main__0_____1_, a.Value, a.Count);
     }
 }
		public OrderStatusSectionDataEditor(IData data)
		{
			_data = data;
			_orderOverview = new OrderOverview();
			_orderOverview.OnOrderSelected += orderGuid =>
				{
					try
					{
						Guid guid;
						Guid.TryParse(orderGuid, out guid);
						if (guid == Guid.Empty)
						{
							Log.Instance.LogError("Trying to open an order with a broken guid: " + orderGuid);
							return;
						}
						API.CMS.CreateOrderDocument(guid);
					}
					catch (Exception ex)
					{
						Log.Instance.LogError(ex, "When opening order");
					}
				};
			if (int.TryParse(HttpContext.Current.Request["id"], out _containingDocumentId))
			{
				// !Page.IsPostBack && werkt niet
				//var orderSection = string.Empty;
				//var property = new Document(_containingDocumentId).getProperty("orderSection");
				//if (property != null)
				//	orderSection = property.Value.ToString();
				//_orderOverview.SetStatusFilter(orderSection);  dit kan niet, geeft raar effect na wisselen
			}
		}
Exemple #13
0
 public static RecvData CreateRecvData(IData data)
 {
     RecvData data2;
     data2.ResultData = null;
     data2.OtherData = null;
     data2.MData = null;
     if (data.Header.DataType == "M")
     {
         data2.MData = data;
         data2.ResultData = (IData) data.Clone();
         if (data2.ResultData.ItemCount > 1)
         {
             data2.ResultData.Items.RemoveRange(1, data2.ResultData.ItemCount - 1);
         }
         data2.ResultData.Header.DataType = "R";
         data2.ResultData.Header.Div = "000";
         data2.ResultData.Header.EndFlag = " ";
         data2.ResultData.CalcLength();
         data2.OtherData = (IData) data.Clone();
         data2.OtherData.Items.RemoveAt(0);
         data2.OtherData.Header.DataType = "C";
         data2.OtherData.Header.Div = "001";
         data2.OtherData.Header.EndFlag = "E";
         data2.OtherData.CalcLength();
         return data2;
     }
     if (data.Header.DataType == "R")
     {
         data2.ResultData = data;
         return data2;
     }
     data2.OtherData = data;
     return data2;
 }
Exemple #14
0
        public override void BuildDefaultData(IData data)
        {
            base.BuildDefaultData(data);

            data[DataElements.Pan] = 0.0;
            data[DataElements.Tilt] = 0.0;
        }
        public bool OnAfterBuildNew(IData data)
        {
            ILocalizedControlled localizedData = data as ILocalizedControlled;
            if (localizedData != null)
            {
                if (!LocalizationScopeManager.IsEmpty)
                {
                    localizedData.SourceCultureName = LocalizationScopeManager.CurrentLocalizationScope.Name;
                }
                else
                {
                    CultureInfo cultureInfo = null;

                    if (UserValidationFacade.IsLoggedIn())
                    {
                        cultureInfo = UserSettings.ActiveLocaleCultureInfo;
                    }

                    if (cultureInfo == null)
                    {
                        cultureInfo = DataLocalizationFacade.DefaultLocalizationCulture;
                    }

                    if (cultureInfo != null)
                    {
                        localizedData.SourceCultureName = cultureInfo.Name;
                    }
                }
            }

            return false;
        }
 public static ClientMessage EncodeRequest(string name, long startSequence, int minCount, int maxCount,
     IData filter)
 {
     var requiredDataSize = RequestParameters.CalculateDataSize(name, startSequence, minCount, maxCount, filter);
     var clientMessage = ClientMessage.CreateForEncode(requiredDataSize);
     clientMessage.SetMessageType((int) RequestType);
     clientMessage.SetRetryable(Retryable);
     clientMessage.Set(name);
     clientMessage.Set(startSequence);
     clientMessage.Set(minCount);
     clientMessage.Set(maxCount);
     bool filter_isNull;
     if (filter == null)
     {
         filter_isNull = true;
         clientMessage.Set(filter_isNull);
     }
     else
     {
         filter_isNull = false;
         clientMessage.Set(filter_isNull);
         clientMessage.Set(filter);
     }
     clientMessage.UpdateFrameLength();
     return clientMessage;
 }
Exemple #17
0
        public DataEditor(IData Data, SortedList Prevalues)
        {
            _data = (cms.businesslogic.datatype.DefaultData)Data;

            if (Prevalues["group"] != null)
                _group = Prevalues["group"].ToString();
        }
 public static int CalculateDataSize(string name, IData key)
 {
     int dataSize = ClientMessage.HeaderSize;
     dataSize += ParameterUtil.CalculateDataSize(name);
     dataSize += ParameterUtil.CalculateDataSize(key);
     return dataSize;
 }
        public IData GetParent(IData data)
        {
            IData parent = null;
            if (data is IMediaFile)
            {
                IMediaFile file = (IMediaFile)data;

                parent = (from item in DataFacade.GetData<IMediaFileFolder>()
                          where item.Path == file.FolderPath && item.StoreId == file.StoreId
                          select item).FirstOrDefault();

            }
            else if (data is IMediaFileFolder)
            {
                IMediaFileFolder folder = (IMediaFileFolder)data;

                int lastIndex = folder.Path.LastIndexOf('/');
                if(lastIndex == 0)
                {
                    return null;
                }

                string parentPath = folder.Path.Substring(0, lastIndex);
                parent = (from item in DataFacade.GetData<IMediaFileFolder>()
                          where item.Path == parentPath && item.StoreId == folder.StoreId
                          select item).FirstOrDefault();
            }
            else
            {
                throw new ArgumentException("Must be either of type IMediaFile or IMediaFileFolder", "data");
            }

            return parent;
        }
 public static int CalculateDataSize(string name, int overflowPolicy, IData value)
 {
     int dataSize = ClientMessage.HeaderSize;
     dataSize += ParameterUtil.CalculateDataSize(name);
     dataSize += Bits.IntSizeInBytes;
     dataSize += ParameterUtil.CalculateDataSize(value);
     return dataSize;
 }
 private IData GetKey()
 {
     if (key == null)
     {
         key = ToData(GetName());
     }
     return key;
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="DataEditor"/> class.
        /// </summary>
        /// <param name="data">The data.</param>
        /// <param name="settings">The settings.</param>
        /// <param name="dataTypeDefinitionId">The data type definition id.</param>
        /// <param name="instanceId">The instance id.</param>
        public DataEditor(IData data, PreValueEditorSettings settings, int dataTypeDefinitionId, string instanceId)
        {
            this.settings = settings;
            this.data = data;

            this.dataTypeDefinitionId = dataTypeDefinitionId;
            this.instanceId = instanceId;
        }
Exemple #23
0
 public override void Execute(IData data)
 {
     if (App.Worker.Value >= 15)
     {
         Debug.WriteLine("Reached15");
         Reached15.Set();
     }
 }
 public static int CalculateDataSize(string name, IData key, long threadId)
 {
     var dataSize = ClientMessage.HeaderSize;
     dataSize += ParameterUtil.CalculateDataSize(name);
     dataSize += ParameterUtil.CalculateDataSize(key);
     dataSize += Bits.LongSizeInBytes;
     return dataSize;
 }
Exemple #25
0
	private static void PrintData(IData data)
	{
		data.Note = "abc";

		Console.WriteLine("data : {0}, {1}, {2}, {3}", data.Id, data.Name, data.Note, data.Point);
	
		Console.WriteLine("msg : {0}", data.GetMessage("1"));
	}
        public PaceFormPresenter(IPaceForm view, IData data)
        {
            _data = data;
              _view = view;

              _view.SaveChangesButtonClick += (s, e) => OnSaveButtonClick();
              _view.DiscardChangesButtonClick += (s, e) => _view.Close();
        }
 public ProgramController(IData data)
 {
     _contentManager = new ContentManager(data);
     _paginationManager = new PaginationManager(data);
     _programManager = new ProgramManager(data);
     _robotManager = new RobotManager(data);
     _commandManager = new CommandManager(data);
 }
 public void SetDataFromIData(IData source)
 {
     if (source != null)
     {
         foreach (var kvp in source)
             this.sharedData[kvp.Key] = kvp.Value;
     }
 }
 public static int CalculateDataSize(string name, IData value, long timeoutMillis)
 {
     var dataSize = ClientMessage.HeaderSize;
     dataSize += ParameterUtil.CalculateDataSize(name);
     dataSize += ParameterUtil.CalculateDataSize(value);
     dataSize += Bits.LongSizeInBytes;
     return dataSize;
 }
Exemple #30
0
 public override void Execute(IData data)
 {
     if (App.Worker.Value == 20)
     {
         Debug.WriteLine("Reached20");
         Reached20.Set();
     }
 }
Exemple #31
0
 public FindPrevCommand(IData key, KeyValuePair <IData, IData>?keyValue)
     : base(CommandCode.FIND_PREV, key, keyValue)
 {
 }
Exemple #32
0
 public ReplaceCommand(IData key, IData record)
 {
     Key    = key;
     Record = record;
 }
Exemple #33
0
 public TryGetCommand(IData key, IData record)
     : base(CommandCode.TRY_GET, key, record)
 {
 }
Exemple #34
0
 public FindNextCommand(IData key)
     : this(key, null)
 {
 }
Exemple #35
0
 public FindAfterCommand(IData key)
     : this(key, null)
 {
 }
Exemple #36
0
 public ACCFitness(IData data)
 {
     Data = data;
 }
Exemple #37
0
 public FindPrevCommand(IData key)
     : this(key, null)
 {
 }
Exemple #38
0
 public DeleteRangeCommand(IData fromKey, IData toKey)
 {
     FromKey = fromKey;
     ToKey   = toKey;
 }
Exemple #39
0
 public TryGetCommand(IData key)
     : this(key, null)
 {
 }
Exemple #40
0
 public BackwardCommand(int pageCount, IData from, IData to, List <KeyValuePair <IData, IData> > list)
     : base(CommandCode.BACKWARD, pageCount, from, to, list)
 {
 }
Exemple #41
0
 public FindBeforeCommand(IData key)
     : this(key, null)
 {
 }
Exemple #42
0
 public FindBeforeCommand(IData key, KeyValuePair <IData, IData>?keyValue)
     : base(CommandCode.FIND_BEFORE, key, keyValue)
 {
 }
Exemple #43
0
 public SVN(IData data)
 {
     _data = data;
 }
Exemple #44
0
 public static ResourceHandle GetForeignIcon(this IData data)
 {
     return(data.IsTranslatable() ? DataGhostedIcon : DataDisabledIcon);
 }
        public static ClientMessage EncodeRequest(string name, Guid txnId, long threadId, IData key)
        {
            var clientMessage = new ClientMessage
            {
                IsRetryable   = false,
                OperationName = "TransactionalMultiMap.Get"
            };
            var initialFrame = new Frame(new byte[RequestInitialFrameSize], (FrameFlags)ClientMessageFlags.Unfragmented);

            initialFrame.Bytes.WriteIntL(Messaging.FrameFields.Offset.MessageType, RequestMessageType);
            initialFrame.Bytes.WriteIntL(Messaging.FrameFields.Offset.PartitionId, -1);
            initialFrame.Bytes.WriteGuidL(RequestTxnIdFieldOffset, txnId);
            initialFrame.Bytes.WriteLongL(RequestThreadIdFieldOffset, threadId);
            clientMessage.Append(initialFrame);
            StringCodec.Encode(clientMessage, name);
            DataCodec.Encode(clientMessage, key);
            return(clientMessage);
        }
 public CityController(IData data, IHostingEnvironment environment)
 {
     _data        = data;
     _environment = environment;
     _data.CityInitializeData();
 }
Exemple #47
0
 public static int CalculateDataSize(IData data)
 {
     return(CalculateDataSize(data.ToByteArray()));
 }
Exemple #48
0
 public static bool IsLocaleDisabled(this IData data)
 {
     return(!IsTranslatable(data));
 }
 public CoachesController(IData <Coach> dataCoach, IData <Club> dataClub, IData <CoachClub> dataCoachClub)
 {
     _dataCoach     = dataCoach;
     _dataClub      = dataClub;
     _dataCoachClub = dataCoachClub;
 }
Exemple #50
0
 public FindAfterCommand(IData key, KeyValuePair <IData, IData>?keyValue)
     : base(CommandCode.FIND_AFTER, key, keyValue)
 {
 }
 /// <summary>
 /// Initializes a new instance of XPathCheckBoxListDataEditor
 /// </summary>
 /// <param name="data"></param>
 /// <param name="options"></param>
 internal XPathDropDownListDataEditor(IData data, XPathDropDownListOptions options)
 {
     this.m_Data    = data;
     this.m_Options = options;
 }
Exemple #52
0
        public static ClientMessage EncodeEntryEvent(IData key, IData @value, IData oldValue, IData mergingValue, int eventType, Guid uuid, int numberOfAffectedEntries)
        {
            var clientMessage = new ClientMessage();
            var initialFrame  = new Frame(new byte[EventEntryInitialFrameSize], (FrameFlags)ClientMessageFlags.Unfragmented);

            initialFrame.Bytes.WriteIntL(Messaging.FrameFields.Offset.MessageType, EventEntryMessageType);
            initialFrame.Bytes.WriteIntL(Messaging.FrameFields.Offset.PartitionId, -1);
            initialFrame.Bytes.WriteIntL(EventEntryEventTypeFieldOffset, eventType);
            initialFrame.Bytes.WriteGuidL(EventEntryUuidFieldOffset, uuid);
            initialFrame.Bytes.WriteIntL(EventEntryNumberOfAffectedEntriesFieldOffset, numberOfAffectedEntries);
            clientMessage.Append(initialFrame);
            clientMessage.Flags |= ClientMessageFlags.Event;
            CodecUtil.EncodeNullable(clientMessage, key, DataCodec.Encode);
            CodecUtil.EncodeNullable(clientMessage, @value, DataCodec.Encode);
            CodecUtil.EncodeNullable(clientMessage, oldValue, DataCodec.Encode);
            CodecUtil.EncodeNullable(clientMessage, mergingValue, DataCodec.Encode);
            return(clientMessage);
        }
Exemple #53
0
 public FlowSequence(IData value) : base(value)
 {
     type = TYPE_SEQUENCE;
 }
Exemple #54
0
 public FindNextCommand(IData key, KeyValuePair <IData, IData>?keyValue)
     : base(CommandCode.FIND_NEXT, key, keyValue)
 {
 }
Exemple #55
0
 public InsertOrIgnoreCommand(IData key, IData record)
 {
     Key    = key;
     Record = record;
 }
Exemple #56
0
 public PsychologistLogic(IData <Psychologist> repository, IData <MedicalCondition> repositoryMedicalCondition)
 {
     _repository = repository;
     _repositoryMedicalCondition = repositoryMedicalCondition;
 }
Exemple #57
0
 public CreateBusCommand(IData data, ITravellerFactory factory)
 {
     this.data    = data;
     this.factory = factory;
 }
 public AdministratorLogic(IData <Administrator> repository)
 {
     repositoryAdministrator = repository;
 }
Exemple #59
0
 public DeleteCommand(IData key)
 {
     Key = key;
 }
Exemple #60
0
 void IEnumerator.Reset()
 {
     _nextIndex = 0;
     _current   = null;
 }