Пример #1
0
 public void AddRange(WorkflowStatePermissionCollection WorkflowStatePermissions)
 {
     foreach (WorkflowStatePermissionInfo permission in WorkflowStatePermissions)
     {
         Add(permission);
     }
 }
Пример #2
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        ///   FillWorkflowStatePermissionDictionary fills a Dictionary of WorkflowStatePermissions from a
        ///   dataReader.
        /// </summary>
        /// <param name = "dr">The IDataReader.</param>
        /// -----------------------------------------------------------------------------
        private static Dictionary <int, WorkflowStatePermissionCollection> FillWorkflowStatePermissionDictionary(IDataReader dr)
        {
            var dic = new Dictionary <int, WorkflowStatePermissionCollection>();

            try
            {
                WorkflowStatePermissionInfo obj = null;
                while (dr.Read())
                {
                    // fill business object
                    obj = CBO.FillObject <WorkflowStatePermissionInfo>(dr, false);

                    // add WorkflowState Permission to dictionary
                    if (dic.ContainsKey(obj.StateID))
                    {
                        // Add WorkflowStatePermission to WorkflowStatePermission Collection already in dictionary for StateId
                        dic[obj.StateID].Add(obj);
                    }
                    else
                    {
                        // Create new WorkflowStatePermission Collection for WorkflowStatePermissionID
                        var collection = new WorkflowStatePermissionCollection();

                        // Add Permission to Collection
                        collection.Add(obj);

                        // Add Collection to Dictionary
                        dic.Add(obj.StateID, collection);
                    }
                }
            }
            catch (Exception exc)
            {
                Exceptions.LogException(exc);
            }
            finally
            {
                // close datareader
                if (dr != null)
                {
                    dr.Close();
                }
            }

            return(dic);
        }
Пример #3
0
        public bool CompareTo(WorkflowStatePermissionCollection objWorkflowStatePermissionCollection)
        {
            if (objWorkflowStatePermissionCollection.Count != Count)
            {
                return(false);
            }
            InnerList.Sort(new CompareWorkflowStatePermissions());
            objWorkflowStatePermissionCollection.InnerList.Sort(new CompareWorkflowStatePermissions());

            for (int i = 0; i < Count; i++)
            {
                if (objWorkflowStatePermissionCollection[i].WorkflowStatePermissionID != this[i].WorkflowStatePermissionID || objWorkflowStatePermissionCollection[i].AllowAccess != this[i].AllowAccess)
                {
                    return(false);
                }
            }

            return(true);
        }
Пример #4
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        ///   GetWorkflowStatePermissions gets a WorkflowStatePermissionCollection
        /// </summary>
        /// <param name = "StateID">The ID of the State</param>
        /// -----------------------------------------------------------------------------
        public static WorkflowStatePermissionCollection GetWorkflowStatePermissions(int StateID)
        {
            bool bFound = false;

            //Get the WorkflowStatePermission Dictionary
            Dictionary <int, WorkflowStatePermissionCollection> dicWorkflowStatePermissions = GetWorkflowStatePermissions();

            //Get the Collection from the Dictionary
            WorkflowStatePermissionCollection WorkflowStatePermissions = null;

            bFound = dicWorkflowStatePermissions.TryGetValue(StateID, out WorkflowStatePermissions);

            if (!bFound)
            {
                //try the database
                WorkflowStatePermissions = new WorkflowStatePermissionCollection(CBO.FillCollection(provider.GetWorkflowStatePermissionsByStateID(StateID), typeof(WorkflowStatePermissionInfo)),
                                                                                 StateID);
            }

            return(WorkflowStatePermissions);
        }
