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 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;
            }
        }
Beispiel #3
0
        private OguDataCollection <IOguObject> QueryChildrenBySelectMask(IOrganization dept, string searchString)
        {
            ServiceBrokerContext.Current.SaveContextStates();
            var SelectMask    = UserControlObjectMask.All;
            var MaxQueryCount = 15;

            try
            {
                ServiceBrokerContext.Current.ListObjectCondition = ListObjectMask.All;

                OguDataCollection <IOguObject> result = new OguDataCollection <IOguObject>();

                if (SelectMask == UserControlObjectMask.Organization)
                {
                    OguObjectCollection <IOrganization> orgs = dept.QueryChildren <IOrganization>(searchString, true, SearchLevel.SubTree, MaxQueryCount);
                    foreach (IOrganization org in orgs)
                    {
                        result.Add(org);
                    }
                }
                else
                if (SelectMask == UserControlObjectMask.Group)
                {
                    OguObjectCollection <IGroup> groups = dept.QueryChildren <IGroup>(searchString, true, SearchLevel.SubTree, MaxQueryCount);
                    foreach (IOrganization group in groups)
                    {
                        result.Add(group);
                    }
                }
                else
                if (SelectMask == UserControlObjectMask.User || SelectMask == (UserControlObjectMask.User | UserControlObjectMask.Sideline))
                {
                    OguObjectCollection <IUser> users = dept.QueryChildren <IUser>(searchString, true, SearchLevel.SubTree, MaxQueryCount);
                    foreach (IUser user in users)
                    {
                        result.Add(user);
                    }
                }
                else
                {
                    if ((int)(SelectMask & (UserControlObjectMask.Group | UserControlObjectMask.User | UserControlObjectMask.Organization)) != 0)
                    {
                        OguObjectCollection <IOguObject> objs = dept.QueryChildren <IOguObject>(searchString, true, SearchLevel.SubTree, MaxQueryCount);

                        foreach (IOguObject obj in objs)
                        {
                            result.Add(obj);
                        }
                    }
                }

                return(result);
            }
            finally
            {
                ServiceBrokerContext.Current.RestoreSavedStates();
            }
        }
        private OguDataCollection <IOguObject> QueryChildrenBySelectMask(IOrganization dept, string searchString)
        {
            ServiceBrokerContext.Current.SaveContextStates();
            try
            {
                var queryImpl = UserOUControlSettings.GetConfig().UserOUControlQuery;

                ServiceBrokerContext.Current.ListObjectCondition = ShowDeletedObjects ? ListObjectMask.All : ListObjectMask.Common;

                OguDataCollection <IOguObject> result = new OguDataCollection <IOguObject>();

                if (SelectMask == UserControlObjectMask.Organization)
                {
                    OguObjectCollection <IOrganization> orgs = queryImpl.QueryDescendants <IOrganization>(SchemaQueryType.Organizations, dept, searchString, MaxQueryCount);  //dept.QueryChildren<IOrganization>(searchString, true, SearchLevel.SubTree, MaxQueryCount);
                    foreach (IOrganization org in orgs)
                    {
                        result.Add(org);
                    }
                }
                else
                if (SelectMask == UserControlObjectMask.Group)
                {
                    OguObjectCollection <IGroup> groups = queryImpl.QueryDescendants <IGroup>(SchemaQueryType.Groups, dept, searchString, MaxQueryCount);   // dept.QueryChildren<IGroup>(searchString, true, SearchLevel.SubTree, MaxQueryCount);
                    foreach (IGroup group in groups)
                    {
                        result.Add(group);
                    }
                }
                else
                if (SelectMask == UserControlObjectMask.User || SelectMask == (UserControlObjectMask.User | UserControlObjectMask.Sideline))
                {
                    OguObjectCollection <IUser> users = queryImpl.QueryDescendants <IUser>(SchemaQueryType.Groups, dept, searchString, MaxQueryCount);       //dept.QueryChildren<IUser>(searchString, true, SearchLevel.SubTree, MaxQueryCount);
                    foreach (IUser user in users)
                    {
                        result.Add(user);
                    }
                }
                else
                {
                    if ((int)(SelectMask & (UserControlObjectMask.Group | UserControlObjectMask.User | UserControlObjectMask.Organization)) != 0)
                    {
                        OguObjectCollection <IOguObject> objs = queryImpl.QueryDescendants <IOguObject>(SchemaQueryType.Users | SchemaQueryType.Groups | SchemaQueryType.Organizations, dept, searchString, MaxQueryCount);       //dept.QueryChildren<IOguObject>(searchString, true, SearchLevel.SubTree, MaxQueryCount);

                        foreach (IOguObject obj in objs)
                        {
                            result.Add(obj);
                        }
                    }
                }

                return(result);
            }
            finally
            {
                ServiceBrokerContext.Current.RestoreSavedStates();
            }
        }
		protected internal override void FillUsers(OguDataCollection<IUser> users)
		{
			IWfActivity target = TargetActivity;

			if (target != null)
			{
				//如果该环节存在操作人,则使用操作人。否则使用候选人
				if (OguUser.IsNotNullOrEmpty(target.Operator))
					users.Add(target.Operator);
				else
					target.Candidates.ForEach(a => users.Add(a.User));
			}
		}
