Exemplo n.º 1
0
        public int Add(WorkflowStatePermissionInfo value, bool checkForDuplicates)
        {
            int id = Null.NullInteger;

            if (!checkForDuplicates)
            {
                id = Add(value);
            }
            else
            {
                bool isMatch = false;
                foreach (PermissionInfoBase permission in List)
                {
                    if (permission.PermissionID == value.PermissionID && permission.UserID == value.UserID && permission.RoleID == value.RoleID)
                    {
                        isMatch = true;
                        break;
                    }
                }
                if (!isMatch)
                {
                    id = Add(value);
                }
            }
            return(id);
        }
 /// -----------------------------------------------------------------------------
 /// <summary>
 ///   AddWorkflowStatePermission adds a WorkflowState Permission to the Database
 /// </summary>
 /// <param name = "objWorkflowStatePermission">The WorkflowState Permission to add</param>
 /// <history>
 /// </history>
 /// -----------------------------------------------------------------------------
 public static int AddWorkflowStatePermission(WorkflowStatePermissionInfo objWorkflowStatePermission)
 {
     int Id = provider.AddWorkflowStatePermission(objWorkflowStatePermission.StateID,
                                                  objWorkflowStatePermission.PermissionID,
                                                  objWorkflowStatePermission.RoleID,
                                                  objWorkflowStatePermission.AllowAccess,
                                                  objWorkflowStatePermission.UserID,
                                                  UserController.GetCurrentUserInfo().UserID);
     ClearPermissionCache();
     return Id;
 }
 /// -----------------------------------------------------------------------------
 /// <summary>
 ///   UpdateWorkflowStatePermission updates a WorkflowState Permission in the Database
 /// </summary>
 /// <param name = "objWorkflowStatePermission">The WorkflowState Permission to update</param>
 /// <history>
 /// </history>
 /// -----------------------------------------------------------------------------
 public static void UpdateWorkflowStatePermission(WorkflowStatePermissionInfo objWorkflowStatePermission)
 {
     provider.UpdateWorkflowStatePermission(objWorkflowStatePermission.WorkflowStatePermissionID,
                                            objWorkflowStatePermission.StateID,
                                            objWorkflowStatePermission.PermissionID,
                                            objWorkflowStatePermission.RoleID,
                                            objWorkflowStatePermission.AllowAccess,
                                            objWorkflowStatePermission.UserID,
                                            UserController.GetCurrentUserInfo().UserID);
     ClearPermissionCache();
 }
        /// -----------------------------------------------------------------------------
        /// <summary>
        ///   AddWorkflowStatePermission adds a WorkflowState Permission to the Database
        /// </summary>
        /// <param name = "objWorkflowStatePermission">The WorkflowState Permission to add</param>
        /// <history>
        /// </history>
        /// -----------------------------------------------------------------------------
        public static int AddWorkflowStatePermission(WorkflowStatePermissionInfo objWorkflowStatePermission)
        {
            int Id = provider.AddWorkflowStatePermission(objWorkflowStatePermission.StateID,
                                                         objWorkflowStatePermission.PermissionID,
                                                         objWorkflowStatePermission.RoleID,
                                                         objWorkflowStatePermission.AllowAccess,
                                                         objWorkflowStatePermission.UserID,
                                                         UserController.GetCurrentUserInfo().UserID);

            ClearPermissionCache();
            return(Id);
        }
Exemplo n.º 5
0
 public bool Equals(WorkflowStatePermissionInfo other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return((AllowAccess == other.AllowAccess) && (StateID == other.StateID) && (RoleID == other.RoleID) && (PermissionID == other.PermissionID));
 }
Exemplo n.º 6
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);
        }
 public void Insert(int index, WorkflowStatePermissionInfo value)
 {
     List.Insert(index, value);
 }
 public int IndexOf(WorkflowStatePermissionInfo value)
 {
     return List.IndexOf(value);
 }
 public bool Contains(WorkflowStatePermissionInfo value)
 {
     return List.Contains(value);
 }
Exemplo n.º 10
0
 public int Add(WorkflowStatePermissionInfo value)
 {
     return(List.Add(value));
 }
 public int Add(WorkflowStatePermissionInfo value, bool checkForDuplicates)
 {
     int id = Null.NullInteger;
     if (!checkForDuplicates)
     {
         id = Add(value);
     }
     else
     {
         bool isMatch = false;
         foreach (PermissionInfoBase permission in List)
         {
             if (permission.PermissionID == value.PermissionID && permission.UserID == value.UserID && permission.RoleID == value.RoleID)
             {
                 isMatch = true;
                 break;
             }
         }
         if (!isMatch)
         {
             id = Add(value);
         }
     }
     return id;
 }
Exemplo n.º 12
0
 public int IndexOf(WorkflowStatePermissionInfo value)
 {
     return(List.IndexOf(value));
 }
Exemplo n.º 13
0
 public bool Contains(WorkflowStatePermissionInfo value)
 {
     return(List.Contains(value));
 }
Exemplo n.º 14
0
 public bool Equals(WorkflowStatePermissionInfo other)
 {
     if (ReferenceEquals(null, other))
     {
         return false;
     }
     if (ReferenceEquals(this, other))
     {
         return true;
     }
     return (AllowAccess == other.AllowAccess) && (StateID == other.StateID) && (RoleID == other.RoleID) && (PermissionID == other.PermissionID);
 }
 public void Remove(WorkflowStatePermissionInfo value)
 {
     List.Remove(value);
 }
 public int Add(WorkflowStatePermissionInfo value)
 {
     return List.Add(value);
 }
Exemplo n.º 17
0
 public void Insert(int index, WorkflowStatePermissionInfo value)
 {
     List.Insert(index, value);
 }
Exemplo n.º 18
0
 public void Remove(WorkflowStatePermissionInfo value)
 {
     List.Remove(value);
 }
 /// -----------------------------------------------------------------------------
 /// <summary>
 ///   UpdateWorkflowStatePermission updates a WorkflowState Permission in the Database
 /// </summary>
 /// <param name = "objWorkflowStatePermission">The WorkflowState Permission to update</param>
 /// <history>
 /// </history>
 /// -----------------------------------------------------------------------------
 public static void UpdateWorkflowStatePermission(WorkflowStatePermissionInfo objWorkflowStatePermission)
 {
     provider.UpdateWorkflowStatePermission(objWorkflowStatePermission.WorkflowStatePermissionID,
                                            objWorkflowStatePermission.StateID,
                                            objWorkflowStatePermission.PermissionID,
                                            objWorkflowStatePermission.RoleID,
                                            objWorkflowStatePermission.AllowAccess,
                                            objWorkflowStatePermission.UserID,
                                            UserController.GetCurrentUserInfo().UserID);
     ClearPermissionCache();
 }