protected void GridDpt_RowCommand(object sender, GridCommandEventArgs e)
        {
            int deptID = GetSelectedDataKeyID(GridDpt);


            if (e.CommandName == "Delete")
            {
                if (TreeDpt.FindNode(deptID.ToString()).Nodes.Count > 0)
                {
                    Alert.ShowInTop("请先删除该指标下子部门!");
                    return;
                }

                BLL.t_Index BLL = new Maticsoft.BLL.t_Index();


                if (BLL.GetModel(deptID).FatherId == null)
                {
                    Alert.ShowInTop("根目录无法删除!");
                    return;
                }


                bool isTrue = BLL.Delete(deptID);


                if (!isTrue)
                {
                    Alert.ShowInTop("删除失败!");
                    return;
                }
                else
                {
                    BindTree();
                    LoadData();
                }
            }
            if (e.CommandName == "Edit")
            {
                Window1.Title = "指标管理";
                string openUrl = String.Format("./IndexEdit.aspx?dptId={0}", HttpUtility.UrlEncode(deptID.ToString()));
                PageContext.RegisterStartupScript(Window1.GetSaveStateReference(deptID.ToString()) + Window1.GetShowReference(openUrl));
            }
        }
        protected void LoadData()
        {
            Maticsoft.BLL.t_Index BLL = new Maticsoft.BLL.t_Index();
            string sortField          = GridDpt.SortField;
            string sortDirection      = GridDpt.SortDirection;

            if (TreeDpt.SelectedNode == null)
            {
                GridDpt.RecordCount = BLL.GetRecordCount(" FatherId is null ");

                DataView view = BLL.GetListByPage(" FatherId is null ", " Id asc ", GridDpt.PageIndex * GridDpt.PageSize, (GridDpt.PageIndex + 1) * GridDpt.PageSize).Tables[0].DefaultView;
                view.Sort          = String.Format("{0} {1}", sortField, sortDirection);
                GridDpt.DataSource = view.ToTable();
            }
            else
            {
                string NodeId = TreeDpt.SelectedNodeID;
                GridDpt.RecordCount = BLL.GetRecordCount(" FatherId=" + NodeId);
                DataView view = BLL.GetListByPage(" FatherId=" + NodeId, " Id asc ", GridDpt.PageIndex * GridDpt.PageSize, (GridDpt.PageIndex + 1) * GridDpt.PageSize).Tables[0].DefaultView;
                view.Sort          = String.Format("{0} {1}", sortField, sortDirection);
                GridDpt.DataSource = view.ToTable();
            }
            GridDpt.DataBind();
        }