Beispiel #6
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);
        }
Beispiel #7
0
        private static OguDataCollection <IUser> DeserializeUsers(IList objs)
        {
            Dictionary <string, IUser> userDict = new Dictionary <string, IUser>();

            for (int i = 0; i < objs.Count; i++)
            {
                IOguObject obj = (IOguObject)objs[i];

                if (obj is IGroup)
                {
                    foreach (IUser user in ((IGroup)obj).Members)
                    {
                        userDict[user.ID] = user;
                    }
                }
                else
                if (obj is IUser)
                {
                    IUser user = (IUser)obj;
                    userDict[user.ID] = user;
                }
            }

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

            foreach (KeyValuePair <string, IUser> kp in userDict)
            {
                users.Add(kp.Value);
            }

            return(users);
        }
		protected internal override void FillUsers(OguDataCollection<IUser> users)
		{
			IWfActivity target = TargetActivity;

			if (target != null)
				target.Assignees.ForEach(a => users.Add(a.User));
		}
Beispiel #9
0
        private void InitUserInput(Control container)
        {
            userInput.ID         = "userInput";
            userInput.SelectMask = UserControlObjectMask.User | UserControlObjectMask.Sideline;

            if (this.IsGetDataSourceEventHooked)
            {
                userInput.GetDataSource += OnGetDataSource;
            }

            if (this.IsValidateInputOuUserEventHooked)
            {
                userInput.ValidateInputOuUser += OnValidateInputOuUser;
            }

            if (this.Operation == "update")
            {
                OguDataCollection <IUser> users = CurrentActivityDescriptor.Resources.ToUsers();

                OguDataCollection <IOguObject> selectedObjs = new OguDataCollection <IOguObject>();

                users.ForEach(u => selectedObjs.Add(u));

                userInput.SelectedOuUserData = selectedObjs;
            }

            container.Controls.Add(userInput);
        }
		private static OguDataCollection<IUser> DeserializeUsers(IList objs)
		{
			Dictionary<string, IUser> userDict = new Dictionary<string, IUser>();

			for (int i = 0; i < objs.Count; i++)
			{
				IOguObject obj = (IOguObject)objs[i];

				if (obj is IGroup)
				{
					foreach (IUser user in ((IGroup)obj).Members)
					{
						userDict[user.ID] = user;
					}
				}
				else
					if (obj is IUser)
					{
						IUser user = (IUser)obj;
						userDict[user.ID] = user;
					}
			}

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

			foreach (KeyValuePair<string, IUser> kp in userDict)
			{
				users.Add(kp.Value);
			}

			return users;
		}
        private void InitUserInput(Control container)
        {
            userInput.ID                 = "userInput";
            userInput.SelectMask         = UserControlObjectMask.User | UserControlObjectMask.Sideline;
            userInput.ShowCirculateUsers = this.ShowCirculateUsers;

            if (CurrentActivityDescriptor != null)
            {
                userInput.MultiSelect = AllowMultiUsers;
            }

            if (this.Operation == "update")
            {
                OguDataCollection <IUser> users = CurrentActivityDescriptor.Resources.ToUsers();

                OguDataCollection <IOguObject> selectedObjs = new OguDataCollection <IOguObject>();

                users.ForEach(u => selectedObjs.Add(u));

                userInput.ConsignUsers = selectedObjs;

                OguDataCollection <IUser> circulators = WfVariableDefine.GetCirculateUsers(CurrentActivityDescriptor);

                selectedObjs = new OguDataCollection <IOguObject>();

                circulators.ForEach(u => selectedObjs.Add(u));

                userInput.Circulators = selectedObjs;
            }

            container.Controls.Add(userInput);
        }
 protected internal override void FillUsers(OguDataCollection <IUser> users)
 {
     if (this._User != null)
     {
         users.Add(this._User);
     }
 }
        protected internal override void FillUsers(OguDataCollection <IUser> users)
        {
            IWfActivity target = TargetActivity;

            if (target != null)
            {
                //如果该环节存在操作人,则使用操作人。否则使用候选人
                if (OguUser.IsNotNullOrEmpty(target.Operator))
                {
                    users.Add(target.Operator);
                }
                else
                {
                    target.Candidates.ForEach(a => users.Add(a.User));
                }
            }
        }
        private static Dictionary <string, object> PrepareBasicDictionary()
        {
            Dictionary <string, object> result = new Dictionary <string, object>();

            result.Add("Name", "Shen Zheng");
            result.Add("Age", (DateTime.Now.Year - 1972));
            result.Add("Salary", (Decimal)10000.00);
            result.Add("Birthday", new DateTime(1972, 4, 26));
            result.Add("IsMale", true);

            IUser user = OguMechanismFactory.GetMechanism().GetObjects <IUser>(SearchOUIDType.LogOnName, "wanhw").FirstOrDefault();

            result.Add("Owner", user);
            result.Add("OwnerDepartment", user.Parent);

            IGroup group = OguMechanismFactory.GetMechanism().GetObjects <IGroup>(SearchOUIDType.FullPath, "机构人员\\远洋地产\\全体党员").FirstOrDefault();

            result.Add("Group", group);

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

            multiUsers.Add(user);

            result.Add("MultiUsers", multiUsers);

            OguDataCollection <IOrganization> multiOrgs = new OguDataCollection <IOrganization>();

            multiOrgs.Add(user.Parent);

            result.Add("MultiOrgs", multiOrgs);

            OguDataCollection <IGroup> multiGroups = new OguDataCollection <IGroup>();

            multiGroups.Add(group);

            result.Add("MultiGroups", multiGroups);

            OguDataCollection <IOguObject> multiObjs = new OguDataCollection <IOguObject>();

            multiObjs.Add(user);
            multiObjs.Add(user.Parent);

            result.Add("MultiObjs", multiObjs);

            return(result);
        }
		protected internal override void FillUsers(OguDataCollection<OGUPermission.IUser> users)
		{
			if (this._Group != null)
			{
				OguObjectCollection<IUser> children = this._Group.Members;

				children.ForEach(u => users.Add(u));
			}
		}
		/// <summary>
		/// 得到用户的所有兼职信息的TopOU
		/// </summary>
		/// <returns></returns>
		public OguDataCollection<IOrganization> GetCurrentAllTopOUs()
		{
			OguDataCollection<IOrganization> result = new OguDataCollection<IOrganization>();

			foreach (IUser user in DeluxeIdentity.CurrentUser.AllRelativeUserInfo)
				result.Add(user.TopOU);

			return result;
		}
