Пример #1
0
        private static string DoHandleDisplayables(CrudOperationData jsonObject, IList <IApplicationAttributeDisplayable> displayables)
        {
            var sb = new StringBuilder();

            foreach (var attributeDisplayable in displayables)
            {
                if (attributeDisplayable.Qualifier != null && attributeDisplayable.Qualifier.Contains(NoDescriptionQualifier) || attributeDisplayable.ShowExpression == "false")
                {
                    continue;
                }


                if (attributeDisplayable is IApplicationDisplayableContainer)
                {
                    continue;
                }

                if (!jsonObject.ContainsAttribute(attributeDisplayable.Attribute) && !jsonObject.ContainsAttribute("#" + attributeDisplayable.Attribute + "_label"))
                {
                    continue;
                }

                if (attributeDisplayable.Attribute == "assetattributes")
                {
                    HandleAssetAttributes(sb, (string)jsonObject.GetAttribute(attributeDisplayable.Attribute),
                                          attributeDisplayable);
                    continue;
                }



                if (attributeDisplayable.Attribute == "assetCommodities")
                {
                    HandleAssetCommodities(sb, (string)jsonObject.GetAttribute("#" + attributeDisplayable.Attribute + "_label"),
                                           attributeDisplayable);
                    continue;
                }


                var oldValue = GetValue(jsonObject, attributeDisplayable);
                oldValue = HandlePrePend(oldValue as string, attributeDisplayable);

                var newValue = LocateNewValue(attributeDisplayable.Attribute, jsonObject, displayables);
                newValue = HandlePrePend(newValue as string, attributeDisplayable);


                if (attributeDisplayable.Qualifier != null &&
                    attributeDisplayable.Qualifier.EndsWith(NewDescriptionQualifier))
                {
                    // we should ignore the old value label, if there´s a newValue present, since they will be combined
                    continue;
                }


                sb.AppendLine(AppendField(attributeDisplayable.Label, oldValue, newValue));
            }
            return(sb.ToString());
        }
Пример #2
0
        private static object GetValue(CrudOperationData jsonObject, IApplicationAttributeDisplayable attributeDisplayable)
        {
            string labelAttribute = "#" + attributeDisplayable.Attribute + "_label";

            if (jsonObject.ContainsAttribute(labelAttribute))
            {
                return(jsonObject.GetAttribute(labelAttribute));
            }
            if (attributeDisplayable.RendererType != null && attributeDisplayable.RendererType.Equals("upload"))
            {
                return(jsonObject.GetAttribute(attributeDisplayable.Attribute + "_path"));
            }
            return(jsonObject.GetAttribute(attributeDisplayable.Attribute));
        }
Пример #3
0
 public static bool IsIBMTicket(CrudOperationData datamap)
 {
     return(datamap.ContainsAttribute("ownergroup") &&
            datamap.GetAttribute("ownergroup") != null &&
            !datamap.GetAttribute("ownergroup").ToString().StartsWith("C-"));
 }