private bool ValidateUserPagePurview()
 {
     htInputParameter = new Hashtable();
     htInputParameter.Add(ConstantsManager.MESSAGE_ID, "");
     htInputParameter.Add("UserID", CurrentUserInfo.UserID);
     htInputParameter.Add("UserGroupID", CurrentUserInfo.UserGroupID);
     htInputParameter.Add("PurviewID", CurrentAccessPermission);
     htOutputParameter = SystemValidateLibrary.ValidateUserPurview(htInputParameter);
     if (htOutputParameter[ConstantsManager.MESSAGE_ID] != DBNull.Value)
     {
         //得到鉴权失败消息
         strMessageInfo = MessageManager.GetMessageInfo(htOutputParameter[ConstantsManager.MESSAGE_ID].ToString(), strMessageInfo);
         return(false);
     }
     return(true);
 }
        protected virtual void ProcessUIControlsStatus()
        {
            // for App
            if (MainContainerPlaceHolder != null && PageNavContainerPlaceHolder != null)
            {
                var txtObjectIDItem = (TextBox)MainContainerPlaceHolder.FindControl("ObjectID");
                if (txtObjectIDItem != null)
                {
                    txtObjectIDItem.Text = ObjectID;
                }
                var btnAddItem = (HtmlInputButton)MainContainerPlaceHolder.FindControl("btnAddItem");
                if (btnAddItem != null)
                {
                    btnAddItem.Visible = SystemValidateLibrary.ValidateUserPurview(currentUserInfo.UserID, currentUserInfo.UserGroupID, GetWebUIAddAccessPurviewID());
                    btnAddItem.Attributes.Add("onclick",
                                              this.IsMobileDevice()
                                                   ? RedirectJsCode.FormatInvariantCulture(GetAddPageUrl())
                                                   : OpenWindowJsCode.FormatInvariantCulture(GetAddPageUrl()));
                }
                var btnEditItem = (HtmlInputButton)PageNavContainerPlaceHolder.FindControl("btnEditItem");
                if (btnEditItem != null)
                {
                    btnEditItem.Visible = !EditMode && !AddMode && SystemValidateLibrary.ValidateUserPurview(currentUserInfo.UserID, currentUserInfo.UserGroupID, GetWebUIModifyAccessPurviewID());
                    btnEditItem.Attributes.Add("onclick",
                                               this.IsMobileDevice()
                                                   ? RedirectJsCode.FormatInvariantCulture(GetEditPageUrl(ObjectID))
                                                   : OpenWindowJsCode.FormatInvariantCulture(GetEditPageUrl(ObjectID)));
                }
                #region add page
                if (CurrentPageFileName.Equals(WEBUI_ADD_FILENAME, StringComparison.OrdinalIgnoreCase))
                {
                    var ControlContainer = MainContainerPlaceHolder.FindControl("ControlContainer");
                    var btnAddConfirm    = PageNavContainerPlaceHolder.FindControl("btnAddConfirm");
                    if (btnEditItem != null)
                    {
                        btnEditItem.Visible = btnEditItem.Visible && AccessPermission;
                        btnEditItem.Attributes.Add("onclick", "window.location='{0}';".FormatInvariantCulture(GetEditPageUrl(ObjectID)));
                    }
                    if (ControlContainer != null)
                    {
                        ControlContainer.Visible = AccessPermission;
                    }
                    if (btnAddConfirm != null)
                    {
                        btnAddConfirm.Visible = (CopyMode || AddMode || EditMode) && AccessPermission;
                    }
                }
                #endregion add page

                #region search page
                if (CurrentPageFileName.Equals(WEBUI_SEARCH_FILENAME, StringComparison.OrdinalIgnoreCase))
                {
                    var PageTitle = MainContainerPlaceHolder.FindControl("PageTitle") as Literal;
                    if (PageTitle != null)
                    {
                        PageTitle.Text = PageHeaderTitle;
                    }
                    if (!AccessPermission)
                    {
                        var advancesearchpage = MainContainerPlaceHolder.FindControl("advancesearchpage");
                        if (advancesearchpage != null)
                        {
                            advancesearchpage.Visible = false;
                        }
                        var SearchPageTopButtonBar = MainContainerPlaceHolder.FindControl("SearchPageTopButtonBar");
                        if (SearchPageTopButtonBar != null)
                        {
                            SearchPageTopButtonBar.Visible = false;
                        }
                        var SearchPageTopToolBar = MainContainerPlaceHolder.FindControl("SearchPageTopToolBar");
                        if (SearchPageTopToolBar != null)
                        {
                            SearchPageTopToolBar.Visible = false;
                        }
                        var ListControl = MainContainerPlaceHolder.FindControl("ListControl");
                        if (ListControl != null)
                        {
                            ListControl.Visible = false;
                        }
                    }
                }
                #endregion search page

                #region detail page
                if (CurrentPageFileName.Equals(WEBUI_DETAIL_FILENAME, StringComparison.OrdinalIgnoreCase))
                {
                    if (btnEditItem != null)
                    {
                        btnEditItem.Visible = btnEditItem.Visible && AccessPermission;
                        btnEditItem.Attributes.Add("onclick", "window.location='{0}';".FormatInvariantCulture(GetEditPageUrl(ObjectID)));
                    }
                    var ControlContainer = MainContainerPlaceHolder.FindControl("ControlContainer");
                    if (ControlContainer != null)
                    {
                        ControlContainer.Visible = AccessPermission;
                    }
                }
                #endregion detail page
            }
            // for Web
            else if (MainContentPlaceHolder != null)
            {
                var txtObjectIDItem = (TextBox)MainContentPlaceHolder.FindControl("ObjectID");
                if (txtObjectIDItem != null)
                {
                    txtObjectIDItem.Text = ObjectID;
                }
                var btnAddItem = (HtmlInputButton)MainContentPlaceHolder.FindControl("btnAddItem");
                if (btnAddItem != null)
                {
                    btnAddItem.Visible = SystemValidateLibrary.ValidateUserPurview(currentUserInfo.UserID, currentUserInfo.UserGroupID, GetWebUIAddAccessPurviewID());
                    btnAddItem.Attributes.Add("onclick",
                                              this.IsMobileDevice()
                                                   ? RedirectJsCode.FormatInvariantCulture(GetAddPageUrl())
                                                   : OpenWindowJsCode.FormatInvariantCulture(GetAddPageUrl()));
                }
                var btnEditItem = (HtmlInputButton)MainContentPlaceHolder.FindControl("btnEditItem");
                if (btnEditItem != null)
                {
                    btnEditItem.Visible = !EditMode && !AddMode && SystemValidateLibrary.ValidateUserPurview(currentUserInfo.UserID, currentUserInfo.UserGroupID, GetWebUIModifyAccessPurviewID());
                    btnEditItem.Attributes.Add("onclick",
                                               this.IsMobileDevice()
                                                   ? RedirectJsCode.FormatInvariantCulture(GetEditPageUrl(ObjectID))
                                                   : OpenWindowJsCode.FormatInvariantCulture(GetEditPageUrl(ObjectID)));
                }
                var btnCopyItem      = (HtmlInputButton)MainContentPlaceHolder.FindControl("btnCopyItem");
                var btnImportFromDoc = (HtmlInputButton)MainContentPlaceHolder.FindControl("btnImportFromDoc");
                if (btnImportFromDoc != null)
                {
                    btnImportFromDoc.Visible = SystemValidateLibrary.ValidateUserPurview(currentUserInfo.UserID, currentUserInfo.UserGroupID, OPERATION_IMPORT_PURVIEW_ID);
                    btnImportFromDoc.Attributes.Add("onclick", OpenWindowJsCode.FormatInvariantCulture(GetImportDocPageUrl()));
                }
                var btnImportFromDataSet = (HtmlInputButton)MainContentPlaceHolder.FindControl("btnImportFromDataSet");
                if (btnImportFromDataSet != null)
                {
                    btnImportFromDataSet.Visible = SystemValidateLibrary.ValidateUserPurview(currentUserInfo.UserID, currentUserInfo.UserGroupID, OPERATION_IMPORT_DS_PURVIEW_ID);
                    btnImportFromDataSet.Attributes.Add("onclick", OpenWindowJsCode.FormatInvariantCulture(GetImportDocPageUrl()));
                }
                var btnStatisticItem = (HtmlInputButton)MainContentPlaceHolder.FindControl("btnStatisticItem");
                if (btnStatisticItem != null)
                {
                    btnStatisticItem.Visible = SystemValidateLibrary.ValidateUserPurview(currentUserInfo.UserID, currentUserInfo.UserGroupID, WEBUI_STATISTIC_ACCESS_PURVIEW_ID);
                    btnStatisticItem.Attributes.Add("onclick", OpenWindowJsCode.FormatInvariantCulture(GetStatisicPageUrl()));
                }
                if (MainContentPlaceHolder.FindControl("ddlOperation") != null)
                {
                    DropDownList ddlOperation  = (DropDownList)MainContentPlaceHolder.FindControl("ddlOperation");
                    var          deletePurview = SystemValidateLibrary.ValidateUserPurview(currentUserInfo.UserID, currentUserInfo.UserGroupID, GetOperationDeletePurviewID());
                    if (!deletePurview)
                    {
                        var item = ddlOperation.Items.FindByValue("remove");
                        if (item != null)
                        {
                            int index = ddlOperation.Items.IndexOf(item);
                            ddlOperation.Items.RemoveAt(index);
                        }
                    }
                    if (ddlOperation.Items.Count <= 1)
                    {
                        ddlOperation.Visible = false;
                        var btnOperate = MainContentPlaceHolder.FindControl("btnOperate");
                        if (btnOperate != null)
                        {
                            btnOperate.Visible = false;
                        }
                        var chkAll = MainContentPlaceHolder.FindControl("chkAll");
                        if (chkAll != null)
                        {
                            chkAll.Visible = false;
                        }
                    }
                }
                var btnExportAllToFile  = MainContentPlaceHolder.FindControl("btnExportAllToFile");
                var ddlExportFileFormat = MainContentPlaceHolder.FindControl("ddlExportFileFormat");
                if (btnExportAllToFile != null)
                {
                    btnExportAllToFile.Visible = SystemValidateLibrary.ValidateUserPurview(currentUserInfo.UserID, currentUserInfo.UserGroupID, OPERATION_EXPORTALL_PURVIEW_ID);
                }
                if (ddlExportFileFormat != null)
                {
                    ddlExportFileFormat.Visible = SystemValidateLibrary.ValidateUserPurview(currentUserInfo.UserID, currentUserInfo.UserGroupID, OPERATION_EXPORTALL_PURVIEW_ID);
                }
                #region add page
                if (CurrentPageFileName.Equals(WEBUI_ADD_FILENAME, StringComparison.OrdinalIgnoreCase))
                {
                    var ControlContainer       = MainContentPlaceHolder.FindControl("ControlContainer");
                    var ImportControlContainer = MainContentPlaceHolder.FindControl("ImportControlContainer");
                    var btnInfoFromDoc         = MainContentPlaceHolder.FindControl("btnInfoFromDoc");
                    var btnInfoFromDocBatch    = MainContentPlaceHolder.FindControl("btnInfoFromDocBatch");
                    var btnInfoFromDocCancel   = MainContentPlaceHolder.FindControl("btnInfoFromDocCancel");
                    var btnInfoFromDS          = MainContentPlaceHolder.FindControl("btnInfoFromDS");
                    var InfoFromDoc            = MainContentPlaceHolder.FindControl("InfoFromDoc") as TextBox;
                    var btnAddConfirm          = MainContentPlaceHolder.FindControl("btnAddConfirm");
                    if (ImportDocMode && SystemValidateLibrary.ValidateUserPurview(currentUserInfo.UserID, currentUserInfo.UserGroupID, OPERATION_IMPORT_PURVIEW_ID))
                    {
                        if (ControlContainer != null)
                        {
                            ControlContainer.Visible = false;
                        }
                        if (ImportControlContainer != null)
                        {
                            ImportControlContainer.Visible = AccessPermission;
                        }
                        if (btnInfoFromDoc != null)
                        {
                            btnInfoFromDoc.Visible = true;
                        }
                        if (btnInfoFromDocBatch != null)
                        {
                            btnInfoFromDocBatch.Visible = AccessPermission;
                        }
                        if (btnInfoFromDS != null)
                        {
                            btnInfoFromDS.Visible = false;
                        }
                        if (InfoFromDoc != null)
                        {
                            InfoFromDoc.Attributes.Add("onclick", "uploadfile(this);");
                        }
                        if (btnEditItem != null)
                        {
                            btnEditItem.Visible = false;
                        }
                        if (btnCopyItem != null)
                        {
                            btnCopyItem.Visible = false;
                        }
                        if (btnAddConfirm != null)
                        {
                            btnAddConfirm.Visible = false;
                        }
                        if (btnImportFromDoc != null)
                        {
                            btnImportFromDoc.Visible = false;
                        }
                    }
                    else if (ImportDSMode && SystemValidateLibrary.ValidateUserPurview(currentUserInfo.UserID, currentUserInfo.UserGroupID, OPERATION_IMPORT_DS_PURVIEW_ID))
                    {
                        //if (ControlContainer != null)
                        //{
                        //    ControlContainer.Visible = false;
                        //}
                        if (ImportControlContainer != null)
                        {
                            ImportControlContainer.Visible = AccessPermission;
                        }
                        if (btnInfoFromDoc != null)
                        {
                            btnInfoFromDoc.Visible = false;
                        }
                        if (btnInfoFromDocBatch != null)
                        {
                            btnInfoFromDocBatch.Visible = false;
                        }
                        if (btnInfoFromDS != null)
                        {
                            btnInfoFromDS.Visible = AccessPermission;
                        }
                        if (btnInfoFromDocCancel != null)
                        {
                            btnInfoFromDocCancel.Visible = false;
                        }
                        if (InfoFromDoc != null)
                        {
                            InfoFromDoc.Attributes.Add("onclick", "uploadfile(this);");
                        }
                        if (btnEditItem != null)
                        {
                            btnEditItem.Visible = false;
                        }
                        if (btnCopyItem != null)
                        {
                            btnCopyItem.Visible = false;
                        }
                        if (btnAddConfirm != null)
                        {
                            btnAddConfirm.Visible = false;
                        }
                        if (btnImportFromDoc != null)
                        {
                            btnImportFromDoc.Visible = false;
                        }
                    }
                    else
                    {
                        if (btnEditItem != null)
                        {
                            btnEditItem.Visible = btnEditItem.Visible && AccessPermission;
                            btnEditItem.Attributes.Add("onclick", "window.location='{0}';".FormatInvariantCulture(GetEditPageUrl(ObjectID)));
                        }
                        if (btnCopyItem != null)
                        {
                            btnCopyItem.Visible = ViewMode && AccessPermission;
                            btnCopyItem.Attributes.Add("onclick", "window.location='{0}';".FormatInvariantCulture(GetCopyPageUrl(ObjectID)));
                        }
                        if (ControlContainer != null)
                        {
                            ControlContainer.Visible = AccessPermission;
                        }
                        if (btnAddConfirm != null)
                        {
                            btnAddConfirm.Visible = (CopyMode || AddMode || EditMode) && AccessPermission;
                        }
                        if (ImportControlContainer != null)
                        {
                            ImportControlContainer.Visible = false;
                        }
                        if (btnInfoFromDoc != null)
                        {
                            btnInfoFromDoc.Visible = false;
                        }
                        if (btnInfoFromDocBatch != null)
                        {
                            btnInfoFromDocBatch.Visible = false;
                        }
                        if (btnInfoFromDS != null)
                        {
                            btnInfoFromDS.Visible = false;
                        }
                        if (btnInfoFromDocCancel != null)
                        {
                            btnInfoFromDocCancel.Visible = false;
                        }
                    }
                }
                #endregion add page

                #region search page
                if (CurrentPageFileName.Equals(WEBUI_SEARCH_FILENAME, StringComparison.OrdinalIgnoreCase))
                {
                    var PageTitle = MainContentPlaceHolder.FindControl("PageTitle") as Literal;
                    if (PageTitle != null)
                    {
                        PageTitle.Text = PageHeaderTitle;
                    }
                    if (!AccessPermission)
                    {
                        var advancesearchpage = MainContentPlaceHolder.FindControl("advancesearchpage");
                        if (advancesearchpage != null)
                        {
                            advancesearchpage.Visible = false;
                        }
                        var SearchPageTopButtonBar = MainContentPlaceHolder.FindControl("SearchPageTopButtonBar");
                        if (SearchPageTopButtonBar != null)
                        {
                            SearchPageTopButtonBar.Visible = false;
                        }
                        var SearchPageTopToolBar = MainContentPlaceHolder.FindControl("SearchPageTopToolBar");
                        if (SearchPageTopToolBar != null)
                        {
                            SearchPageTopToolBar.Visible = false;
                        }
                        var ListControl = MainContentPlaceHolder.FindControl("ListControl");
                        if (ListControl != null)
                        {
                            ListControl.Visible = false;
                        }
                    }
                }
                #endregion search page

                #region detail page
                if (CurrentPageFileName.Equals(WEBUI_DETAIL_FILENAME, StringComparison.OrdinalIgnoreCase))
                {
                    if (btnEditItem != null)
                    {
                        btnEditItem.Visible = btnEditItem.Visible && AccessPermission;
                        btnEditItem.Attributes.Add("onclick", "window.location='{0}';".FormatInvariantCulture(GetEditPageUrl(ObjectID)));
                    }
                    if (btnCopyItem != null)
                    {
                        btnCopyItem.Visible = AccessPermission;
                        btnCopyItem.Attributes.Add("onclick", "window.location='{0}';".FormatInvariantCulture(GetCopyPageUrl(ObjectID)));
                    }
                    var ControlContainer = MainContentPlaceHolder.FindControl("ControlContainer");
                    if (ControlContainer != null)
                    {
                        ControlContainer.Visible = AccessPermission;
                    }
                    var btnPrintPage = MainContentPlaceHolder.FindControl("btnPrintPage");
                    if (btnPrintPage != null)
                    {
                        btnPrintPage.Visible = AccessPermission;
                    }
                }
                #endregion detail page
            }
        }