Beispiel #17
0
        protected internal override void FillUsers(OguDataCollection <IUser> users)
        {
            if (this._Department != null)
            {
                OguObjectCollection <IUser> children = this._Department.GetAllChildren <IUser>(true);

                children.ForEach(u => users.Add(u));
            }
        }
        protected internal override void FillUsers(OguDataCollection<IUser> users)
        {
            if (this._Department != null)
            {
                OguObjectCollection<IUser> children = this._Department.GetAllChildren<IUser>(true);

                children.ForEach(u => users.Add(u));
            }
        }
        protected internal override void FillUsers(OguDataCollection <OGUPermission.IUser> users)
        {
            if (this._Group != null)
            {
                OguObjectCollection <IUser> children = this._Group.Members;

                children.ForEach(u => users.Add(u));
            }
        }
Beispiel #20
0
        protected internal override void FillUsers(OguDataCollection <IUser> users)
        {
            IWfActivity target = TargetActivity;

            if (target != null)
            {
                target.Assignees.ForEach(a => users.Add(a.User));
            }
        }
 private static void FillAndDistinctUsers(IEnumerable <IUser> source, OguDataCollection <IUser> target)
 {
     foreach (IUser user in source)
     {
         if (target.Exists(u => string.Compare(u.ID, user.ID, true) == 0) == false)
         {
             target.Add(user);
         }
     }
 }
