Example #1
0
        private string GetValue(List<Capture> captures, Capture capture, Domain domain)
        {
            var lastCapture = captures.Where(x => x.Index < capture.Index).OrderByDescending(x => x.Index).FirstOrDefault();

            if ((lastCapture != null) && (lastCapture.Value.Equals("{")))
            {
                var childDomain = domain.GetChildDomain(capture.Value);

                if ((childDomain.GetType().Name.Contains("EntityDomain")) && (childDomain.ObjectValue != null))
                {
                    return childDomain.ObjectValue.ToString();
                }

                return (childDomain.Value ?? string.Empty).ToString();
            }

            return capture.Value;
        }
Example #2
0
        protected string GetChildDomainValue(string id, Domain domain)
        {
            var childDomain = domain.GetChildDomain(id);

            if (childDomain != null)
            {

                if (childDomain.GetType().Name.Contains("EntityDomain"))
                {
                    if (childDomain.ObjectValue != null)
                        return childDomain.ObjectValue.ToString();
                    else
                        return null;
                }

                return (childDomain.Value != null) ? childDomain.Value.ToString() : null;
            }

            return null;
        }
Example #3
0
        private static object GetValue(Range cell, Domain domain, InfoCell infoCell)
        {
            var childDomain = domain.GetChildDomain(infoCell.DomainId);

            if (childDomain != null)
            {
                SetFormat(cell, childDomain);

                if (childDomain.Value != null)
                {
                    if (childDomain is EntityDomain)
                    {
                        return childDomain.ObjectValue.ToString();
                    }
                    if (childDomain.Type.IsEnum)
                    {
                        return childDomain.Value.ToString();
                    }
                    if (childDomain.IsNumeric && childDomain.Format != null && childDomain.Value != null)
                        return string.Format(string.Concat("{0:", childDomain.Format.GetFirstExpressionFormat(childDomain), "}"), childDomain.Value);

                    return childDomain.Value;
                }
                if (childDomain.Format != null)
                {
                    var arrayList = new System.Collections.ArrayList(childDomain.Format.GetEvaluatedParameters(childDomain));
                    arrayList.Insert(0, !(childDomain is EntityDomain) ? childDomain.Value : string.Empty);
                    return string.Format(childDomain.Format.Expression, arrayList.ToArray());
                }
            }

            return string.Empty;
        }