示例#1
0
	    public TreeGridViewRenderer FillValuesInTreeGridViewRenderer(long id, string classname)
		{
			TreeGridViewRenderer treeGridViewRenderer = new TreeGridViewRenderer();
            try
            {

                object currObj = Db4oClient.Client.Ext().GetByID(id);
                Db4oClient.Client.Ext().Activate(currObj, 1);
                IReflectClass rclass = DataLayerCommon.ReflectClassForName(classname);
                IType type = ResolveType(rclass);
                treeGridViewRenderer.QualifiedName = rclass.GetName();
                treeGridViewRenderer.DisplayFieldName = AppendIDTo(type.FullName, id, type);
                treeGridViewRenderer.FieldName = type.FullName;
                treeGridViewRenderer.FieldValue = type.DisplayName;
                treeGridViewRenderer.FieldType = SetFieldType(type);
                treeGridViewRenderer.ReadOnlyStatus = true;
                treeGridViewRenderer.ObjectId = id;
                treeGridViewRenderer.ObjectType = type;
            }
            catch (Exception e)
            {
                LoggingHelper.HandleException(e);
            }
			
			return treeGridViewRenderer;
	    }
示例#2
0
		public ProxyTreeGridRenderer ConvertObject(TreeGridViewRenderer obj)
		{
			ProxyTreeGridRenderer proxy = null;
			if (obj != null)
			{
			    proxy = new ProxyTreeGridRenderer
			                {
			                    DisplayFieldName = obj.DisplayFieldName,
			                    fieldName = obj.FieldName,
			                    ObjectId = obj.ObjectId,
			                    QualifiedName = obj.QualifiedName,
			                    fieldValue = obj.FieldValue,
			                    fieldType = obj.FieldType
			                };

			    proxy.ObjectId = obj.ObjectId;
				proxy.readOnlyStatus = obj.ReadOnlyStatus;
				proxy.subObject = obj.SubObject;
				proxy.hasSubNode = obj.HasSubNode;
              
				if (obj.ObjectType != null)
					proxy.ObjectType = new ProxyType().CovertITypeToProxyType(obj.ObjectType  );
			}
			return proxy;
		}
示例#3
0
 private TreeGridViewRenderer FillValuesInTreeGridViewRenderer(IReflectField field, IType type, object value)
 {
     TreeGridViewRenderer treeGridViewRenderer = new TreeGridViewRenderer();
     treeGridViewRenderer.DisplayFieldName = field.GetName();
     treeGridViewRenderer.FieldName = field.GetName();
     treeGridViewRenderer.FieldValue = value != null ? value.ToString() : BusinessConstants.DB4OBJECTS_NULL;
     treeGridViewRenderer.FieldType = SetFieldType(type);
     treeGridViewRenderer.ReadOnlyStatus = readOnly;
     treeGridViewRenderer.ObjectType = type;
     treeGridViewRenderer.ObjectId = 0;
     return treeGridViewRenderer;
 }
示例#4
0
        private TreeGridViewRenderer PopulateTreeGridViewRenderer(object item, IType itemType)
        {
            TreeGridViewRenderer treeviewRenderer = new TreeGridViewRenderer();
            treeviewRenderer.DisplayFieldName = AppendIDTo(itemType.DisplayName, GetLocalID(item), itemType);
            treeviewRenderer.FieldName = itemType.FullName;
            treeviewRenderer.QualifiedName = DataLayerCommon.RemoveGFromClassName(container.Ext().Reflector().ForObject(item).GetName());
            treeviewRenderer.FieldValue = ClassNameFor(itemType.FullName);
            treeviewRenderer.FieldType = SetFieldType(itemType);
            treeviewRenderer.ReadOnlyStatus = true;
            treeviewRenderer.ObjectId = GetLocalID(item);
            treeviewRenderer.ObjectType = itemType;
            treeviewRenderer.HasSubNode = itemType.IsCollection || itemType.IsArray;
            if (treeviewRenderer.HasSubNode)
            {
                long longid = GetLocalID(itemType);
                if (itemType is GenericObject)
                    treeviewRenderer.ObjectId = longid;

                else if (longid != 0)
                    treeviewRenderer.ObjectId = longid;
                else
                {
                    treeviewRenderer.SubObject = item;
                }
            }
            return treeviewRenderer;
        }
示例#5
0
	    public List<TreeGridViewRenderer > CreateCollectionNode(IReflectField field, object ownerObject, int count)
		{
			try
			{
				TreeGridViewRenderer TreeviewRenderer = new TreeGridViewRenderer();
				TreeviewRenderer.DisplayFieldName = field.GetName() + " ( " + count + " items )";
			    TreeviewRenderer.FieldName = field.GetName();
                TreeviewRenderer.FieldType = field.GetName();
			    TreeviewRenderer.QualifiedName = field.GetFieldType().GetName();  
				TreeviewRenderer.ObjectId = 0;
				if (ownerObject != null)
				TreeviewRenderer.FieldValue = ownerObject.ToString();
				else
					TreeviewRenderer.FieldValue = BusinessConstants.DB4OBJECTS_NULL;
				if (count == 0)
					TreeviewRenderer.HasSubNode  = false;
				else
				{
					TreeviewRenderer.HasSubNode  = true;
					long id = GetLocalID(ownerObject);
					if (ownerObject is GenericObject || ownerObject is GenericArray )
						TreeviewRenderer.ObjectId = id;
					else
						if (id != 0)
							TreeviewRenderer.ObjectId = id;
						else
							TreeviewRenderer.SubObject = ownerObject;
				}
				IType type = ResolveFieldType(field);
				TreeviewRenderer.FieldType = SetFieldType(type );
				TreeviewRenderer.ObjectType = type;
				TreeviewRenderer.ReadOnlyStatus = true ;
				listTreeGridViewRenderers.Add(TreeviewRenderer);
				return listTreeGridViewRenderers;
			}
			catch (Exception oEx)
			{
				LoggingHelper.HandleException(oEx);
				return null;
			}
		}