Beispiel #22
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;
        }
Beispiel #23
0
        protected void Page_Load(object sender, EventArgs e)
        {
			//if (!IsPostBack)
			//{
                OguUser user = new OguUser("80f4464f-e912-40c9-9502-c369a0d935ee");

                OguDataCollection<IOguObject> list = new OguDataCollection<IOguObject>();
                list.Add(user);

                this.OuUserInputControl1.SelectedOuUserData = list;
			//}
        }
Beispiel #24
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //if (!IsPostBack)
            //{
            OguUser user = new OguUser("80f4464f-e912-40c9-9502-c369a0d935ee");

            OguDataCollection <IOguObject> list = new OguDataCollection <IOguObject>();

            list.Add(user);

            this.OuUserInputControl1.SelectedOuUserData = list;
            //}
        }
		private static Dictionary<string, object> PrepareBasicDictionary()
		{
			Dictionary<string, object> result = new Dictionary<string, object>();

			result.Add("Name", "Shen Zheng");
			result.Add("Age", (DateTime.Now.Year - 1972));
			result.Add("Salary", (Decimal)10000.00);
			result.Add("Birthday", new DateTime(1972, 4, 26));
			result.Add("IsMale", true);

			IUser user = OguMechanismFactory.GetMechanism().GetObjects<IUser>(SearchOUIDType.LogOnName, "wanhw").FirstOrDefault();

			result.Add("Owner", user);
			result.Add("OwnerDepartment", user.Parent);

			IGroup group = OguMechanismFactory.GetMechanism().GetObjects<IGroup>(SearchOUIDType.FullPath, "机构人员\\远洋地产\\全体党员").FirstOrDefault();

			result.Add("Group", group);

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

			multiUsers.Add(user);

			result.Add("MultiUsers", multiUsers);

			OguDataCollection<IOrganization> multiOrgs = new OguDataCollection<IOrganization>();

			multiOrgs.Add(user.Parent);

			result.Add("MultiOrgs", multiOrgs);

			OguDataCollection<IGroup> multiGroups = new OguDataCollection<IGroup>();

			multiGroups.Add(group);

			result.Add("MultiGroups", multiGroups);

			OguDataCollection<IOguObject> multiObjs = new OguDataCollection<IOguObject>();

			multiObjs.Add(user);
			multiObjs.Add(user.Parent);

			result.Add("MultiObjs", multiObjs);

			return result;
		}
