Exemplo n.º 1
0
        public void Attach(Control parent)
        {
            IFrmTagGroup frm = parent.FindForm() as IFrmTagGroup;

            _tag               = TagManager.Instance.GetTag(Name, frm);
            _value             = _tag.Value;
            _tag.ValueChanged += new EventHandler(TagValueChanged);
        }
Exemplo n.º 2
0
        public ITag GetTag(string symbol, IFrmTagGroup tagGroup)
        {
            if (tagGroup == null || !symbol.StartsWith("@"))
            {
                return(GetTag(symbol));
            }

            ITag       returnedTag = null;
            XmlElement table       = tagGroup.TagGroup.DocumentElement;
            XmlNode    row         = table.SelectSingleNode(string.Format("/DocumentElement/TagGroup[Symbol = '{0}']", symbol));

            if (row != null)
            {
                foreach (XmlNode column in row.ChildNodes)
                {
                    if (column.Name == "Substitution")
                    {
                        returnedTag = GetTag(column.InnerText);
                    }
                }
            }
            return(returnedTag);
        }
Exemplo n.º 3
0
		public ITag GetTag(string symbol, IFrmTagGroup tagGroup)
		{
			if (tagGroup == null || !symbol.StartsWith("@"))
			{
				return GetTag(symbol);
			}
			
			ITag returnedTag = null;
			XmlElement table = tagGroup.TagGroup.DocumentElement;
			XmlNode row = table.SelectSingleNode(string.Format("/DocumentElement/TagGroup[Symbol = '{0}']", symbol));
			if (row != null)
			{
				foreach(XmlNode column in row.ChildNodes)
				{
					if (column.Name == "Substitution")
					{
						returnedTag = GetTag(column.InnerText);
					}
				}
			}
			return returnedTag;
		}
Exemplo n.º 4
0
        public object getResult(string Expression, IFrmTagGroup tagGroup)
        {
            try
            {
                //Identificando se a expressão possui expressões lógicas
                string _expression = "";

                string[] expressionSplited = split(Expression.Trim()
                                                   .Replace(" and ", "&")
                                                   .Replace(" And ", "&")
                                                   .Replace(" aNd ", "&")
                                                   .Replace(" anD ", "&")
                                                   .Replace(" ANd ", "&")
                                                   .Replace(" AnD ", "&")
                                                   .Replace(" aND ", "&")
                                                   .Replace(" AND ", "&")
                                                   .Replace("&&", "&")
                                                   .Replace(" or ", "|")
                                                   .Replace(" Or ", "|")
                                                   .Replace(" oR ", "|")
                                                   .Replace(" OR ", "|")
                                                   .Replace("||", "|")
                                                   .Replace("==", "=")
                                                   .Replace("<>", "!=")
                                                   .Replace("!=", "!")
                                                   .Replace(" ", "")
                                                   .ToCharArray());

                foreach (string s in expressionSplited)
                {
                    ITag tag;
                    if (tagGroup != null && s.StartsWith("@"))
                    {
                        tag = TagManager.Instance.GetTag(s, tagGroup.TagGroup);
                    }
                    else
                    {
                        tag = TagManager.Instance.GetTag(s);
                    }

                    //Caso a tag não seja encontrada
                    if (tag != null)
                    {
                        if (!_tagList.Contains(tag))
                        {
                            _tagList.Add(tag);
                            tag.ValueChanged += new EventHandler(tag_ValueChanged);
                        }
                        _expression = _expression + tag.Value;
                    }
                    else
                    {
                        _expression = _expression + s;
                    }
                }

                return(solveResult(_expression));
            }
            catch
            {
                try
                {
                    ITag tag;
                    if (tagGroup != null && Expression.StartsWith("@"))
                    {
                        tag = TagManager.Instance.GetTag(Expression, tagGroup.TagGroup);
                    }
                    else
                    {
                        tag = TagManager.Instance.GetTag(Expression);
                    }

                    //Caso a tag não seja encontrada
                    if (tag != null)
                    {
                        if (!_tagList.Contains(tag))
                        {
                            _tagList.Add(tag);
                            tag.ValueChanged += new EventHandler(tag_ValueChanged);
                        }
                        return(tag);
                    }
                    else
                    {
                        return(Expression);
                    }
                }
                catch
                {
                    return(Expression);
                }
            }
        }
Exemplo n.º 5
0
		public object getResult(string Expression, IFrmTagGroup tagGroup)
		{
			try
			{
				//Identificando se a expressão possui expressões lógicas
				string _expression = "";
				
				string[] expressionSplited = split(Expression.Trim()
				                                   .Replace(" and ","&")
				                                   .Replace(" And ","&")
				                                   .Replace(" aNd ","&")
				                                   .Replace(" anD ","&")
				                                   .Replace(" ANd ","&")
				                                   .Replace(" AnD ","&")
				                                   .Replace(" aND ","&")
				                                   .Replace(" AND ","&")
				                                   .Replace("&&","&")
				                                   .Replace(" or ","|")
				                                   .Replace(" Or ","|")
				                                   .Replace(" oR ","|")
				                                   .Replace(" OR ","|")
				                                   .Replace("||","|")
				                                   .Replace("==","=")
				                                   .Replace("<>","!=")
				                                   .Replace("!=","!")
				                                   .Replace(" ","")
				                                   .ToCharArray());
				
				foreach (string s in expressionSplited)
				{
					ITag tag;
					if (tagGroup != null && s.StartsWith("@"))
					{
						tag = TagManager.Instance.GetTag(s, tagGroup.TagGroup);
					}
					else
					{
						tag = TagManager.Instance.GetTag(s);
					}
					
					//Caso a tag não seja encontrada
					if (tag != null)
					{
						if (!_tagList.Contains(tag))
						{
							_tagList.Add(tag);
							tag.ValueChanged += new EventHandler(tag_ValueChanged);
						}
						_expression = _expression + tag.Value;
					}
					else
					{
						_expression = _expression + s;
					}
				}
				
				return solveResult (_expression);
			}
			catch
			{
				try
				{
					ITag tag;
					if (tagGroup != null && Expression.StartsWith("@"))
					{
						tag = TagManager.Instance.GetTag(Expression, tagGroup.TagGroup);
					}
					else
					{
						tag = TagManager.Instance.GetTag(Expression);
					}
					
					//Caso a tag não seja encontrada
					if (tag != null)
					{
						if (!_tagList.Contains(tag))
						{
							_tagList.Add(tag);
							tag.ValueChanged += new EventHandler(tag_ValueChanged);
						}
						return tag;
					}
					else
					{
						return Expression;
					}
				}
				catch
				{
					return Expression;
				}
			}
		}