コード例 #1
0
ファイル: PDMHelper.cs プロジェクト: jesfisher/gitstudy
        /// <summary>
        /// 【11】获取组名
        /// </summary>
        /// <returns>共有2列,Name和Code</returns>
        public static DataTable GetGroup()
        {
            DataTable dt = new DataTable();

            dt.Columns.Add("Name");
            dt.Columns.Add("Code");
            IEdmUserMgr7   UsrMgr;
            IEdmUserGroup8 mngmtGroup;

            if (vault == null)
            {
                vault = new EdmVault5();
            }
            if (!vault.IsLoggedIn)
            {
                vault.LoginAuto(VaultName, new Control().Handle.ToInt32());
            }
            UsrMgr = (IEdmUserMgr7)vault;

            //Traverse groups
            //string Groups = "";
            IEdmPos5 UserGroupPos = default(IEdmPos5);

            UserGroupPos = UsrMgr.GetFirstUserGroupPosition();
            while (!UserGroupPos.IsNull)
            {
                mngmtGroup = (IEdmUserGroup8)UsrMgr.GetNextUserGroup(UserGroupPos);
                //Groups = Groups + mngmtGroup.Name + "\n";
                DataRow dr = dt.NewRow();
                dr["Name"] = mngmtGroup.Name;
                dr["Code"] = mngmtGroup.ID;
                dt.Rows.Add(dr);
            }
            return(dt);
        }
コード例 #2
0
ファイル: PDMHelper.cs プロジェクト: jesfisher/gitstudy
        /// <summary>
        /// 【11.1】获取组成员
        /// </summary>
        /// <param name="GroupID">组ID</param>
        /// <returns>共有2列,ID/Name/FullName</returns>
        public static DataTable GetGroupMember(int GroupID)
        {
            DataTable dt = new DataTable();

            dt.Columns.Add("ID");
            dt.Columns.Add("Name");
            dt.Columns.Add("FullName");
            IEdmUserMgr7   UsrMgr;
            IEdmUserGroup8 mngmtGroup;
            IEdmUser9      user;
            IEdmPos5       UserPos = default(IEdmPos5);

            if (vault == null)
            {
                vault = new EdmVault5();
            }
            if (!vault.IsLoggedIn)
            {
                vault.LoginAuto(VaultName, new Control().Handle.ToInt32());
            }
            UsrMgr = (IEdmUserMgr7)vault;

            IEdmPos5 UserGroupPos = default(IEdmPos5);

            UserGroupPos = UsrMgr.GetFirstUserGroupPosition();
            while (!UserGroupPos.IsNull)
            {
                mngmtGroup = (IEdmUserGroup8)UsrMgr.GetNextUserGroup(UserGroupPos);
                if (mngmtGroup.ID == GroupID)
                {
                    UserPos = mngmtGroup.GetFirstUserPosition();
                    while (!UserPos.IsNull)
                    {
                        user = (IEdmUser9)mngmtGroup.GetNextUser(UserPos);
                        //Users = Users + " " + user.Name + "\n";
                        DataRow dr = dt.NewRow();
                        dr["ID"]       = user.ID;
                        dr["Name"]     = user.Name;
                        dr["FullName"] = user.FullName;
                        dt.Rows.Add(dr);
                    }
                }
            }
            return(dt);
        }