Exemple #1
0
        public static SchemaObjectBase ToSchemaObject(this ClientSchemaObjectBase clientObj, bool validateID)
        {
            clientObj.NullCheck("clientObj");
            clientObj.SchemaType.CheckStringIsNullOrEmpty("SchemaType");

            var config             = SchemaDefine.GetSchemaConfig(clientObj.SchemaType);
            SchemaObjectBase scObj = (SchemaObjectBase)config.CreateInstance();

            scObj.ID = clientObj.ID;

            if (validateID && clientObj.ID.IsNullOrEmpty())
            {
                throw new InvalidOperationException("客户端对象ID不存在");
            }

            scObj.Status           = (SchemaObjectStatus)clientObj.Status;
            scObj.CreateDate       = clientObj.CreateDate;
            scObj.VersionStartTime = clientObj.VersionStartTime;
            scObj.VersionEndTime   = clientObj.VersionEndTime;

            scObj.Properties.CopyFrom(clientObj.Properties);

            if (clientObj.Creator != null)
            {
                scObj.Creator = (IUser)OguBase.CreateWrapperObject(clientObj.Creator.ID, SchemaType.Users);
            }

            return(scObj);
        }
Exemple #2
0
        public static void FillResult(this IEnumerable <IOguObject> objs, List <IOguObject> queryResult, UserGraphControlObjectMask listMask,
                                      Func <IOguObject, bool> filter = null, Action <IOguObject, IOguObject> addedAction = null)
        {
            objs.ForEach(obj =>
            {
                if (((int)obj.ObjectType & (int)listMask) != 0)
                {
                    bool canAdd = true;

                    if (filter != null)
                    {
                        canAdd = filter(obj);
                    }

                    if (canAdd)
                    {
                        IOguObject newObj = OguBase.CreateWrapperObject(obj);

                        if (addedAction != null)
                        {
                            addedAction(obj, newObj);
                        }

                        queryResult.Add(newObj);
                    }
                }
            }
                         );
        }
 private static void AddUserToList(IUser user, List <IUser> targetUsers)
 {
     if (OguBase.IsNotNullOrEmpty(user))
     {
         targetUsers.Add((IUser)OguBase.CreateWrapperObject(user));
     }
 }
Exemple #4
0
        /// <summary>
        /// 创建实体
        /// </summary>
        /// <returns></returns>
        private DynamicEntity creatEntity()
        {
            string entityId = Guid.NewGuid().ToString();

            var entity = new DynamicEntity
            {
                ID = entityId,
                //CodeName = "Entity1",
                Name        = "实体1",
                Description = "描述",
                CreateDate  = DateTime.Now,
                CategoryID  = "763DF7AB-4B69-469A-8A01-041DDEAB19F7",//已存在的分类编码
                Fields      = new DynamicEntityFieldCollection(),
                //OuterEntities = new OuterEntityCollection(),
                Creator = (IUser)OguBase.CreateWrapperObject(new OguUser("22c3b351-a713-49f2-8f06-6b888a280fff")),//wangli5
                SortNo  = 0
            };

            for (var i = 0; i < 1; i++)
            {
                var field = creatEntityField();
                entity.Fields.Add(field);
            }
            return(entity);
        }