Beispiel #26
0
        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);
        }
        private void InitCirculateUserInput(Control container)
        {
            circulateUserInput.ID         = "circulateUserInput";
            circulateUserInput.SelectMask = UserControlObjectMask.User;

            if (CurrentActivityDescriptor != null)
            {
                circulateUserInput.MultiSelect = AllowMultiUsers;
            }

            if (this.Operation == "update")
            {
                OguDataCollection <IUser> users = WfVariableDefine.GetCirculateUsers(CurrentActivityDescriptor);

                OguDataCollection <IOguObject> selectedObjs = new OguDataCollection <IOguObject>();

                users.ForEach(u => selectedObjs.Add(u));

                circulateUserInput.SelectedOuUserData = selectedObjs;
            }

            container.Controls.Add(circulateUserInput);
        }
Beispiel #28
0
		public OguDataCollection<IUser> GetUsersFromSOARole(SOARolePropertiesQueryParamCollection qps)
		{
			SOARolePropertyRowCollection rows = null;
			OguDataCollection<IUser> users = new OguDataCollection<IUser>();
			var schemaRoleID = txtSchemaRoleID.Text;
			var roleRows = AU.Adapters.AUMatrixHelper.LoadSchemaRolePropertyRows(schemaRoleID);

			if (qps != null)
			{
				rows = roleRows.Query(qps);
			}

			foreach (SOARolePropertyRowUsers rowUsers in rows.GenerateRowsUsers())
			{
				foreach (IUser user in rowUsers.Users)
				{
					if (users.Contains(user) == false)
					{
						users.Add(user);
					}
				}
			}
			return users;
		}
Beispiel #29
0
        public OguDataCollection <IUser> GetUsersFromSOARole(SOARolePropertiesQueryParamCollection qps)
        {
            SOARolePropertyRowCollection rows  = null;
            OguDataCollection <IUser>    users = new OguDataCollection <IUser>();
            var schemaRoleID = txtSchemaRoleID.Text;
            var roleRows     = AU.Adapters.AUMatrixHelper.LoadSchemaRolePropertyRows(schemaRoleID);

            if (qps != null)
            {
                rows = roleRows.Query(qps);
            }

            foreach (SOARolePropertyRowUsers rowUsers in rows.GenerateRowsUsers())
            {
                foreach (IUser user in rowUsers.Users)
                {
                    if (users.Contains(user) == false)
                    {
                        users.Add(user);
                    }
                }
            }
            return(users);
        }
        protected internal override void FillUsers(OguDataCollection <IUser> users)
        {
            SOARoleContext.DoAction(this.PropertyDefinitions, this.ProcessInstance, (context) =>
            {
                SOARolePropertyRowCollection matchedRows = this.Rows.QueryWithoutCondition(context.QueryParams);

                matchedRows = matchedRows.ExtractMatrixRows();

                matchedRows = this.MergeExternalMatrix(matchedRows, context.QueryParams);

                matchedRows = matchedRows.FilterByConditionColumn();

                foreach (SOARolePropertyRowUsers rowUsers in matchedRows.GenerateRowsUsers())
                {
                    foreach (IUser user in rowUsers.Users)
                    {
                        if (users.Contains(user) == false)
                        {
                            users.Add(user);
                        }
                    }
                }
            });
        }
        private void InitUserInput(Control container)
        {
            userInput.ID         = "userInput";
            userInput.SelectMask = UserControlObjectMask.User | UserControlObjectMask.Sideline;

            if (CurrentActivityDescriptor != null)
            {
                userInput.MultiSelect = AllowMultiUsers;
            }

            if (this.Operation == "update")
            {
                OguDataCollection <IOguObject> selectedObjs = new OguDataCollection <IOguObject>();

                if (CurrentActivityDescriptor.Instance != null)
                {
                    CurrentActivityDescriptor.Instance.Candidates.ForEach(a => selectedObjs.Add(a.User));
                }

                userInput.SelectedOuUserData = selectedObjs;
            }

            container.Controls.Add(userInput);
        }
