Пример #1
0
        public string GetPropertyString(string propertyAlias)
        {
            string result = null;

            propertyProvider.UpdateValueIfPropertyPresent(propertyAlias, ref result);
            return(result);
        }
Пример #2
0
		private static void LoadDataFromPropertiesDictionary(Settings settings, IPropertyProvider fields)
		{
			int incomleteOrderLifetime = 360;
			string stringValue = null;
			if (fields.UpdateValueIfPropertyPresent("incompleteOrderLifetime", ref stringValue))
			{
				int.TryParse(stringValue, out incomleteOrderLifetime);
			}
			settings.IncompleteOrderLifetime = incomleteOrderLifetime;

			string property = null;
			fields.UpdateValueIfPropertyPresent("includingVat", ref property);
			settings.IncludingVat = property == "1" || property == "true";

			fields.UpdateValueIfPropertyPresent("lowercaseUrls", ref property);
			settings.UseLowercaseUrls = property == "1" || property == "true";
		}
Пример #3
0
        private static void LoadDataFromPropertiesDictionary(Settings settings, IPropertyProvider fields)
        {
            int    incomleteOrderLifetime = 360;
            string stringValue            = null;

            if (fields.UpdateValueIfPropertyPresent("incompleteOrderLifetime", ref stringValue))
            {
                int.TryParse(stringValue, out incomleteOrderLifetime);
            }
            settings.IncompleteOrderLifetime = incomleteOrderLifetime;

            string property = null;

            fields.UpdateValueIfPropertyPresent("includingVat", ref property);
            settings.IncludingVat = property == "1" || property == "true";

            fields.UpdateValueIfPropertyPresent("lowercaseUrls", ref property);
            settings.UseLowercaseUrls = property == "1" || property == "true";
        }
Пример #4
0
		///// <summary>
		///// Loads the data from examine.
		///// </summary>
		///// <param name="storeAlias">The store alias.</param>
		///// <param name="examineNode">The examine node.</param>
		///// <returns></returns>
		//protected virtual bool LoadDataFromExamine(string storeAlias, SearchResult examineNode = null)
		//{
		//	//Log.Instance.LogDebug( DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss.fff tt") + "LoadDataFromExamine::NodeBase start"); 
		//	bool logAtEnd = false;
		//	if (examineNode == null)
		//	{
		//		logAtEnd = true;
		//		examineNode = StoreHelper.GetNodeFromExamine(_nodeId);
		//	}
		//	if (examineNode == null)
		//	{
		//		return false;
		//	}

		//	LoadFieldsFromExamine(new DictionaryPropertyProvider(examineNode));

		//	//if (logAtEnd)
		//	//    Log.Instance.LogDebug(DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss.fff tt") + "END LoadDataFromExamine::NodeBase typealias:" + _nodeTypeAlias);
		//	return true;
		//}

		internal virtual void LoadFieldsFromExamine(IPropertyProvider fields)
		{
			string stringValue = null;
			if (_nodeId == 0 && fields.UpdateValueIfPropertyPresent("id", ref stringValue))
			{
				int.TryParse(stringValue, out _nodeId);
			}

			if (fields.UpdateValueIfPropertyPresent("parentID", ref stringValue))
			{
				int intVal;
				if (int.TryParse(stringValue, out intVal))
					_parentId = intVal;
			}

			if (fields.ContainsKey("sortOrder"))
			{
				string value = fields.GetStringValue("sortOrder");
				int sortOrder;
				if (Int32.TryParse(value, out sortOrder))
					_sortOrder = sortOrder;
			}
			//if (_nodeId == 0)
			//	_nodeId = GetIntValue("id", examineNode).GetValueOrDefault(); can't use multistore here!!!! -> vanwege Store (will cause endless loop)
			//_parentId = GetIntValue("parentID", examineNode);  can't use multistore here!!!! -> vanwege Store
			//_sortOrder = GetIntValue("sortOrder", examineNode); can't use multistore here!!!! -> vanwege Store

			if (fields.ContainsKey("nodeTypeAlias"))
			{
				_nodeTypeAlias = fields.GetStringValue("nodeTypeAlias");
			}
			if (fields.ContainsKey("nodeName"))
			{
				_nodeName = fields.GetStringValue("nodeName");
				if (_nodeName == string.Empty) throw new Exception("Node with empty name");
			}
			if (fields.ContainsKey("path"))
			{
				_path = fields.GetStringValue("path");
			}
			if (fields.ContainsKey("createDate"))
			{
				string value = fields.GetStringValue("createDate");
				DateTime date;
				if (DateTime.TryParse(value, out date)) // todo: use the right culture!
					_createDate = date;
			}
			if (fields.ContainsKey("updateDate"))
			{
				string value = fields.GetStringValue("updateDate");
				DateTime date;
				if (DateTime.TryParse(value, out date)) // todo: use the right culture!
					_updateDate = date;
			}
			if (fields.ContainsKey("urlName"))
			{
				_urlName = fields.GetStringValue("urlName");
			}
		}
