private void BindGrid() { if (tr_List.SelectedNode != null) { bt_Add.Visible = false; gv_List.Columns[1].Visible = false; int folder = int.Parse(tr_List.SelectedNode.Value); IList <Rpt_FolderRight> rights = Rpt_FolderRightBLL.GetAssignedRightByUser(Session["UserName"].ToString()).Where(p => p.Folder == folder).ToList(); string ConditionStr = " Rpt_Report.Folder = " + folder.ToString(); if (rights.Where(p => p.Action == 1 || p.Action == 2).Count() == 0 && rights.Where(p => p.Action == 3).Count() > 0) { //只有创建、查看自己报表的权限 ConditionStr += " AND Rpt_Report.InsertStaff = " + Session["UserID"].ToString(); bt_Add.Visible = true; //新增报表 gv_List.Columns[1].Visible = true; //设计报表 } else if (rights.Where(p => p.Action == 2).Count() > 0) { bt_Add.Visible = true; //新增报表 gv_List.Columns[1].Visible = true; //设计报表 } gv_List.ConditionString = ConditionStr; gv_List.BindGrid(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { #region 获取页面参数 ViewState["Report"] = Request.QueryString["Report"] != null ? new Guid(Request.QueryString["Report"]) : Guid.Empty; ViewState["LoadCache"] = Request.QueryString["LoadCache"] != null ? Request.QueryString["LoadCache"] != "false" : true; #endregion if ((Guid)ViewState["Report"] == Guid.Empty) { Response.Redirect("Rpt_ReportList.aspx"); } #region 判断有无浏览权限 Rpt_Report rpt = new Rpt_ReportBLL((Guid)ViewState["Report"]).Model; if (rpt == null) { Response.Redirect("Rpt_ReportList.aspx"); } IList <Rpt_FolderRight> rights = Rpt_FolderRightBLL.GetAssignedRightByUser(Session["UserName"].ToString()).Where(p => p.Folder == rpt.Folder).ToList(); if (rights.Count == 0) { MessageBox.ShowAndRedirect(this, "对不起,您没有权限浏览该报表", "Rpt_ReportList.aspx"); return; } #endregion //增加浏览记录 Rpt_ReportBLL.AddViewTimes(new Guid(ViewState["Report"].ToString()), (int)Session["UserID"]); } }
private void BindTree(TreeNodeCollection TNC, int SuperID) { IList <Rpt_FolderRight> rights = Rpt_FolderRightBLL.GetAssignedRightByUser(Session["UserName"].ToString()); foreach (Rpt_Folder folder in Rpt_FolderBLL.GetModelList("SuperID=" + SuperID.ToString())) { if (folder.ID > 1 && rights.FirstOrDefault(p => p.Folder == folder.ID) == null) { continue; } TreeNode tn = new TreeNode(); tn.Text = folder.Name; tn.Value = folder.ID.ToString(); tn.ImageUrl = "~/Images/gif/gif-0030.gif"; TNC.Add(tn); //if (folder.ID == 1) BindTree(tn.ChildNodes, folder.ID); } }