Beispiel #32
0
        /// <summary>
        /// 从矩阵中获得对象。这主要取决于上下文中的参数
        /// </summary>
        /// <returns></returns>
        public OguDataCollection<IOguObject> GetObjectsFromMatrix()
        {
            OguDataCollection<IOguObject> result = new OguDataCollection<IOguObject>();

            SOARoleContext context = SOARoleContext.Current;

            if (context != null && context.QueryParams.Count > 0)
            {
                SOARolePropertyRowCollection matchedRows = this.Rows.Query(context.QueryParams);

                matchedRows = matchedRows.ExtractMatrixRows();
                foreach (SOARolePropertyRowUsers rowUsers in matchedRows.GenerateRowsUsers())
                {
                    foreach (IUser user in rowUsers.Users)
                    {
                        if (result.Contains(user) == false)
                            result.Add(user);
                    }
                }
            }

            return result;
        }
        private OguDataCollection <IOguObject> InnerCheckInputOuUser(string chkString)
        {
            ServiceBrokerContext.Current.Timeout = QueryUserTimeout;

            IOrganization root = UserOUControlSettings.GetConfig().UserOUControlQuery.GetOrganizationByPath(this.RootPath);

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

            for (int i = 0; i < users.Count; i++)
            {
                if (((int)users[i].ObjectType & (int)this.SelectMask) != 0)
                {
                    forSelected.Add(OguBase.CreateWrapperObject(users[i]));
                }
            }

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

            //沈峥添加,修饰一下Description
            //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 OguBase)
                {
                    //v-weirf changed, for Description setable,obj must be OguBase
                    if (obj is IUser)
                    {
                        ((OguBase)obj).Description = string.Format("{0} {1}", ((IUser)obj).Occupation, path);
                    }
                    else if (obj is IOrganization)
                    {
                        ((OguBase)obj).Description = path;
                    }
                    else
                    {
                        ((OguBase)obj).Description = path;
                    }
                }
            }

            return(forSelected);
        }
		private void InitUserInput(Control container)
		{
			userInput.ID = "userInput";
			userInput.SelectMask = UserControlObjectMask.User | UserControlObjectMask.Sideline;

			if (this.IsGetDataSourceEventHooked)
				userInput.GetDataSource += OnGetDataSource;

			if (this.IsValidateInputOuUserEventHooked)
				userInput.ValidateInputOuUser += OnValidateInputOuUser;

			if (this.Operation == "update")
			{
				OguDataCollection<IUser> users = CurrentActivityDescriptor.Resources.ToUsers();

				OguDataCollection<IOguObject> selectedObjs = new OguDataCollection<IOguObject>();

				users.ForEach(u => selectedObjs.Add(u));

				userInput.SelectedOuUserData = selectedObjs;
			}

			container.Controls.Add(userInput);
		}
		private void InitCirculateUserInput(Control container)
		{
			circulateUserInput.ID = "circulateUserInput";
			circulateUserInput.SelectMask = UserControlObjectMask.User;

			if (CurrentActivityDescriptor != null)
				circulateUserInput.MultiSelect = AllowMultiUsers;

			if (this.Operation == "update")
			{
				OguDataCollection<IUser> users = WfVariableDefine.GetCirculateUsers(CurrentActivityDescriptor);

				OguDataCollection<IOguObject> selectedObjs = new OguDataCollection<IOguObject>();

				users.ForEach(u => selectedObjs.Add(u));

				circulateUserInput.SelectedOuUserData = selectedObjs;
			}

			container.Controls.Add(circulateUserInput);
		}
		private void InitUserInput(Control container)
		{
			userInput.ID = "userInput";
			userInput.SelectMask = UserControlObjectMask.User | UserControlObjectMask.Sideline;

			if (CurrentActivityDescriptor != null)
				userInput.MultiSelect = AllowMultiUsers;

			if (this.Operation == "update")
			{
				OguDataCollection<IOguObject> selectedObjs = new OguDataCollection<IOguObject>();

				if (CurrentActivityDescriptor.Instance != null)
					CurrentActivityDescriptor.Instance.Candidates.ForEach(a => selectedObjs.Add(a.User));

				userInput.SelectedOuUserData = selectedObjs;
			}

			container.Controls.Add(userInput);
		}
		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;
		}
		private OguDataCollection<IOguObject> QueryChildrenBySelectMask(IOrganization dept, string searchString)
		{
			ServiceBrokerContext.Current.SaveContextStates();
			try
			{
				var queryImpl = UserOUControlSettings.GetConfig().UserOUControlQuery;

				ServiceBrokerContext.Current.ListObjectCondition = ShowDeletedObjects ? ListObjectMask.All : ListObjectMask.Common;

				OguDataCollection<IOguObject> result = new OguDataCollection<IOguObject>();

				if (SelectMask == UserControlObjectMask.Organization)
				{
					OguObjectCollection<IOrganization> orgs = queryImpl.QueryDescendants<IOrganization>(SchemaQueryType.Organizations, dept, searchString, MaxQueryCount);  //dept.QueryChildren<IOrganization>(searchString, true, SearchLevel.SubTree, MaxQueryCount);
					foreach (IOrganization org in orgs)
						result.Add(org);
				}
				else
					if (SelectMask == UserControlObjectMask.Group)
					{
						OguObjectCollection<IGroup> groups = queryImpl.QueryDescendants<IGroup>(SchemaQueryType.Groups, dept, searchString, MaxQueryCount); // dept.QueryChildren<IGroup>(searchString, true, SearchLevel.SubTree, MaxQueryCount);
						foreach (IGroup group in groups)
							result.Add(group);
					}
					else
						if (SelectMask == UserControlObjectMask.User || SelectMask == (UserControlObjectMask.User | UserControlObjectMask.Sideline))
						{
							OguObjectCollection<IUser> users = queryImpl.QueryDescendants<IUser>(SchemaQueryType.Groups, dept, searchString, MaxQueryCount); //dept.QueryChildren<IUser>(searchString, true, SearchLevel.SubTree, MaxQueryCount);
							foreach (IUser user in users)
								result.Add(user);
						}
						else
						{
							if ((int)(SelectMask & (UserControlObjectMask.Group | UserControlObjectMask.User | UserControlObjectMask.Organization)) != 0)
							{
								OguObjectCollection<IOguObject> objs = queryImpl.QueryDescendants<IOguObject>(SchemaQueryType.Users | SchemaQueryType.Groups | SchemaQueryType.Organizations, dept, searchString, MaxQueryCount); //dept.QueryChildren<IOguObject>(searchString, true, SearchLevel.SubTree, MaxQueryCount);

								foreach (IOguObject obj in objs)
									result.Add(obj);
							}
						}

				return result;
			}
			finally
			{
				ServiceBrokerContext.Current.RestoreSavedStates();
			}
		}
 private static void FillAndDistinctUsers(IEnumerable<IUser> source, OguDataCollection<IUser> target)
 {
     foreach (IUser user in source)
     {
         if (target.Exists(u => string.Compare(u.ID, user.ID, true) == 0) == false)
             target.Add(user);
     }
 }
        protected internal override void FillUsers(OguDataCollection<IUser> users)
        {
            SOARoleContext.DoAction(this.PropertyDefinitions, this.ProcessInstance, (context) =>
            {
                SOARolePropertyRowCollection matchedRows = this.Rows.QueryWithoutCondition(context.QueryParams);

                matchedRows = matchedRows.ExtractMatrixRows();

                matchedRows = this.MergeExternalMatrix(matchedRows, context.QueryParams);

                matchedRows = matchedRows.FilterByConditionColumn();

                foreach (SOARolePropertyRowUsers rowUsers in matchedRows.GenerateRowsUsers())
                {
                    foreach (IUser user in rowUsers.Users)
                    {
                        if (users.Contains(user) == false)
                            users.Add(user);
                    }
                }
            });
        }