Exemple #5
0
 protected override void DoValidate(object objectToValidate, object currentObject, string key, ValidationResults validateResults)
 {
     if (objectToValidate == null || OguBase.IsNullOrEmpty((IOguObject)objectToValidate))
     {
         RecordValidationResult(validateResults, this.MessageTemplate, currentObject, key);
     }
 }
        private void FillObjectToUsers(OguDataCollection <IUser> users, IOguObject obj)
        {
            OguBase wrappedObj = (OguBase)OguBase.CreateWrapperObject(obj);

            wrappedObj.FullPath = obj.FullPath;

            switch (obj.ObjectType)
            {
            case SchemaType.Users:
                if (users.Exists(u => string.Compare(u.ID, obj.ID, true) == 0) == false)
                {
                    users.Add((IUser)wrappedObj);
                }
                break;

            case SchemaType.Groups:
                IGroup group = (IGroup)wrappedObj;
                group.Members.ForEach(u =>
                {
                    if (users.Exists(ul => string.Compare(ul.ID, u.ID, true) == 0) == false)
                    {
                        users.Add(u);
                    }
                });
                break;

            case SchemaType.Organizations:
            case SchemaType.OrganizationsInRole:
                IOrganization dept = (IOrganization)obj;
                dept.Children.ForEach(o => FillObjectToUsers(users, o));
                break;
            }
        }
        private IEnumerable <IOguObject> groupControl_GetChildren(UserOUGraphControl treeControl, IOguObject parent)
        {
            IEnumerable <IOguObject> result = null;

            if (parent is IOrganization)
            {
                result = ((IOrganization)parent).Children;
            }
            else
            {
                List <IOguObject> resultList = new List <IOguObject>();

                if (parent is IGroup)
                {
                    foreach (IUser user in ((IGroup)parent).Members)
                    {
                        resultList.Add(OguBase.CreateWrapperObject(user));
                    }

                    result = resultList;
                }

                result = resultList;
            }

            return(result);
        }
        public IEnumerable <IOguObject> GetChildren(IOrganization parent)
        {
            SCObjectAndRelationCollection relations = SCSnapshotAdapter.Instance.QueryObjectAndRelationByParentIDs(SchemaInfo.FilterByCategory("Users", "Groups", "Organizations").ToSchemaNames(), new string[] { parent.ID }, false, true, false, DateTime.MinValue);

            relations.FillDetails();

            var parentList = SCSnapshotAdapter.Instance.LoadAllParentsInfo(true, parent.ID)[parent.ID];

            StringBuilder strB = new StringBuilder(parentList.Count * 15);

            for (int i = 0; i < parentList.Count; i++)
            {
                strB.Append(parentList[i].Name);
                strB.Append("");
            }

            var parentPath = strB.ToString();

            foreach (var item in relations)
            {
                OguBase ogu = (OguBase)item.Detail.ToPhantom();
                ogu.FullPath = parentPath + ogu.Name;

                yield return(ogu);
            }
        }
        protected void InnerGetDataSource(string sPrefix, int iCount, object context, ref IEnumerable result)
        {
            ServiceBrokerContext.Current.Timeout = QueryUserTimeout;

            IOrganization rootOrg = UserOUControlSettings.GetConfig().UserOUControlQuery.GetOrganizationByPath(this.RootPath);
            OguDataCollection <IOguObject> users = QueryChildrenBySelectMask(rootOrg, sPrefix);

            ArrayList arrList = new ArrayList();

            if (this.CanSelectRoot)
            {
                if (rootOrg.DisplayName.IndexOf(sPrefix) == 0)
                {
                    arrList.Add(OguBase.CreateWrapperObject(rootOrg));
                }
            }

            for (int i = 0; i < users.Count; i++)
            {
                //资源类型过滤
                IOguObject oguObject = OguBase.CreateWrapperObject(users[i]);

                if (this.SelectMask == UserControlObjectMask.All || (((int)this.SelectMask & (int)oguObject.ObjectType)) != 0)
                {
                    arrList.Add(oguObject);
                }
            }

            //修饰一下结果
            foreach (OguBase obj in arrList)
            {
                string path = string.Empty;
                if (obj.Parent != null)
                {
                    path = obj.Parent.FullPath;
                }

                if (path.IndexOf(rootOrg.FullPath) == 0)
                {
                    path = path.Substring(rootOrg.FullPath.Length);
                    path = path.Trim('\\');
                }

                if (obj is OguBase)
                {
                    // v-weirf changed : obj must be a OguBase to use Description
                    if (obj is IUser)
                    {
                        ((OguBase)obj).Description = string.Format("{0} {1}", ((IUser)obj).Occupation, path);
                    }
                    else if (obj is OguOrganization)
                    {
                        ((OguBase)obj).Description = path;
                    }
                }
            }

            result = arrList;
        }
        private static UserTask BuildOneUserTaskFromActivity(IWfActivity activity, TaskStatus status)
        {
            UserTask task = new UserTask();

            task.TaskID = UuidHelper.NewUuidString();

            task.ApplicationName = activity.Process.Descriptor.ApplicationName;
            task.ProgramName     = activity.Process.Descriptor.ProgramName;
            task.ResourceID      = activity.Process.ResourceID;
            task.ActivityID      = activity.ID;
            task.ProcessID       = activity.Process.ID;
            task.Status          = status;
            task.TaskStartTime   = activity.Process.StartTime;

            DateTime estimateEndTime = activity.Descriptor.Properties.GetValue("EstimateEndTime", DateTime.MinValue);

            if (estimateEndTime != DateTime.MinValue)
            {
                task.ExpireTime = estimateEndTime;
            }

            if (status == TaskStatus.Yue)
            {
                task.TaskTitle = GetNotifyTitle(activity);
            }

            if (string.IsNullOrEmpty(task.TaskTitle))
            {
                task.TaskTitle = GetTaskTitle(activity);
            }

            task.Level = TaskLevel.Normal;

            IWfProcess rootProcess = activity.Process.RootProcess;

            if (OguBase.IsNotNullOrEmpty(rootProcess.Creator))
            {
                task.DraftUserID   = rootProcess.Creator.ID;
                task.DraftUserName = rootProcess.Creator.DisplayName;
            }

            if (OguBase.IsNotNullOrEmpty(activity.Process.OwnerDepartment))
            {
                task.DraftDepartmentName = rootProcess.OwnerDepartment.GetDepartmentDescription();
            }

            if (DeluxePrincipal.IsAuthenticated)
            {
                task.SourceID   = DeluxeIdentity.CurrentUser.ID;
                task.SourceName = DeluxeIdentity.CurrentUser.DisplayName;
            }

            task.Url = GetTaskUrl(activity);

            AddTaskContextParameters(task);

            return(task);
        }
 protected void userInput_ObjectsLoaded(object sender, IEnumerable data)
 {
     foreach (OguBase obj in data)
     {
         if (obj.Parent != null)
         {
             obj.Tag = JSONSerializerExecute.Serialize(OguBase.CreateWrapperObject(obj.Parent));
         }
     }
 }