Пример #5
0
        ///// <summary>
        ///// Loads the data from examine.
        ///// </summary>
        ///// <param name="storeAlias">The store alias.</param>
        ///// <param name="examineNode">The examine node.</param>
        ///// <returns></returns>
        //protected virtual bool LoadDataFromExamine(string storeAlias, SearchResult examineNode = null)
        //{
        //	//Log.Instance.LogDebug( DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss.fff tt") + "LoadDataFromExamine::NodeBase start");
        //	bool logAtEnd = false;
        //	if (examineNode == null)
        //	{
        //		logAtEnd = true;
        //		examineNode = StoreHelper.GetNodeFromExamine(_nodeId);
        //	}
        //	if (examineNode == null)
        //	{
        //		return false;
        //	}

        //	LoadFieldsFromExamine(new DictionaryPropertyProvider(examineNode));

        //	//if (logAtEnd)
        //	//    Log.Instance.LogDebug(DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss.fff tt") + "END LoadDataFromExamine::NodeBase typealias:" + _nodeTypeAlias);
        //	return true;
        //}

        internal virtual void LoadFieldsFromExamine(IPropertyProvider fields)
        {
            string stringValue = null;

            if (_nodeId == 0 && fields.UpdateValueIfPropertyPresent("id", ref stringValue))
            {
                int.TryParse(stringValue, out _nodeId);
            }

            if (fields.UpdateValueIfPropertyPresent("parentID", ref stringValue))
            {
                int intVal;
                if (int.TryParse(stringValue, out intVal))
                {
                    _parentId = intVal;
                }
            }

            if (fields.ContainsKey("sortOrder"))
            {
                string value = fields.GetStringValue("sortOrder");
                int    sortOrder;
                if (Int32.TryParse(value, out sortOrder))
                {
                    _sortOrder = sortOrder;
                }
            }
            //if (_nodeId == 0)
            //	_nodeId = GetIntValue("id", examineNode).GetValueOrDefault(); can't use multistore here!!!! -> vanwege Store (will cause endless loop)
            //_parentId = GetIntValue("parentID", examineNode);  can't use multistore here!!!! -> vanwege Store
            //_sortOrder = GetIntValue("sortOrder", examineNode); can't use multistore here!!!! -> vanwege Store

            if (fields.ContainsKey("nodeTypeAlias"))
            {
                _nodeTypeAlias = fields.GetStringValue("nodeTypeAlias");
            }
            if (fields.ContainsKey("nodeName"))
            {
                _nodeName = fields.GetStringValue("nodeName");
                if (_nodeName == string.Empty)
                {
                    throw new Exception("Node with empty name");
                }
            }
            if (fields.ContainsKey("path"))
            {
                _path = fields.GetStringValue("path");
            }
            if (fields.ContainsKey("createDate"))
            {
                string   value = fields.GetStringValue("createDate");
                DateTime date;
                if (DateTime.TryParse(value, out date))                 // todo: use the right culture!
                {
                    _createDate = date;
                }
            }
            if (fields.ContainsKey("updateDate"))
            {
                string   value = fields.GetStringValue("updateDate");
                DateTime date;
                if (DateTime.TryParse(value, out date))                 // todo: use the right culture!
                {
                    _updateDate = date;
                }
            }
            if (fields.ContainsKey("urlName"))
            {
                _urlName = fields.GetStringValue("urlName");
            }
        }