Пример #1
0
        public List <WorkflowGroupPermission> GetAllWorkflowGroupPermissionsByGroupID(int workflowGroupID)
        {
            List <WorkflowGroupPermission> listCollection = new List <WorkflowGroupPermission>();

            if (workflowGroupID > 0)
            {
                DataTable dataItems = ExecuteDataTable("spr_GetAllPermissionsByGroupID", workflowGroupID);

                if (dataItems != null)
                {
                    for (int i = 0; i < dataItems.Rows.Count; i++)
                    {
                        WorkflowGroupPermission item = new WorkflowGroupPermission();

                        item.WorkflowGroupRecID = dataItems.Rows[i].Field <int>("WorkflowGroupRecID");

                        item.WorkflowGroupID   = dataItems.Rows[i].Field <int>("WorkflowGroupID");
                        item.WorkflowGroupName = dataItems.Rows[i].Field <string>("WorkflowGroupName");

                        item.PermissionID   = dataItems.Rows[i].Field <int>("PermissionID");
                        item.PermissionName = dataItems.Rows[i].Field <string>("PermissionName");

                        listCollection.Add(item);
                    }
                }
                else
                {
                    throw new Exception("You cannot create a Workflow Group Permission collection from a null data table.");
                }
            }
            return(listCollection);
        }
Пример #2
0
 public void Delete(WorkflowGroupPermission workflowGroupPermission)
 {
     if (base.ValidateKeyField(workflowGroupPermission.WorkflowGroupRecID))
     {
         try
         {
             ExecuteNonQuery("spr_DeleteWorkflowGroupPermission", workflowGroupPermission.WorkflowGroupRecID);
         }
         catch (Exception ex)
         {
             HandleException(ex);
         }
     }
 }
Пример #3
0
        //Workflow Group Permission

        #region General CRUD Methods

        public long Add(WorkflowGroupPermission workflowGroupPermission)
        {
            long      returnCode     = -1;
            DbCommand commandWrapper = GetDbCommand("spr_AddWorkflowGroupPermission");

            try
            {
                SqlParameter returnParam = new SqlParameter("@WorkflowGroupRecID", SqlDbType.Int);
                returnParam.Direction = ParameterDirection.Output;

                commandWrapper.Parameters.Add(returnParam);

                if (workflowGroupPermission.WorkflowGroupRecID == -1)
                {
                    commandWrapper.Parameters.Add(new SqlParameter("@WorkflowGroupRecID", DBNull.Value));
                }
                else
                {
                    commandWrapper.Parameters.Add(new SqlParameter("@WorkflowGroupRecID", workflowGroupPermission.WorkflowGroupRecID));
                }

                if (workflowGroupPermission.WorkflowGroupID == -1)
                {
                    commandWrapper.Parameters.Add(new SqlParameter("@WorkflowGroupID", DBNull.Value));
                }
                else
                {
                    commandWrapper.Parameters.Add(new SqlParameter("@WorkflowGroupID", workflowGroupPermission.WorkflowGroupID));
                }

                if (workflowGroupPermission.PermissionID == -1)
                {
                    commandWrapper.Parameters.Add(new SqlParameter("@PermissionID", DBNull.Value));
                }
                else
                {
                    commandWrapper.Parameters.Add(new SqlParameter("@PermissionID", workflowGroupPermission.PermissionID));
                }

                ExecuteNonQuery(commandWrapper);

                workflowGroupPermission.WorkflowGroupRecID = (int)returnParam.Value;
            }
            catch (Exception ex)
            {
                HandleException(ex);
            }

            return(returnCode);
        }
Пример #4
0
        public WorkflowGroupPermission GetWorkflowGroupPermission(int loadByID)
        {
            WorkflowGroupPermission workflowGroupPermission = new WorkflowGroupPermission();
            // Load Object by ID
            DataTable returnTable;

            try
            {
                returnTable             = ExecuteDataTable("spr_GetWorkflowGroupPermissionByID", loadByID);
                workflowGroupPermission = loadWorkflowGroupPermissionData(returnTable);
            }
            catch (Exception ex)
            {
                HandleException(ex);
            }

            return(workflowGroupPermission);
        }
Пример #5
0
        public void Update(WorkflowGroupPermission workflowGroupPermission)
        {
            if (base.ValidateKeyField(workflowGroupPermission.WorkflowGroupRecID))
            {
                DbCommand commandWrapper = GetDbCommand("spr_UpdateWorkflowGroupPermission");

                try
                {
                    if (workflowGroupPermission.WorkflowGroupRecID == -1)
                    {
                        commandWrapper.Parameters.Add(new SqlParameter("@WorkflowGroupRecID", DBNull.Value));
                    }
                    else
                    {
                        commandWrapper.Parameters.Add(new SqlParameter("@WorkflowGroupRecID", workflowGroupPermission.WorkflowGroupRecID));
                    }

                    if (workflowGroupPermission.WorkflowGroupID == -1)
                    {
                        commandWrapper.Parameters.Add(new SqlParameter("@WorkflowGroupID", DBNull.Value));
                    }
                    else
                    {
                        commandWrapper.Parameters.Add(new SqlParameter("@WorkflowGroupID", workflowGroupPermission.WorkflowGroupID));
                    }

                    if (workflowGroupPermission.PermissionID == -1)
                    {
                        commandWrapper.Parameters.Add(new SqlParameter("@PermissionID", DBNull.Value));
                    }
                    else
                    {
                        commandWrapper.Parameters.Add(new SqlParameter("@PermissionID", workflowGroupPermission.PermissionID));
                    }

                    ExecuteNonQuery(commandWrapper);
                }
                catch (Exception ex)
                {
                    HandleException(ex);
                }
            }
        }
Пример #6
0
        protected virtual WorkflowGroupPermission FillWorkflowGroupPermissionObjectFromRowData(DataRow returnRow)
        {
            WorkflowGroupPermission workflowGroupPermission = new WorkflowGroupPermission();

            if (returnRow["WorkflowGroupRecID"] != DBNull.Value)
            {
                workflowGroupPermission.WorkflowGroupRecID = Convert.ToInt32(returnRow["WorkflowGroupRecID"]);
            }

            if (returnRow["WorkflowGroupID"] != DBNull.Value)
            {
                workflowGroupPermission.WorkflowGroupID = Convert.ToInt32(returnRow["WorkflowGroupID"]);
            }

            if (returnRow["PermissionID"] != DBNull.Value)
            {
                workflowGroupPermission.PermissionID = Convert.ToInt32(returnRow["PermissionID"]);
            }

            return(workflowGroupPermission);
        }
Пример #7
0
        public bool Equals(Object obj)
        {
            WorkflowGroupPermission workflowGroupPermissionObj = obj as WorkflowGroupPermission;

            return((workflowGroupPermissionObj == null) ? false : (this.WorkflowGroupRecID == workflowGroupPermissionObj.WorkflowGroupRecID));
        }