Exemple #12
0
        public static IOguObject ToOguObject(this WfClientOguObjectBase client)
        {
            OguBase result = null;

            if (client != null)
            {
                result             = (OguBase)OguBase.CreateWrapperObject(client.ID, client.ObjectType.ToOguSchemaType());
                result.Name        = client.Name;
                result.DisplayName = client.Name;
            }

            return(result);
        }
Exemple #13
0
        /// <summary>
        /// 创建外部实体
        /// </summary>
        /// <returns></returns>
        private OuterEntityField createOuterEntityField(string flag = "new")
        {
            var outerEntity = new OuterEntityField()
            {
                ID          = Guid.NewGuid().ToString(),
                Name        = "外部实体字段",
                Description = "描述" + flag,
                //CodeName = "OuterEntityField",
                Creator = (IUser)OguBase.CreateWrapperObject(new OguUser("22c3b351-a713-49f2-8f06-6b888a280fff")),//wangli5
            };

            return(outerEntity);
        }
Exemple #14
0
        private OguDataCollection <IOguObject> InnerCheckInputOuUser(string chkString)
        {
            //ServiceBrokerContext.Current.Timeout = QueryUserTimeout;

            IOrganization dept = OguMechanismFactory.GetMechanism().GetObjects <IOrganization>(SearchOUIDType.FullPath, OguPermissionSettings.GetConfig().RootOUPath)[0];

            OguDataCollection <IOguObject> users       = QueryChildrenBySelectMask(dept, chkString);
            OguDataCollection <IOguObject> forSelected = new OguDataCollection <IOguObject>();

            for (int i = 0; i < users.Count; i++)
            {
                forSelected.Add(OguBase.CreateWrapperObject(users[i]));
            }

            if (dept.DisplayName.IndexOf(chkString) == 0)
            {
                forSelected.Add(OguBase.CreateWrapperObject(dept));
            }

            IOrganization root = OguMechanismFactory.GetMechanism().GetRoot();

            foreach (OguBase obj in forSelected)
            {
                string path = string.Empty;
                if (obj.Parent != null)
                {
                    path = obj.Parent.FullPath;
                }

                if (path.IndexOf(root.FullPath) == 0)
                {
                    path = path.Substring(root.FullPath.Length);
                    path = path.Trim('\\');
                }

                if (obj is IUser)
                {
                    ((OguUser)obj).Description = string.Format("{0} {1}", ((OguUser)obj).Occupation, path);
                }
                else if (obj is OguOrganization)
                {
                    ((OguOrganization)obj).Description = path;
                }
                else
                {
                    ((OguUser)obj).Description = path;
                }
            }

            return(forSelected);
        }
Exemple #15
0
        public static WfClientOguObjectBase ToClientOguObject(this IOguObject oguObject)
        {
            WfClientOguObjectBase result = null;

            if (oguObject != null)
            {
                OguBase wrappedObj = (OguBase)OguBase.CreateWrapperObject(oguObject);

                string name = wrappedObj.IsNameInitialized() ? wrappedObj.Name : null;

                result = WfClientOguObjectBase.CreateWrapperObject(wrappedObj.ID, name, wrappedObj.ObjectType.ToClientOguSchemaType());
            }

            return(result);
        }
