コード例 #1
0
        protected void dgAssetResults_ItemDataBound(object sender, DataGridItemEventArgs e)
        {
            //show hide check in button
            CheckBox chk = e.Item.FindControl("chkAsset") as CheckBox;

            if (chk != null)
            {
                bool IsDistrictTechOrDirector = AppSecurity.Current_User_Access_Level().Equals(AppSecurity.ROLE_DISTRICT_TECH) || AppSecurity.Current_User_Access_Level().Equals(AppSecurity.ROLE_DIRECTOR);
                chk.Enabled = IsDistrictTechOrDirector;
            }
        }
コード例 #2
0
        private void DisplayWarningMessageForReadOnlyUser()
        {
            bool isCurrentUserReadOnly = AppSecurity.Current_User_Access_Level().Equals(AppSecurity.ROLE_READ_ONLY);

            if (isCurrentUserReadOnly)
            {
                DataSet ds        = DatabaseUtilities.DsGetUserAccessibleStudentSearch(GetStudentIDs());
                int     iRowCount = int.Parse(ds.Tables[0].Rows[0]["Total"].ToString());
                if (iRowCount > 0)
                {
                    DisplayMessage("Please Note ", "You can only view student(s) at the following site location: <br /><br />" + AppSecurity.Get_Current_User_Accessible_Site_Desc());
                }
            }
        }
コード例 #3
0
        private void Apply_CAIRS_To_Pages()
        {
            //Current Page
            string current_page_name = Path.GetFileName(Request.Path);

            //need to append addition string before comparing to match correctly.
            string prefix = "/Pages/";

            current_page_name = prefix + current_page_name;

            //Get the logged on user access level to process
            int iUserAccessLevel = AppSecurity.Current_User_Access_Level();

            switch (current_page_name)
            {
            //Manage Asset Site Bin
            case Constants.PAGES_ADD_BIN_PAGE:

                //Access denied for read only user and below
                if (iUserAccessLevel.Equals(AppSecurity.ROLE_READ_ONLY))
                {
                    Unauthorized_Access("");
                }
                break;

            case Constants.PAGES_CHECK_OUT_ASSET_PAGE:
            case Constants.PAGES_ASSET_FOLLOW_UP_PAGE:
                //Access denided for read only and director role
                if (iUserAccessLevel.Equals(AppSecurity.ROLE_READ_ONLY) || iUserAccessLevel.Equals(AppSecurity.ROLE_DIRECTOR))
                {
                    Unauthorized_Access("");
                }
                break;

            case Constants.PAGES_ADD_ASSET_PAGE:
            case Constants.PAGES_CHECK_IN_ASSET_PAGE:
                //Access denied for Site Staff user and below
                if (iUserAccessLevel <= AppSecurity.ROLE_SITE_STAFF)
                {
                    Unauthorized_Access("");
                }
                break;

            default:
                break;
            }
        }
コード例 #4
0
        protected void dgTempAsset_ItemDataBound(object sender, DataGridItemEventArgs e)
        {
            if (e.Item.ItemIndex >= 0)
            {
                LinkButton btnDelete = ((LinkButton)e.Item.FindControl("btnDeleteAsset"));
                Label      lbl       = ((Label)e.Item.FindControl("lblErrorMessage"));
                CheckBox   chk       = ((CheckBox)e.Item.FindControl("chkAsset"));

                string sHasSubmitted = chk.Attributes["HasSubmitted"];
                bool   IsSubmitted   = sHasSubmitted.ToLower().Equals("yes");

                btnDelete.Visible = !IsSubmitted;

                /*
                 * if (IsSubmitted)
                 * {
                 *      lbl.Text = "Submitted";
                 * }
                 */

                string hasError = lbl.Attributes["data-content"];
                if (hasError.Length != 0)
                {
                    lbl.Visible = true;
                }

                btnSubmit.Visible   = !IsSubmitted;
                btnAddAsset.Visible = !IsSubmitted;
                //btnClearForm.Visible = !IsSubmitted;
                divAddDetailSection.Visible = !IsSubmitted;
                chk.Visible = !IsSubmitted;
                //divHeaderGridInfo.Visible = !IsSubmitted;
                chkAll.Visible                        = !IsSubmitted;
                lnkBtnEditSelected.Visible            = !IsSubmitted;
                lnkBtnAssignBinAssetTempToBin.Visible = !IsSubmitted;
                btnDeleteSelectedAsset.Visible        = !IsSubmitted;

                //Enable role of user is not director.
                chk.Enabled = !AppSecurity.Current_User_Access_Level().Equals(AppSecurity.ROLE_DIRECTOR);


                AppSecurity.Apply_CAIRS_Security_To_Single_Control(chk);
                AppSecurity.Apply_CAIRS_Security_To_Single_Control(btnDelete);
            }
        }