当前位置: 首页>>代码示例>>C#>>正文


C# OCL.CanAddRecordingSessions方法代码示例

本文整理汇总了C#中OCL.CanAddRecordingSessions方法的典型用法代码示例。如果您正苦于以下问题:C# OCL.CanAddRecordingSessions方法的具体用法?C# OCL.CanAddRecordingSessions怎么用?C# OCL.CanAddRecordingSessions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OCL的用法示例。


在下文中一共展示了OCL.CanAddRecordingSessions方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddObjectToGroup

        internal bool AddObjectToGroup(OCL.User AccessingUser, object Obj, OCL.Group CurrentGroup, out string ErrorMessage)
        {
            ErrorMessage = "";
            OCL.User DefaultUser = (OCL.User)GetUnassignedObject(OCL.OysterUnassignedObjects.User);
            OCL.OysterObjectType OBT = OysterObjectType.None;
            int ObjectTypeId = 0;
            int ObjectId = 0;
            string sType = "Unknown Type";

            /// A User Object is handled differently because each user gets his own copy
            /// the Default Permissions.
            if(Obj is OCL.User)
            {
                if(!CurrentGroup.CanAddUsers(AccessingUser))
                    return false;
                return AddUser(AccessingUser,(OCL.User)Obj,CurrentGroup,out ErrorMessage,false);
            }
            else if(Obj is OCL.RecordingSession)
            {
                if(!CurrentGroup.CanAddRecordingSessions(AccessingUser))
                    return false;
                return AddRecordingSession(AccessingUser,(OCL.RecordingSession)Obj,CurrentGroup,out ErrorMessage,false);
            }
            else if(Obj is OCL.Scene)
            {
                if(!CurrentGroup.CanAddScenes(AccessingUser))
                    return false;
                return AddScene(AccessingUser,(OCL.Scene)Obj,CurrentGroup,out ErrorMessage,false);
            }
            else
            {
                if(!GetObjectInfo(Obj,out OBT,out ObjectId))
                {
                    ErrorMessage = "Unknown Obj type or is unsupported by this function.";
                    return false;
                }
            }
            ObjectTypeId = Convert.ToInt32(OBT);

            /// Check to make sure object is not already member of Group
            String sSQL = "SELECT * FROM tblGroupTokens WHERE UserId = " + DefaultUser.mvarID +
                " AND GroupId = " + CurrentGroup.mvarID + " AND ObjectTypeId = " + ObjectTypeId +
                " AND ObjectId = " + ObjectId;
            DataSet DS = RF.GetDataSet(sSQL);
            if(DS.Tables[0].Rows.Count > 0)
            {
                ErrorMessage = sType + " already exist in Group";
                return false;
            }

            /// Create a Token for this Object for Default User within this Group
            OCL.Permission DP = GetDefaultObjectPermission(CurrentGroup,DefaultUser,OBT); //This gets the Users Default
            if(!InsertPermission(CurrentGroup,DefaultUser,OBT,ObjectId,DP.IsVisible,
                DP.CanAdd,DP.CanEdit,DP.CanDelete,DP.IsUsable,
                DP.CanEditPermission,DP.CanSeePermission,
                    DP.CanAddObjectA,DP.CanEditObjectA,DP.CanDeleteObjectA,
                    DP.CanAddObjectB,DP.CanEditObjectB,DP.CanDeleteObjectB,
                AccessingUser.mvarID,false))
            {
                ErrorMessage = sType + " failed to be added to Group for unknown reason";
                return false;
            }

            /// Create a Token for this Object for each Existing User

            /// Each Existing user's access token will reflect their own personal
            /// default permissions for this object type

            sSQL = "SELECT DISTINCT UserId FROM tblGroupTokens WHERE GroupId = " + CurrentGroup.mvarID +
                " AND UserId <> " + DefaultUser.mvarID;

            DataSet DSUsers = RF.GetDataSet(sSQL);
            foreach(DataRow r in DSUsers.Tables[0].Rows)
            {
                //Get Default Permissions for this object
                int CurrentUserId = Convert.ToInt32(r["UserId"]);
                OCL.User LocalCurrentUser = GetUser(CurrentUserId);
                int CurrenObjectTypeId = Convert.ToInt32(OCL.OysterObjectType.User);
                int DefaultObjectId = DefaultUser.mvarID;
                sSQL = "SELECT IsDefault,IsVisible, CanAdd, CanEdit, CanDelete, IsUsable,CanEditPermissions,CanSeePermissions, " +
                    "CanAddObjectA,CanEditObjectA,CanDeleteObjectA, " +
                    "CanAddObjectB, CanEditObjectB,CanDeleteObjectB FROM tblGroupTokens" +
                    " WHERE GroupId = " + CurrentGroup.mvarID + " AND UserId = " + CurrentUserId +
                    " AND ObjectTypeId = " + CurrenObjectTypeId + " AND ObjectId = " + DefaultObjectId;

                DataRow DRPerm = RF.GetDataSet(sSQL).Tables[0].Rows[0];
                bool IsDefault = Convert.ToBoolean(DRPerm["IsDefault"]);
                bool IsVisible = Convert.ToBoolean(DRPerm["IsVisible"]);
                bool CanAdd = Convert.ToBoolean(DRPerm["CanAdd"]);
                bool CanEdit = Convert.ToBoolean(DRPerm["CanEdit"]);
                bool CanDelete = Convert.ToBoolean(DRPerm["CanDelete"]);
                bool IsUsable = Convert.ToBoolean(DRPerm["IsUsable"]);
                bool CanEditPermission = Convert.ToBoolean(DRPerm["CanEditPermissions"]);
                bool CanSeePermission = Convert.ToBoolean(DRPerm["CanSeePermissions"]);
                bool CanAddObjectA = Convert.ToBoolean(DRPerm["CanAddObjectA"]);
                bool CanEditObjectA = Convert.ToBoolean(DRPerm["CanEditObjectA"]);
                bool CanDeleteObjectA = Convert.ToBoolean(DRPerm["CanDeleteObjectA"]);
                bool CanAddObjectB = Convert.ToBoolean(DRPerm["CanAddObjectB"]);
                bool CanEditObjectB = Convert.ToBoolean(DRPerm["CanEditObjectB"]);
                bool CanDeleteObjectB = Convert.ToBoolean(DRPerm["CanDeleteObjectB"]);
//.........这里部分代码省略.........
开发者ID:CarverLab,项目名称:Oyster,代码行数:101,代码来源:Functions.cs


注:本文中的OCL.CanAddRecordingSessions方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。