예제 #1
0
        protected void Page_Init(object sender, EventArgs e)
        {
            if (User.Identity.IsAuthenticated == false)
            {
                FormsAuthentication.RedirectToLoginPage();
                return;
            }

            bool CommitteeMember       = CommitteeMemberBLL.IsUserMember(MemberTypes.AllCommittee);
            bool FacultyOrReviewMember = CommitteeMemberBLL.IsUserMember(MemberTypes.FacultyMember) || CommitteeMemberBLL.IsUserMember(MemberTypes.Reviewer);

            pnlCommitteeAccess.Visible = CommitteeMember;
            pnlFacultyAccess.Visible   = FacultyOrReviewMember;

            //If the user is neither, redirect them to the error page
            if (!CommitteeMember && !FacultyOrReviewMember)
            {
                Response.Redirect(RecruitmentConfiguration.ErrorPage(RecruitmentConfiguration.ErrorType.AUTH));
            }
        }
        /*
         * /// <summary>
         * /// Gets the row's department member, and checks all of the appropriate boxes regarding the roles that the member
         * /// has in the current position
         * /// </summary>
         * protected void gviewMembers_RowDataBound(object sender, GridViewRowEventArgs e)
         * {
         *  GridView gview = (GridView)sender;
         *  CheckBox cboxCommittee = e.Row.FindControl(STR_ChkAllowCommittee) as CheckBox;
         *  CheckBox cboxFaculty = e.Row.FindControl(STR_ChkAllowFaculty) as CheckBox;
         *  CheckBox cboxReview = e.Row.FindControl(STR_ChkAllowReview) as CheckBox;
         *
         *  int DepartmentMemberID;
         *  DepartmentMember member;
         *
         *  if (e.Row.RowType == DataControlRowType.DataRow)
         *  {
         *      DepartmentMemberID = (int)gview.DataKeys[e.Row.RowIndex]["id"];
         *      member = DepartmentMemberBLL.GetByID(DepartmentMemberID);
         *
         *      //Now we have the departmental member, check the committee records for this position
         *      List<CommitteeMember> committeAccessList = CommitteeMemberBLL.GetByAssociationsPosition(currentPosition, member);
         *
         *      //Now we have a list of all access types for this department member, so go through and check the correct boxes
         *
         *      foreach (CommitteeMember cAccess in committeAccessList)
         *      {
         *          switch (cAccess.MemberType.ID)
         *          {
         *              case (int)MemberTypes.CommitteeMember:
         *                  cboxCommittee.Checked = true;
         *                  break;
         *              case (int)MemberTypes.FacultyMember:
         *                  cboxFaculty.Checked = true;
         *                  break;
         *              case (int)MemberTypes.Reviewer:
         *                  cboxReview.Checked = true;
         *                  break;
         *              default:
         *                  break;
         *          }
         *      }
         *  }
         * }
         */

        /// <summary>
        /// Gets the row's department member, and checks all of the appropriate boxes regarding the roles that the member
        /// has in the current position
        /// </summary>
        protected void lviewMembers_ItemDataBound(object sender, ListViewItemEventArgs e)
        {
            ListView         lview       = (ListView)sender;
            ListViewDataItem currentItem = (ListViewDataItem)e.Item;

            CheckBox cboxCommittee = currentItem.FindControl(STR_ChkAllowCommittee) as CheckBox;
            CheckBox cboxFaculty   = currentItem.FindControl(STR_ChkAllowFaculty) as CheckBox;
            CheckBox cboxReview    = currentItem.FindControl(STR_ChkAllowReview) as CheckBox;

            int DepartmentMemberID;
            DepartmentMember member;

            DepartmentMemberID = (int)lviewMembers.DataKeys[currentItem.DataItemIndex]["id"];
            member             = DepartmentMemberBLL.GetByID(DepartmentMemberID);

            //Now we have the departmental member, check the committee records for this position
            List <CommitteeMember> committeAccessList = CommitteeMemberBLL.GetByAssociationsPosition(currentPosition, member);

            //Now we have a list of all access types for this department member, so go through and check the correct boxes

            foreach (CommitteeMember cAccess in committeAccessList)
            {
                switch (cAccess.MemberType.ID)
                {
                case (int)MemberTypes.CommitteeMember:
                    cboxCommittee.Checked = true;
                    break;

                case (int)MemberTypes.FacultyMember:
                    cboxFaculty.Checked = true;
                    break;

                case (int)MemberTypes.Reviewer:
                    cboxReview.Checked = true;
                    break;

                default:
                    break;
                }
            }
        }
예제 #3
0
        /// <summary>
        /// Page_Init checks to ensure that the query string is valid, the logged in user is an admin or equivalent, the given application is valid
        /// </summary>
        protected void Page_Init(object sender, EventArgs e)
        {
            if (currentApplication == null)
            {
                //if the current application does not have a database association, redirect to an error page
                Response.Redirect(RecruitmentConfiguration.ErrorPage(RecruitmentConfiguration.ErrorType.UNKNOWN));
            }

            if (AdministrativeAccess) //Only allow in administrative access
            {
                //Check User Permissions if the user isn't an admin
                if (!Roles.IsUserInRole("Admin"))
                {
                    if (PositionBLL.VerifyPositionAccess(currentApplication.AppliedPosition) == false)
                    {
                        //If the user does not have position access, redirect to the not authorized page
                        Response.Redirect(RecruitmentConfiguration.ErrorPage(RecruitmentConfiguration.ErrorType.AUTH));
                    }
                }
            }
            else //Use committee rules
            {
                bool allowedAccess  = false;
                bool reviewerAccess = false;

                CommitteeMemberBLL.CheckAccess(currentApplication.AppliedPosition, out allowedAccess, out reviewerAccess);

                if (!allowedAccess)
                {
                    Response.Redirect(RecruitmentConfiguration.ErrorPage(RecruitmentConfiguration.ErrorType.AUTH));
                }

                if (reviewerAccess)
                {
                    gviewReferences.Columns[INT_REFERENCE_FILE_COLUMN].Visible = false;
                }
            }

            //Trace.Write("Valid user and application " + currentApplication.ID.ToString() + Environment.NewLine);
        }
예제 #4
0
        public override void LoadData()
        {
            base.LoadData();

            DepartmentMember departmentMember = new DepartmentMember
            {
                DepartmentFIS       = StaticProperties.TestString,
                FirstName           = StaticProperties.TestString,
                LastName            = StaticProperties.TestString,
                LoginID             = StaticProperties.TestString,
                OtherDepartmentName = StaticProperties.TestString
            };

            using (var ts = new TransactionScope())
            {
                DepartmentMemberBLL.EnsurePersistent(departmentMember);

                for (int i = 0; i < 4; i++)
                {
                    var memberType = new MemberType {
                        Type = StaticProperties.TestString
                    };

                    var committeeMember = new CommitteeMember
                    {
                        AssociatedPosition =
                            PositionBLL.GetByID(StaticProperties.ExistingPositionID),
                        DepartmentMember = departmentMember,
                        MemberType       = memberType
                    };


                    MemberTypeBLL.EnsurePersistent(memberType);
                    CommitteeMemberBLL.EnsurePersistent(committeeMember);
                }

                ts.CommitTransaction();
            }
        }