Beispiel #41
0
        private OguDataCollection<IOguObject> QueryChildrenBySelectMask(IOrganization dept, string searchString)
        {
            ServiceBrokerContext.Current.SaveContextStates();
            var SelectMask = UserControlObjectMask.All;
            var MaxQueryCount = 15;

            try
            {
                ServiceBrokerContext.Current.ListObjectCondition = ListObjectMask.All;

                OguDataCollection<IOguObject> result = new OguDataCollection<IOguObject>();

                if (SelectMask == UserControlObjectMask.Organization)
                {
                    OguObjectCollection<IOrganization> orgs = dept.QueryChildren<IOrganization>(searchString, true, SearchLevel.SubTree, MaxQueryCount);
                    foreach (IOrganization org in orgs)
                        result.Add(org);
                }
                else
                    if (SelectMask == UserControlObjectMask.Group)
                    {
                        OguObjectCollection<IGroup> groups = dept.QueryChildren<IGroup>(searchString, true, SearchLevel.SubTree, MaxQueryCount);
                        foreach (IOrganization group in groups)
                            result.Add(group);
                    }
                    else
                        if (SelectMask == UserControlObjectMask.User || SelectMask == (UserControlObjectMask.User | UserControlObjectMask.Sideline))
                        {
                            OguObjectCollection<IUser> users = dept.QueryChildren<IUser>(searchString, true, SearchLevel.SubTree, MaxQueryCount);
                            foreach (IUser user in users)
                                result.Add(user);
                        }
                        else
                        {
                            if ((int)(SelectMask & (UserControlObjectMask.Group | UserControlObjectMask.User | UserControlObjectMask.Organization)) != 0)
                            {
                                OguObjectCollection<IOguObject> objs = dept.QueryChildren<IOguObject>(searchString, true, SearchLevel.SubTree, MaxQueryCount);

                                foreach (IOguObject obj in objs)
                                    result.Add(obj);
                            }
                        }

                return result;
            }
            finally
            {
                ServiceBrokerContext.Current.RestoreSavedStates();
            }
        }
		private void InitUserInput(Control container)
		{
			userInput.ID = "userInput";
			userInput.SelectMask = UserControlObjectMask.User | UserControlObjectMask.Sideline;
			userInput.ShowCirculateUsers = this.ShowCirculateUsers;

			if (CurrentActivityDescriptor != null)
				userInput.MultiSelect = AllowMultiUsers;

			if (this.Operation == "update")
			{
				OguDataCollection<IUser> users = CurrentActivityDescriptor.Resources.ToUsers();

				OguDataCollection<IOguObject> selectedObjs = new OguDataCollection<IOguObject>();

				users.ForEach(u => selectedObjs.Add(u));

				userInput.ConsignUsers = selectedObjs;

				OguDataCollection<IUser> circulators = WfVariableDefine.GetCirculateUsers(CurrentActivityDescriptor);

				selectedObjs = new OguDataCollection<IOguObject>();

				circulators.ForEach(u => selectedObjs.Add(u));

				userInput.Circulators = selectedObjs;
			}

			container.Controls.Add(userInput);
		}
		private OguDataCollection<IOguObject> InnerCheckInputOuUser(string chkString)
		{
			ServiceBrokerContext.Current.Timeout = QueryUserTimeout;

			IOrganization root = UserOUControlSettings.GetConfig().UserOUControlQuery.GetOrganizationByPath(this.RootPath);

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

			for (int i = 0; i < users.Count; i++)
			{
				if (((int)users[i].ObjectType & (int)this.SelectMask) != 0)
				{
					forSelected.Add(OguBase.CreateWrapperObject(users[i]));
				}
			}

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

			//沈峥添加,修饰一下Description
			//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 OguBase)
				{
					//v-weirf changed, for Description setable,obj must be OguBase
					if (obj is IUser)
						((OguBase)obj).Description = string.Format("{0} {1}", ((IUser)obj).Occupation, path);
					else if (obj is IOrganization)
						((OguBase)obj).Description = path;
					else
						((OguBase)obj).Description = path;
				}
			}

			return forSelected;
		}