Exemple #16
0
        /// <summary>
        /// 创建实体字段
        /// </summary>
        /// <returns></returns>
        private DynamicEntityField creatEntityField(int sortNo, string flag = "new")
        {
            var field = new DynamicEntityField()
            {
                ID           = Guid.NewGuid().ToString(),
                Name         = string.Format("字段{0}", sortNo),
                Description  = "描述" + flag,
                Length       = 2,
                DefaultValue = "默认值",
                FieldType    = FieldTypeEnum.Decimal,
                Creator      = (IUser)OguBase.CreateWrapperObject(new OguUser("22c3b351-a713-49f2-8f06-6b888a280fff")),//wangli5
                SortNo       = sortNo
            };

            return(field);
        }
Exemple #17
0
        public override IDictionary <string, object> Serialize(object obj, JavaScriptSerializer serializer)
        {
            WfSimulationParameters simulationParameters = (WfSimulationParameters)obj;

            IDictionary <string, object> dictionary = new Dictionary <string, object>();

            DictionaryHelper.AddNonDefaultValue <string, object>(dictionary, "EnableServiceCall", simulationParameters.EnableServiceCall);
            dictionary.Add("Variables", simulationParameters.Variables);

            if (OguBase.IsNotNullOrEmpty(simulationParameters.Creator))
            {
                dictionary.Add("Creator", simulationParameters.Creator);
            }

            return(dictionary);
        }
Exemple #18
0
        public static IOguObject ToOguObject(this SCSimpleObject obj)
        {
            OguBase result = null;

            string     category   = SchemaDefine.GetSchemaConfig(obj.SchemaType).Category;
            SchemaType schemaType = SchemaExtensions.SchemaCategoryToOguSchemaType(category);

            if (schemaType != OGUPermission.SchemaType.Unspecified)
            {
                result             = (OguBase)OguBase.CreateWrapperObject(obj.ID, schemaType);
                result.Name        = obj.Name;
                result.DisplayName = obj.DisplayName;
            }

            return(result);
        }
        public void ConvertToPropertyValue(Type objectValueType, object objectValue, PropertyValue pv, object target)
        {
            CheckObjectValueType(objectValueType, objectValue);

            pv.Definition.EditorKey    = "OUUserInputPropertyEditor";
            pv.Definition.EditorParams = JSONSerializerExecute.Serialize(CreateEditorParams(objectValueType, objectValue));

            if (objectValue != null)
            {
                if (objectValue is IEnumerable == false)
                {
                    objectValue = OguBase.CreateWrapperObject((IOguObject)objectValue);
                }

                pv.StringValue = GetPropertyValue(objectValueType, objectValue);
            }
        }
        /// <summary>
        /// 创建实体字段
        /// </summary>
        /// <returns></returns>
        private static DynamicEntityField CreateEntityField(string flag = "new")
        {
            var field = new DynamicEntityField()
            {
                ID           = Guid.NewGuid().ToString(),
                Name         = "字段",
                Description  = "描述" + flag,
                Length       = 2,
                DefaultValue = "默认值",
                FieldType    = FieldTypeEnum.Decimal,
                //CodeName = "Field",
                Creator = (IUser)OguBase.CreateWrapperObject(new OguUser("22c3b351-a713-49f2-8f06-6b888a280fff")),//wangli5
                SortNo  = 0
            };

            return(field);
        }
Exemple #21
0
        protected override InsertSqlClauseBuilder PrepareInsertSqlBuilder(VersionedSchemaObjectBase obj, ORMappingItemCollection mapping)
        {
            VersionedSchemaObjectBase schemaObj = (VersionedSchemaObjectBase)obj;

            if (OguBase.IsNullOrEmpty(schemaObj.Creator))
            {
                if (DeluxePrincipal.IsAuthenticated)
                {
                    schemaObj.Creator = DeluxeIdentity.CurrentUser;
                }
            }

            InsertSqlClauseBuilder builder = base.PrepareInsertSqlBuilder(obj, mapping);

            builder.AppendItem("Data", obj.ToString());

            return(builder);
        }
