|
@@ -1,142 +0,0 @@
|
|
-using System;
|
|
|
|
-using System.Collections.Generic;
|
|
|
|
-using System.ComponentModel;
|
|
|
|
-using System.Drawing;
|
|
|
|
-using System.Data;
|
|
|
|
-using System.Text;
|
|
|
|
-using System.Linq;
|
|
|
|
-using System.Windows.Forms;
|
|
|
|
-using DevExpress.XtraEditors;
|
|
|
|
-using UAS_MES.DataOperate;
|
|
|
|
-using UAS_MES.Entity;
|
|
|
|
-using DevExpress.XtraNavBar;
|
|
|
|
-using System.Collections;
|
|
|
|
-using System.Reflection;
|
|
|
|
-using DevExpress.Utils;
|
|
|
|
-
|
|
|
|
-namespace UAS_MES.CustomControl.AccordionMenu
|
|
|
|
-{
|
|
|
|
- public partial class NavagationBar : DevExpress.XtraNavBar.NavBarControl
|
|
|
|
- {
|
|
|
|
-
|
|
|
|
- StringBuilder sql = new StringBuilder();
|
|
|
|
-
|
|
|
|
- public static int WinIndex = 0;
|
|
|
|
- /// <summary>
|
|
|
|
- /// 记录当前功能面板中的按钮
|
|
|
|
- /// </summary>
|
|
|
|
- private ArrayList ArrFunButton = new ArrayList();
|
|
|
|
- /// <summary>
|
|
|
|
- /// 记录当前功能面板中的listview
|
|
|
|
- /// </summary>
|
|
|
|
- private ArrayList ArrFunListView = new ArrayList();
|
|
|
|
- /// <summary>
|
|
|
|
- /// 已经打开的Form
|
|
|
|
- /// </summary>
|
|
|
|
- public static Dictionary<string, int> OpenedFormName = new Dictionary<string, int>();
|
|
|
|
-
|
|
|
|
- public NavagationBar()
|
|
|
|
- {
|
|
|
|
- InitializeComponent();
|
|
|
|
- DataHelper dh = SystemInf.dh;
|
|
|
|
- if (dh == null)
|
|
|
|
- return;
|
|
|
|
- if (User.UserAccountType == "admin")
|
|
|
|
- {
|
|
|
|
- sql.Clear();
|
|
|
|
- sql.Append("select distinct sn_id,sn_detno,sn_module,sn_modulecode,sn_classname,sn_displayname,sn_caller ugp_caller,1 ugp_ifdelete,1 ugp_ifread,1 ugp_ifspecial,1 ugp_ifall,");
|
|
|
|
- sql.Append("1 ugp_ifwrite from CS$SYSNAVATION left join CS$USERGROUPPOWER on sn_caller=ugp_caller where sn_using=1 order by sn_modulecode,sn_detno");
|
|
|
|
- }
|
|
|
|
- else
|
|
|
|
- {
|
|
|
|
- sql.Clear();
|
|
|
|
- sql.Append("select sn_id,sn_detno,sn_module,sn_displayname,sn_classname,ugp_caller,max(ugp_ifdelete)ugp_ifdelete,max(ugp_ifread)");
|
|
|
|
- sql.Append("ugp_ifread,max(ugp_ifspecial)ugp_ifspecial,max(ugp_ifwrite)ugp_ifwrite,max(ugp_ifall)ugp_ifall from CS$USERGROUPPOWER ");
|
|
|
|
- sql.Append("left join CS$SYSNAVATION on sn_caller=ugp_caller where sn_using=1 and ugp_groupcode in ( select eg_groupcode from cs$empgroup ");
|
|
|
|
- sql.Append("left join cs$userresource on ur_groupcode = eg_groupcode where eg_emcode = '" + User.UserCode + "') group by sn_id,sn_caller,");
|
|
|
|
- sql.Append("sn_detno,sn_classname,sn_module,sn_displayname,ugp_caller order by sn_module,sn_detno");
|
|
|
|
- }
|
|
|
|
- DataTable dt = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
|
|
|
|
- if (dt.Rows.Count == 0 && User.UserAccountType != "admin")
|
|
|
|
- {
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- for (int i = 0; i < dt.Rows.Count; i++)
|
|
|
|
- {
|
|
|
|
- bool ContainGroup = false;
|
|
|
|
- string module_name = dt.Rows[i]["sn_module"].ToString();
|
|
|
|
- string caller = dt.Rows[i]["sn_displayname"].ToString();
|
|
|
|
- NavBarItem nbi = new NavBarItem(caller);
|
|
|
|
- nbi.Tag = dt.Rows[i]["sn_classname"].ToString();
|
|
|
|
- nbi.LinkClicked += Nbi_LinkClicked;
|
|
|
|
- nbi.Tag = dt.Rows[i]["sn_classname"].ToString();
|
|
|
|
- nbi.Hint = dt.Rows[i]["ugp_caller"].ToString();
|
|
|
|
- nbi.Name = dt.Rows[i]["sn_id"].ToString();
|
|
|
|
- for (int j = 0; j < Groups.Count; j++)
|
|
|
|
- {
|
|
|
|
- if (Groups[j].Caption == module_name)
|
|
|
|
- {
|
|
|
|
- ContainGroup = true;
|
|
|
|
- Groups[j].ItemLinks.Add(nbi);
|
|
|
|
- }
|
|
|
|
- else
|
|
|
|
- {
|
|
|
|
- ContainGroup = false;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- if (!ContainGroup)
|
|
|
|
- {
|
|
|
|
- NavBarGroup nbg = new NavBarGroup(module_name);
|
|
|
|
- Groups.Add(nbg);
|
|
|
|
- nbg.ItemLinks.Add(nbi);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- //查询出的用户可见的Caller
|
|
|
|
- //将查询出的数据添加到队列中
|
|
|
|
- for (int i = 0; i < dt.Rows.Count; i++)
|
|
|
|
- {
|
|
|
|
- //添加权限
|
|
|
|
- Dictionary<string, bool> dic = new Dictionary<string, bool>();
|
|
|
|
- dic.Add("IFDELETE", dt.Rows[i]["UGP_IFDELETE"].ToString() != "1" ? false : true);
|
|
|
|
- dic.Add("IFREAD", dt.Rows[i]["UGP_IFREAD"].ToString() != "1" ? false : true);
|
|
|
|
- dic.Add("IFWRITE", dt.Rows[i]["UGP_IFWRITE"].ToString() != "1" ? false : true);
|
|
|
|
- dic.Add("IFSPECIAL", dt.Rows[i]["UGP_IFSPECIAL"].ToString() != "1" ? false : true);
|
|
|
|
- dic.Add("IFALL", dt.Rows[i]["UGP_IFALL"].ToString() != "1" ? false : true);
|
|
|
|
- //之后通过Call来获取页面操作的权限
|
|
|
|
- if (SystemInf.Caller.ContainsKey(dt.Rows[i]["ugp_caller"].ToString()))
|
|
|
|
- {
|
|
|
|
- SystemInf.Caller.Remove(dt.Rows[i]["ugp_caller"].ToString());
|
|
|
|
- }
|
|
|
|
- SystemInf.Caller.Add(dt.Rows[i]["ugp_caller"].ToString(), dic);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- private void Nbi_LinkClicked(object sender, NavBarLinkEventArgs e)
|
|
|
|
- {
|
|
|
|
- NavBarItem nbi = (sender as NavBarItem);
|
|
|
|
- Form OpenForm = (Form)Assembly.GetExecutingAssembly().CreateInstance("UAS_MES." + nbi.Tag);
|
|
|
|
- OpenForm.Dock = DockStyle.Fill;
|
|
|
|
- OpenForm.Text = nbi.Caption;
|
|
|
|
- //用Tag保存Caller
|
|
|
|
- OpenForm.Tag = nbi.Hint;
|
|
|
|
- TabControl tc = (TabControl)this.Parent.Controls["MainTabControl"];
|
|
|
|
- //如果窗体不存在进行打开,item.ToolTip是Caller
|
|
|
|
- if (!OpenedFormName.ContainsKey(nbi.Hint))
|
|
|
|
- {
|
|
|
|
- TabPage tb = new TabPage { Name = nbi.Name, Tag = nbi.Hint, Text = OpenForm.Text };
|
|
|
|
- OpenForm.TopLevel = false;
|
|
|
|
- tc.TabPages.Add(tb);
|
|
|
|
- //直接选中新打开的界面
|
|
|
|
- tc.SelectedTab = tb;
|
|
|
|
- tb.Controls.Add(OpenForm);
|
|
|
|
- OpenedFormName.Add(nbi.Hint, WinIndex);
|
|
|
|
- tc.TabIndex = WinIndex;
|
|
|
|
- WinIndex++;
|
|
|
|
- OpenForm.Show();
|
|
|
|
- }
|
|
|
|
- //如果窗体已存在展示该窗体
|
|
|
|
- else
|
|
|
|
- tc.SelectTab(nbi.Name);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-}
|
|
|