/// <summary> /// 显示客户端确认窗口 /// </summary> /// <param name="toolbar"></param> /// <param name="value"></param> /// <param name="title"></param> /// <param name="width"></param> /// <param name="height"></param> /// <param name="message"></param> public static void ShowCilentConfirm(Nandasoft.WebControls.NDToolbar toolbar, string value, string title, int width, int height, string message) { Page page = PageHelper.GetCurrentPage(); System.Text.StringBuilder scripts = new StringBuilder(); scripts.Append("function toolbar_Click(toolbarItem){"); scripts.Append("if (toolbarItem.value == '" + value + "'){"); scripts.Append("showToolbarConfirm('" + title + "'," + width + "," + height + ",'" + message + "','" + toolbar.ClientID + "','" + value + "');"); scripts.Append("toolbarItem.needPostBack = false;}}"); page.ClientScript.RegisterClientScriptBlock(typeof(Page), "confirm", scripts.ToString(), true); }
/// <summary> /// 加载Toolbar样式和判断权限 /// </summary> /// <param name="toolbar"></param> public static void LoadToolbar(Nandasoft.WebControls.NDToolbar toolbar) { if (toolbar == null) { return; //没有需要校验权限的控件 } //添加按钮样式 int i = 0; foreach (MenuItem item in toolbar.Items) { AddToolbarItemStyle(item, i != toolbar.Items.Count - 1); i++; } if (WebUI.SessionState.IsAdmin) { return; //管理员不需要校验权限 } string userID = SessionState.UserID.ToString(); string pageName = HttpContext.Current.Request.RawUrl; int index = pageName.LastIndexOf("/"); pageName = pageName.Substring(index + 1, pageName.Length - index - 1); //long menuID = new RightRule().GetMenuIDByPageName(pageName); ////得到所有权限 //DataTable dt = new RightRule().GetAllowControlRightsItems(menuID); //if (dt.Rows.Count < 1) return;//没有需要校验的权限 //List<string> rights = new List<string>(); //foreach (DataRow dr in dt.Rows) //{ // rights.Add(dr["ItemKey"].ToString()); //} ////得到拥有权限 //dt = new RightRule().GetPageKeyRight(userID, menuID.ToString(), pageName, ""); //List<string> myRights = new List<string>(); //foreach (DataRow dr in dt.Rows) //{ // myRights.Add(dr["ItemKey"].ToString()); //} ////根据权限显示控件 //foreach (MenuItem item in toolbar.Items) //{ // if (!rights.Contains(item.Value)) continue; // item.Enabled = myRights.Contains(item.Value); //} }
/// <summary> /// 显示客户端确认窗口 /// </summary> /// <param name="toolbar"></param> /// <param name="value"></param> /// <param name="message"></param> public static void ShowCilentConfirm(Nandasoft.WebControls.NDToolbar toolbar, string value, string message) { ShowCilentConfirm(toolbar, value, "系统提示", 210, 125, message); }