Exemple #22
0
        private static void AssignUsers(List <AU.AURoleDisplayItem> items)
        {
            AU.AUCommon.DoDbAction(() =>
            {
                foreach (var item in items)
                {
                    var members = PC.Adapters.SCMemberRelationAdapter.Instance.LoadByContainerID(item.ID).FilterByStatus(PC.SchemaObjectStatusFilterTypes.Normal);

                    List <IUser> users = new List <IUser>();
                    foreach (var m in members)
                    {
                        users.Add((IUser)OguBase.CreateWrapperObject(new OguUser(m.ID)));
                    }

                    item.Users = users;
                }
            });
        }
        private void InitRootTreeNode()
        {
            IOrganization innerRoot = this.Root;

            ServiceBrokerContext.Current.SaveContextStates();

            try
            {
                if (ShowDeletedObjects)
                {
                    ServiceBrokerContext.Current.UseLocalCache       = false;
                    ServiceBrokerContext.Current.ListObjectCondition = ListObjectMask.All;
                }

                if (innerRoot == null)
                {
                    var tmpRootPath = this.RootPath;

                    if (string.IsNullOrEmpty(tmpRootPath))
                    {
                        tmpRootPath = OguPermissionSettings.GetConfig().RootOUPath;
                    }

                    innerRoot = UserOUControlSettings.GetConfig().UserOUControlQuery.GetOrganizationByPath(tmpRootPath); // OguMechanismFactory.GetMechanism().GetRoot();
                }

                DeluxeTreeNode rootNode = new DeluxeTreeNode();

                BindOguObjToTreeNode((IOrganization)OguBase.CreateWrapperObject(innerRoot), rootNode, MultiSelect, SelectMask);

                rootNodesData.Add(rootNode);

                if (RootExpanded)
                {
                    rootNode.ChildNodesLoadingType = ChildNodesLoadingTypeDefine.Normal;
                    rootNode.Expanded = true;
                    BindChildren(rootNode.Nodes, OnGetChildren(innerRoot), MultiSelect, ListMask, SelectMask);
                }
            }
            finally
            {
                ServiceBrokerContext.Current.RestoreSavedStates();
            }
        }
		private bool CanWithdraw()
		{
			bool result = false;

			if (CurrentProcess != null)
			{
				IWfActivity currentActivity = CurrentProcess.CurrentActivity;

				if (currentActivity != null)
				{
					//流程状态允许撤回
					result = CurrentProcess.CanWithdraw;

					if (result)
					{
						IWfActivity targetActivity = FindTargetActivity(currentActivity);

						//管理员可以撤回
						if (WfClientContext.Current.InAdminMode)
						{
							result = true;
						}
						else
						{
							//活动的属性设置可以撤回
							result = currentActivity.Descriptor.Properties.GetValue("AllowToBeWithdrawn", true) &&
								targetActivity.Descriptor.Properties.GetValue("AllowWithdraw", true);

							if (result)
							{
								//不是管理员,进行更严格的权限判断(前一个点的操作人是我)
								result = OguBase.IsNullOrEmpty(targetActivity.Operator) == false &&
												string.Compare(targetActivity.Operator.ID, WfClientContext.Current.User.ID, true) == 0;
							}
						}
					}
				}
			}

			return result;
		}
        public static void ExecuteReplace(ReplaceAssigneeHelperData rahd)
        {
            rahd.NullCheck("错误:传入参数为空");

            //取原始待办人
            IUser originalUser = (IUser)OguBase.CreateWrapperObject(rahd.OriginalUserID, SchemaType.Users);

            //取目的待办人
            List <IUser> targetUsers = new List <IUser>();

            foreach (string userID in rahd.TargetUsersID)
            {
                IUser targetUser = (IUser)OguBase.CreateWrapperObject(userID, SchemaType.Users);
                targetUsers.Add(targetUser);
            }

            //获取用户任务
            UserTaskCollection tasks = UserTaskAdapter.Instance.LoadUserTasks(
                build => build.AppendItem("TASK_GUID", rahd.TaskID, "="));

            (tasks.Count > 0).FalseThrow("指定的任务ID'{0}'不存在!", rahd.TaskID);

            //取出Activity
            string activityID = tasks[0].ActivityID;

            //待办人替换处理
            try
            {
                IWfProcess process = WfRuntime.GetProcessByActivityID(activityID);

                IWfActivity activity = process.Activities[activityID];

                //创建Executor并执行
                WfReplaceAssigneesExecutor replaceExec = new WfReplaceAssigneesExecutor(activity, activity,
                                                                                        originalUser, targetUsers);
                replaceExec.Execute();
            }
            catch
            {
            }
        }
        public static string CheckLockResultToMessage(DECheckLockResult checkResult)
        {
            checkResult.NullCheck("checkResult");

            StringBuilder strB = new StringBuilder();

            strB.AppendFormat("申请{0}失败。", EnumItemDescriptionAttribute.GetDescription(checkResult.Lock.LockType));

            if (OguBase.IsNotNullOrEmpty(checkResult.Lock.LockPerson))
            {
                strB.AppendFormat("正在由\"{0}\"执行\"{1}\"。", checkResult.Lock.LockPerson.DisplayName, checkResult.Lock.Description);
            }
            else
            {
                strB.AppendFormat("正在执行\"{0}\"", checkResult.Lock.Description);
            }

            strB.Append("请稍后再尝试。");

            return(strB.ToString());
        }
        /// <summary>
        /// 将ClenteState中的信息生成ClientState字符串
        /// </summary>
        /// <returns>ClientState字符串</returns>
        protected override string SaveClientState()
        {
            object[] foArray = new object[2];
            var      tmpRoot = UserOUControlSettings.GetConfig().UserOUControlQuery.GetOrganizationByPath(this.RootPath);

            if (tmpRoot != null)
            {
                this.foOUCtrl.Root = tmpRoot;
            }

            for (int i = 0; i < this.SelectedOuUserData.Count; i++)
            {
                this.SelectedOuUserData[i] = (IOguObject)OguBase.CreateWrapperObject(this.SelectedOuUserData[i]);
            }

            OccupyUserPresenceAddress(this.SelectedOuUserData);

            foArray[0] = this.SelectedOuUserData;
            foArray[1] = this.Text;

            return(JSONSerializerExecute.Serialize(foArray));
        }