Пример #5
0
 /// -----------------------------------------------------------------------------
 /// <summary>
 ///   HasWorkflowStatePermission checks whether the current user has a specific WorkflowState Permission
 /// </summary>
 /// <param name = "objWorkflowStatePermissions">The Permissions for the WorkflowState</param>
 /// <param name = "permissionKey">The Permission to check</param>
 /// -----------------------------------------------------------------------------
 public static bool HasWorkflowStatePermission(WorkflowStatePermissionCollection objWorkflowStatePermissions, string permissionKey)
 {
     return(PortalSecurity.IsInRoles(objWorkflowStatePermissions.ToString(permissionKey)));
 }
 public WorkflowStatePermissionCollection(WorkflowStatePermissionCollection WorkflowStatePermissions)
 {
     AddRange(WorkflowStatePermissions);
 }
        public bool CompareTo(WorkflowStatePermissionCollection objWorkflowStatePermissionCollection)
        {
            if (objWorkflowStatePermissionCollection.Count != Count)
            {
                return false;
            }
            InnerList.Sort(new CompareWorkflowStatePermissions());
            objWorkflowStatePermissionCollection.InnerList.Sort(new CompareWorkflowStatePermissions());

            for (int i = 0; i < Count; i++)
            {
                if (objWorkflowStatePermissionCollection[i].WorkflowStatePermissionID != this[i].WorkflowStatePermissionID || objWorkflowStatePermissionCollection[i].AllowAccess != this[i].AllowAccess)
                {
                    return false;
                }
            }

            return true;
        }
 public void AddRange(WorkflowStatePermissionCollection WorkflowStatePermissions)
 {
     foreach (WorkflowStatePermissionInfo permission in WorkflowStatePermissions)
     {
         Add(permission);
     }
 }
        /// -----------------------------------------------------------------------------
        /// <summary>
        ///   FillWorkflowStatePermissionDictionary fills a Dictionary of WorkflowStatePermissions from a
        ///   dataReader
        /// </summary>
        /// <param name = "dr">The IDataReader</param>
        /// <history>
        /// </history>
        /// -----------------------------------------------------------------------------
        private static Dictionary<int, WorkflowStatePermissionCollection> FillWorkflowStatePermissionDictionary(IDataReader dr)
        {
            var dic = new Dictionary<int, WorkflowStatePermissionCollection>();
            try
            {
                WorkflowStatePermissionInfo obj = null;
                while (dr.Read())
                {
                    // fill business object
                    obj = CBO.FillObject<WorkflowStatePermissionInfo>(dr, false);

                    // add WorkflowState Permission to dictionary
                    if (dic.ContainsKey(obj.StateID))
                    {
                        //Add WorkflowStatePermission to WorkflowStatePermission Collection already in dictionary for StateId
                        dic[obj.StateID].Add(obj);
                    }
                    else
                    {
                        //Create new WorkflowStatePermission Collection for WorkflowStatePermissionID
                        var collection = new WorkflowStatePermissionCollection();

                        //Add Permission to Collection
                        collection.Add(obj);

                        //Add Collection to Dictionary
                        dic.Add(obj.StateID, collection);
                    }
                }
            }
            catch (Exception exc)
            {
                Exceptions.LogException(exc);
            }
            finally
            {
                // close datareader
                if (dr != null)
                {
                    dr.Close();
                }
            }
            return dic;
        }
 /// -----------------------------------------------------------------------------
 /// <summary>
 ///   HasWorkflowStatePermission checks whether the current user has a specific WorkflowState Permission
 /// </summary>
 /// <param name = "objWorkflowStatePermissions">The Permissions for the WorkflowState</param>
 /// <param name = "permissionKey">The Permission to check</param>
 /// <history>
 /// </history>
 /// -----------------------------------------------------------------------------
 public static bool HasWorkflowStatePermission(WorkflowStatePermissionCollection objWorkflowStatePermissions, string permissionKey)
 {
     return PortalSecurity.IsInRoles(objWorkflowStatePermissions.ToString(permissionKey));
 }
        /// -----------------------------------------------------------------------------
        /// <summary>
        ///   GetWorkflowStatePermissions gets a WorkflowStatePermissionCollection
        /// </summary>
        /// <param name = "StateID">The ID of the State</param>
        /// <history>
        /// </history>
        /// -----------------------------------------------------------------------------
        public static WorkflowStatePermissionCollection GetWorkflowStatePermissions(int StateID)
        {
            bool bFound = false;

            //Get the WorkflowStatePermission Dictionary
            Dictionary<int, WorkflowStatePermissionCollection> dicWorkflowStatePermissions = GetWorkflowStatePermissions();

            //Get the Collection from the Dictionary
            WorkflowStatePermissionCollection WorkflowStatePermissions = null;
            bFound = dicWorkflowStatePermissions.TryGetValue(StateID, out WorkflowStatePermissions);

            if (!bFound)
            {
                //try the database
                WorkflowStatePermissions = new WorkflowStatePermissionCollection(CBO.FillCollection(provider.GetWorkflowStatePermissionsByStateID(StateID), typeof (WorkflowStatePermissionInfo)),
                                                                                 StateID);
            }

            return WorkflowStatePermissions;
        }
Пример #12
0
 public WorkflowStatePermissionCollection(WorkflowStatePermissionCollection WorkflowStatePermissions)
 {
     AddRange(WorkflowStatePermissions);
 }