Exemplo n.º 1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         AclArea.ucSourceDictionary = Util.getDictionary(Util.getDictionary(AclExpress.getAclAreaData().Select(" IsEnabled = 'Y' ").CopyToDataTable()));
         AclArea.Refresh();
     }
 }
Exemplo n.º 2
0
    public void RefreshTreeView()
    {
        TreeView1.Nodes.Clear();
        TreeNode tRootNode = new TreeNode();

        tRootNode.Text             = "ACL資料查詢";
        tRootNode.NavigateUrl      = string.Format(_ContentUrlFormat, AclExpress._AclSysPath + "AclInfo.aspx");
        tRootNode.PopulateOnDemand = false;
        tRootNode.Expanded         = true;
        TreeView1.Nodes.Add(tRootNode);

        //管理專用
        if (AclExpress.IsAclAdminUser())
        {
            //Acl 管理員專用
            TreeNode tManageNode = new TreeNode();
            tManageNode.Text         = "管理作業";
            tManageNode.Expanded     = true;
            tManageNode.SelectAction = TreeNodeSelectAction.Expand;
            tRootNode.ChildNodes.Add(tManageNode);

            TreeNode tBaseNode = new TreeNode();
            tBaseNode.Text         = "基本資料";
            tBaseNode.Expanded     = true;
            tBaseNode.SelectAction = TreeNodeSelectAction.Expand;
            tManageNode.ChildNodes.Add(tBaseNode);

            TreeNode tChildNode = new TreeNode();
            tChildNode.Text             = "區域資料(AclArea)";
            tChildNode.PopulateOnDemand = false;
            tChildNode.Expanded         = false;
            tChildNode.SelectAction     = TreeNodeSelectAction.Select;
            tChildNode.NavigateUrl      = string.Format(_ContentUrlFormat, "AclArea.aspx");
            tBaseNode.ChildNodes.Add(tChildNode);

            tChildNode                  = new TreeNode();
            tChildNode.Text             = "規則資料(AclRule)";
            tChildNode.PopulateOnDemand = false;
            tChildNode.Expanded         = false;
            tChildNode.SelectAction     = TreeNodeSelectAction.Select;
            tChildNode.NavigateUrl      = string.Format(_ContentUrlFormat, "AclRule.aspx");
            tBaseNode.ChildNodes.Add(tChildNode);

            TreeNode tAdminNode = new TreeNode();
            tAdminNode.Text         = "管理權";
            tAdminNode.Expanded     = true;
            tAdminNode.SelectAction = TreeNodeSelectAction.Expand;
            tManageNode.ChildNodes.Add(tAdminNode);

            tChildNode                  = new TreeNode();
            tChildNode.Text             = "規則<->區域(AclAdminRuleArea)"; //AclAdminRuleArea
            tChildNode.PopulateOnDemand = false;
            tChildNode.Expanded         = false;
            tChildNode.SelectAction     = TreeNodeSelectAction.Select;
            tChildNode.NavigateUrl      = string.Format(_ContentUrlFormat, "AclAdminRuleArea.aspx");
            tAdminNode.ChildNodes.Add(tChildNode);

            tChildNode                  = new TreeNode();
            tChildNode.Text             = "使用者<->區域(AclAdminUserArea)"; //AclAdminUserArea
            tChildNode.PopulateOnDemand = false;
            tChildNode.Expanded         = false;
            tChildNode.SelectAction     = TreeNodeSelectAction.Select;
            tChildNode.NavigateUrl      = string.Format(_ContentUrlFormat, "AclAdminUserArea.aspx");
            tAdminNode.ChildNodes.Add(tChildNode);

            tAdminNode              = new TreeNode();
            tAdminNode.Text         = "使用權";
            tAdminNode.Expanded     = true;
            tAdminNode.SelectAction = TreeNodeSelectAction.Expand;
            tManageNode.ChildNodes.Add(tAdminNode);

            tChildNode                  = new TreeNode();
            tChildNode.Text             = "規則<->區域(AclAuthRuleArea)"; //AclAuthRuleArea
            tChildNode.PopulateOnDemand = false;
            tChildNode.Expanded         = false;
            tChildNode.SelectAction     = TreeNodeSelectAction.Select;
            tChildNode.NavigateUrl      = string.Format(_ContentUrlFormat, "AclAuthRuleArea.aspx");
            tAdminNode.ChildNodes.Add(tChildNode);

            tChildNode                  = new TreeNode();
            tChildNode.Text             = "使用者<->區域(AclAuthUserArea)"; //AclAuthUserArea
            tChildNode.PopulateOnDemand = false;
            tChildNode.Expanded         = false;
            tChildNode.SelectAction     = TreeNodeSelectAction.Select;
            tChildNode.NavigateUrl      = string.Format(_ContentUrlFormat, "AclAreaSelect.aspx");
            tAdminNode.ChildNodes.Add(tChildNode);

            tAdminNode              = new TreeNode();
            tAdminNode.Text         = "工具";
            tAdminNode.Expanded     = true;
            tAdminNode.SelectAction = TreeNodeSelectAction.Expand;
            tManageNode.ChildNodes.Add(tAdminNode);

            tChildNode                  = new TreeNode();
            tChildNode.Text             = "CodeMap";
            tChildNode.PopulateOnDemand = false;
            tChildNode.Expanded         = false;
            tChildNode.SelectAction     = TreeNodeSelectAction.Select;
            tChildNode.NavigateUrl      = string.Format(_ContentUrlFormat, string.Format("{0}?DBName={1}&LogDBName={2}", Util._CodeMapAdminUrl, AclExpress._AclDBName, AclExpress._AclLogDBName));
            tAdminNode.ChildNodes.Add(tChildNode);

            tChildNode                  = new TreeNode();
            tChildNode.Text             = "AppLog";
            tChildNode.PopulateOnDemand = false;
            tChildNode.Expanded         = false;
            tChildNode.SelectAction     = TreeNodeSelectAction.Select;
            tChildNode.NavigateUrl      = string.Format(_ContentUrlFormat, string.Format("{0}?DBName={1}&AllowPurgeYN=Y", Util._AppLogQryUrl, AclExpress._AclDBName));
            tAdminNode.ChildNodes.Add(tChildNode);
        }

        //一般授權作業
        string[] tAreaList = AclInfo.getAclInfo().getAdminAreaList();
        if (tAreaList != null && tAreaList.Length > 0)
        {
            string[] tGrantIDList = AclInfo.getAclInfo().getAdminAreaGrantList(tAreaList[0]);
            if (tGrantIDList != null && !string.IsNullOrEmpty(tGrantIDList[0]))
            {
                //確定有資料才產生 TreeNode
                TreeNode tAreaNode = new TreeNode();
                tAreaNode.Text         = "一般授權";
                tAreaNode.Expanded     = true;
                tAreaNode.SelectAction = TreeNodeSelectAction.Expand;
                tRootNode.ChildNodes.Add(tAreaNode);

                DataTable dtArea = AclExpress.getAclAreaData().Select(string.Format(" AreaID in ('{0}') and IsEnabled = 'Y' ", Util.getStringJoin(tAreaList, "','"))).CopyToDataTable();
                if (dtArea != null && dtArea.Rows.Count > 0)
                {
                    for (int i = 0; i < dtArea.Rows.Count; i++)
                    {
                        DataRow dr = dtArea.Rows[i];
                        //AreaID 節點
                        TreeNode tChildNode = new TreeNode();
                        tChildNode.PopulateOnDemand = false;
                        tChildNode.Text             = string.Format("{0}【{1}】", dr["AreaID"], dr["AreaName"]);
                        tChildNode.NavigateUrl      = string.Format(_ContentUrlFormat, string.Format("{0}?AreaID={1}&IsDebug=Y", AclExpress._AclSysPath + "AclAuthUserArea.aspx", dr["AreaID"]));
                        tChildNode.Expanded         = false;
                        tChildNode.SelectAction     = TreeNodeSelectAction.Select;
                        tAreaNode.ChildNodes.Add(tChildNode);
                        //AddStepNodes(tSpecNode, dr["FlowID"].ToString());
                    }
                }
            }
        }
    }