Exemple #28
0
        public override InsertSqlClauseBuilder PrepareInsertSqlBuilder(VersionedSchemaObjectBase obj, ORMappingItemCollection mapping, string[] ignoreProperties)
        {
            InsertSqlClauseBuilder builder = new InsertSqlClauseBuilder();

            obj.SchemaToSqlClauseBuilder(this._ModeDefinition, builder);

            builder.AppendItem(GetPropertyFieldName("VersionStartTime", mapping), "@currentTime", "=", true);
            builder.AppendItem(GetPropertyFieldName("VersionEndTime", mapping), DBTimePointActionContext.MaxVersionEndTime);

            if (obj.CreateDate != DateTime.MinValue)
            {
                builder.AppendItem("CreateDate", obj.CreateDate);
            }

            if (OguBase.IsNotNullOrEmpty(obj.Creator))
            {
                builder.AppendItem("CreatorID", obj.Creator.ID);
                builder.AppendItem("CreatorName", obj.Creator.Name);
            }

            return(builder);
        }
Exemple #29
0
        /// <summary>
        /// 创建实体
        /// </summary>
        /// <returns></returns>
        private DynamicEntity creatChildEntity(string categoryID)
        {
            string entityId = Guid.NewGuid().ToString();

            var entity = new DynamicEntity
            {
                ID          = entityId,
                Name        = "行项目实体1",
                Description = "描述",
                CreateDate  = DateTime.Now,
                CategoryID  = categoryID,//已存在的分类编码
                Fields      = new DynamicEntityFieldCollection(),
                SortNo      = 0,
                Creator     = (IUser)OguBase.CreateWrapperObject(new OguUser("22c3b351-a713-49f2-8f06-6b888a280fff")),//wangli5
            };

            for (var i = 0; i < 2; i++)
            {
                var field = creatEntityField(i);
                entity.Fields.Add(field);
            }
            return(entity);
        }
        private OguDataCollection <IOguObject> CreateWrappedObjects(IEnumerable <IOguObject> objects)
        {
            OguDataCollection <IOguObject> wrappedObjects = new OguDataCollection <IOguObject>();

            OguDataCollection <IUser> usersNeedToGetPresence = new OguDataCollection <IUser>();

            foreach (IOguObject obj in objects)
            {
                if (this.EnableUserPresence && obj is IUser)
                {
                    usersNeedToGetPresence.Add((IUser)obj);
                }

                wrappedObjects.Add(OguBase.CreateWrapperObject(obj));
            }

            if (this.EnableUserPresence)
            {
                OccupyUserPresenceAddress(wrappedObjects, usersNeedToGetPresence);
            }

            return(wrappedObjects);
        }