示例#6
0
	    private void RenderSubObject(long id, IReflectField field)
		{
			try
			{
				object currObj = Db4oClient.Client.Ext().GetByID(id);
				object value = field.Get(currObj);
                 IType type = ResolveFieldType(field);
				if (value != null)
				{
					container.Ext().Activate(value, 1);
                    if(value.GetType().IsArray)
                    {
                        RenderArray(id, field);
                        return;
                    }
				}
                if (GetLocalID(value) == 0)
                {
                    CreateSimplePrimitiveNode(field, value, type);
                }
                else
                {


                   
                    TreeGridViewRenderer treeGridViewRenderer = new TreeGridViewRenderer();
                    treeGridViewRenderer.DisplayFieldName = AppendIDTo(field.GetName(), GetLocalID(value), type);
                    treeGridViewRenderer.FieldName = field.GetName();
                    treeGridViewRenderer.FieldValue = value != null ? type.FullName : BusinessConstants.DB4OBJECTS_NULL;
                    treeGridViewRenderer.QualifiedName = field.GetFieldType().GetName();
                    treeGridViewRenderer.FieldType = SetFieldType(type);
                    treeGridViewRenderer.ReadOnlyStatus = readOnly;
                    treeGridViewRenderer.ObjectId = GetLocalID(value);
                    treeGridViewRenderer.ObjectType = type;
                    treeGridViewRenderer.HasSubNode = type.IsCollection || type.IsArray;
                    if (treeGridViewRenderer.HasSubNode)
                    {
                        long longid = GetLocalID(value);
                        if (value is GenericObject)
                            treeGridViewRenderer.ObjectId = longid;

                        else if (longid != 0)
                            treeGridViewRenderer.ObjectId = longid;
                        else
                        {
                            treeGridViewRenderer.SubObject = value;
                        }
                    }
                    listTreeGridViewRenderers.Add(treeGridViewRenderer);
                    if (currObj is DictionaryEntry && field.GetName() == BusinessConstants.DB4OBJECTS_KEY)
                        treeGridViewRenderer.ReadOnlyStatus = true;
                    else if (currObj is DictionaryEntry && field.GetName() == BusinessConstants.DB4OBJECTS_VALUE)
                        treeGridViewRenderer.ReadOnlyStatus = readOnly;
                    else if (field.Get(currObj) == null)
                        treeGridViewRenderer.ReadOnlyStatus = true;
                    else
                        treeGridViewRenderer.ReadOnlyStatus = true;
                }

			}
			catch (Exception oEx)
			{
				LoggingHelper.HandleException(oEx);
			}
		}
示例#7
0
 private TreeGridViewRenderer PopulateDictItems(object displayData, string displayName, bool readonlystatus)
 {
     TreeGridViewRenderer treeviewRenderer = new TreeGridViewRenderer();
     treeviewRenderer.DisplayFieldName = displayName;
     treeviewRenderer.FieldValue = displayData.ToString();
     treeviewRenderer.FieldType = "System.Object";
     treeviewRenderer.ReadOnlyStatus = readonlystatus;
     treeviewRenderer.HasSubNode = displayData is GenericObject;
     if (treeviewRenderer.HasSubNode)
     {
         long id = GetLocalID(displayData);
         if (displayData is GenericObject)
             treeviewRenderer.ObjectId = id;
         else if (id != 0)
             treeviewRenderer.ObjectId = id;
         else
             treeviewRenderer.SubObject = displayData;
     }
     return treeviewRenderer;
 }
示例#8
0
        public List<TreeGridViewRenderer> PopulatePrimitiveValues(object currObj, string fieldType)
        {

            if (!String.IsNullOrEmpty(fieldType))
            {
                try
                {

                    TreeGridViewRenderer TreeviewRenderer = new TreeGridViewRenderer();
                    TreeviewRenderer.DisplayFieldName = fieldType;
                    TreeviewRenderer.FieldName = TreeviewRenderer.DisplayFieldName;
                    TreeviewRenderer.FieldValue = currObj.ToString();
                    TreeviewRenderer.QualifiedName =
                        DataLayerCommon.RemoveGFromClassName(container.Ext().Reflector().ForObject(currObj).GetName());
                    TreeviewRenderer.FieldType = fieldType;
                    TreeviewRenderer.ReadOnlyStatus = readOnly;
                    TreeviewRenderer.ObjectId = 0;
                    TreeviewRenderer.HasSubNode = false;
                    listTreeGridViewRenderers.Add(TreeviewRenderer);
                }
                catch (Exception oEx)
                {
                    LoggingHelper.HandleException(oEx);
                    return null;
                }
            }

            return listTreeGridViewRenderers;
        }