private void btnOk_Click(object sender, EventArgs e) { // 获取数据 BDictSystem system = this.ucSystem1.GetData(); List <BDictRole> roles = this.ucSystem1.GetRoles(); List <DataEmpDir> emps = this.ucSystem1.GetEmps(); SystemWithRight systemToSave = new SystemWithRight(); systemToSave.RoleList = roles; systemToSave.EmpList = emps; if (_IsNew) { bool common = false; if (EmpInfo.IsCenterAdmin) { if (MessageHelper.ShowYesNoAndQuestion("是否加入到公共系统?") == DialogResult.Yes) { common = true; } } int new_id = 0; CustomException ce = null; // 获取下一个系统ID,common为true时在10000以内找,否则在 机构ID + [0001-9999] 找 if (common) { new_id = HttpDataHelper.GetWithInfo <int>("BASE", "/setup/newsysidcenter", out ce); } else { var parmList = new List <KeyValuePair <string, string> > { new KeyValuePair <string, string>("branchId", EnvInfo.BranchId.ToString()) }; new_id = HttpDataHelper.GetWithInfo <int>("BASE", "/setup/newsysid", out ce, parmList); } if (new_id == -1) { MessageHelper.ShowError("可用的机构ID已满!"); return; } systemToSave.SystemInfo = system; system.Id = new_id; String str = StringHelper.SerializeObject <SystemWithRight>(systemToSave); // 加入数据 HttpDataHelper.HttpPostWithInfo("BASE", "/setup/systemadd", out ce, str); } else { systemToSave.SystemInfo = system; String str = StringHelper.SerializeObject <SystemWithRight>(systemToSave); // 保存数据 CustomException ce = null; HttpDataHelper.HttpPostWithInfo("BASE", "/setup/systemset", out ce, str); } this.DialogResult = DialogResult.OK; }
private void tlSysObject_AfterExpand(object sender, NodeEventArgs e) { if (e.Node.Level == 0) { this.tlSysObject.FocusedNodeChanged -= tlSysObject_FocusedNodeChanged; this.tlSysObject.BeginUpdate(); // 停止控件刷新 // 在模块展开时再检查功能的对应的功能点是否加载 foreach (TreeListNode node in e.Node.Nodes) { if (!node.HasChildren) { string objectCode = node.GetValue(this.tlcCode).ToString(); var parmList = new List <KeyValuePair <string, string> > { new KeyValuePair <string, string>("objectCode", objectCode) }; CustomException ce = null; // 获取功能对应的功能点 List <CDictFunctionPoint> fps = HttpDataHelper.GetWithInfo <List <CDictFunctionPoint> >("BASE", "/setup/fplist", out ce, parmList); foreach (CDictFunctionPoint fp in fps) { TreeListNode cnode = node.Nodes.Add(new object[] { fp.Code, fp.Name }); cnode.Tag = fp; } } } this.tlSysObject.FocusedNodeChanged += tlSysObject_FocusedNodeChanged; this.tlSysObject.EndUpdate(); // 控件刷新从BeginUpdate开始的改变 } }
public FrmMenuDefault() { InitializeComponent(); // 设置默认菜单 var parmList = new List <KeyValuePair <string, string> > { new KeyValuePair <string, string>("systemId", EnvInfo.SystemId.ToString()), new KeyValuePair <string, string>("empId", EmpInfo.Id.ToString()), new KeyValuePair <string, string>("roles", EmpInfo.Roles), }; CustomException ce = null; List <DataMenu> menulist = HttpDataHelper.GetWithInfo <List <DataMenu> >( "BASE", "/sys/menu", out ce, parmList); parmList = new List <KeyValuePair <string, string> > { new KeyValuePair <string, string>("empId", EmpInfo.Id.ToString()), new KeyValuePair <string, string>("parmName", "DEF_MENU_" + EnvInfo.SystemCode) }; String defmenu = HttpDataHelper.GetStringWithInfo("BASE", "/sys/parameteremp", out ce, parmList); tlSysMenu.BeginUpdate(); CreateTreeView(menulist, defmenu); tlSysMenu.EndUpdate(); }
private void tlSysObject_FocusedNodeChanged(object sender, DevExpress.XtraTreeList.FocusedNodeChangedEventArgs e) { if (e.Node == null) { this.ucSysModule1.Visible = false; this.ucSysObject1.Visible = false; this.bbiEditModule.Visibility = BarItemVisibility.Never; this.bbiEditObject.Visibility = BarItemVisibility.Never; this.bbiAddObject.Visibility = BarItemVisibility.Never; return; } string code = e.Node.GetValue(this.tlcCode).ToString(); string moduleCode = e.Node.GetValue(tlcParentCode).ToString(); if (string.IsNullOrEmpty(moduleCode)) { CDictModule module = e.Node.Tag as CDictModule; this.FreshModule(module); } else { CDictObject obj = e.Node.Tag as CDictObject; string objectCode = obj.Code; var parmList = new List <KeyValuePair <string, string> > { new KeyValuePair <string, string>("objectCode", objectCode) }; CustomException ce = null; // 获取功能对应的功能点 List <CDictFunctionPoint> fps = HttpDataHelper.GetWithInfo <List <CDictFunctionPoint> >("BASE", "/setup/fplist", out ce, parmList); obj.FunctionPointList = fps; this.FreshObject(obj); } }
/// <summary> /// 获取全部对象信息 /// </summary> /// <returns></returns> private List <CDictObject> getObjectAll() { CustomException ce = null; // 获取对象信息 List <CDictObject> objects = HttpDataHelper.GetWithInfo <List <CDictObject> >("BASE", "/setup/object", out ce); return(objects); }
/// <summary> /// 获取全部模块信息 /// </summary> /// <returns></returns> private List <CDictModule> getModuleAll() { CustomException ce = null; // 获取模块信息 List <CDictModule> modules = HttpDataHelper.GetWithInfo <List <CDictModule> >("BASE", "/setup/module", out ce); return(modules); }
/// <summary> /// 获取系统选择的人员 /// </summary> /// <param name="system"></param> /// <returns></returns> private List <DataEmpDir> getSystemEmp(BDictSystem system) { var parmList = new List <KeyValuePair <string, string> > { new KeyValuePair <string, string>("systemId", system.Id.ToString()) }; CustomException ce = null; // 获取系统选择的人员 List <DataEmpDir> emps = HttpDataHelper.GetWithInfo <List <DataEmpDir> >("BASE", "/setup/sysemp", out ce, parmList); return(emps); }
/// <summary> /// 获取系统选择的角色 /// </summary> /// <param name="system"></param> /// <returns></returns> private List <BDictRole> getSystemRole(BDictSystem system) { var parmList = new List <KeyValuePair <string, string> > { new KeyValuePair <string, string>("systemId", system.Id.ToString()) }; CustomException ce = null; // TODO: 获取系统选择的角色 List <BDictRole> roles = HttpDataHelper.GetWithInfo <List <BDictRole> >("BASE", "/setup/sysrole", out ce, parmList); return(roles); }
/// <summary> /// 获取菜单选择的人员 /// </summary> /// <param name="menu"></param> /// <returns></returns> private List <DataEmpDir> getMenuEmp(BDictMenu menu) { var parmList = new List <KeyValuePair <string, string> > { new KeyValuePair <string, string>("menuCode", menu.Code) }; CustomException ce = null; // 获取菜单选择的人员 List <DataEmpDir> emps = HttpDataHelper.GetWithInfo <List <DataEmpDir> >("BASE", "/setup/menuemp", out ce, parmList); return(emps); }
/// <summary> /// 获取菜单选择的角色 /// </summary> /// <param name="menu"></param> /// <returns></returns> private List <BDictRole> getMenuRole(BDictMenu menu) { var parmList = new List <KeyValuePair <string, string> > { new KeyValuePair <string, string>("menuCode", menu.Code) }; CustomException ce = null; // 获取菜单选择的角色 List <BDictRole> roles = HttpDataHelper.GetWithInfo <List <BDictRole> >("BASE", "/setup/menurole", out ce, parmList); return(roles); }
/// <summary> /// 获取全部可用员工 /// </summary> /// <returns></returns> public static List <DataEmpDir> GetEmpAll() { var parmList = new List <KeyValuePair <string, string> > { new KeyValuePair <string, string>("branchId", EnvInfo.BranchId.ToString()) }; CustomException ce = null; // 获取全部可用员工(本机构在用员工) // TODO 中心人员? List <DataEmpDir> emps = HttpDataHelper.GetWithInfo <List <DataEmpDir> >("BASE", "/setup/emp", out ce, parmList); return(emps); }
/// <summary> /// 获取全部可用角色 /// </summary> /// <returns></returns> public static List <BDictRole> GetRoleAll() { var parmList = new List <KeyValuePair <string, string> > { new KeyValuePair <string, string>("branchId", EnvInfo.BranchId.ToString()) }; CustomException ce = null; // 查询获取全部可用角色列表(本机构及公共角色) // TODO 中心角色? List <BDictRole> roles = HttpDataHelper.GetWithInfo <List <BDictRole> >("BASE", "/setup/role", out ce, parmList); return(roles); }
private void FreshData() { CustomException ce = null; // 获取模块列表、对象列表数据, 以下为测试数据 List <CDictModule> modules = HttpDataHelper.GetWithInfo <List <CDictModule> >("BASE", "/setup/module", out ce); List <CDictObject> objects = HttpDataHelper.GetWithInfo <List <CDictObject> >("BASE", "/setup/object", out ce); this.tlSysObject.FocusedNodeChanged -= tlSysObject_FocusedNodeChanged; this.tlSysObject.BeginUpdate(); // 停止控件刷新 this.tlSysObject.Nodes.Clear(); int j = 0; foreach (CDictModule module in modules) { TreeListNode rnode = this.tlSysObject.Nodes.Add(new object[] { module.Code, module.Name, module.FileName, module.UsedFlag, "" }); rnode.Tag = module; for (; j < objects.Count; j++) { if (module.Code == objects[j].ModuleCode) { TreeListNode node = rnode.Nodes.Add(new object[] { objects[j].Code, objects[j].Name, objects[j].Object, objects[j].UsedFlag, objects[j].ModuleCode }); node.Tag = objects[j]; } else { break; } } } this.tlSysObject.FocusedNodeChanged += tlSysObject_FocusedNodeChanged; this.tlSysObject.EndUpdate(); // 控件刷新从BeginUpdate开始的改变 if (modules.Count > 0) { this.FreshModule(modules[0]); } else { this.ucSysModule1.Visible = false; this.ucSysObject1.Visible = false; this.bbiEditModule.Visibility = BarItemVisibility.Never; this.bbiEditObject.Visibility = BarItemVisibility.Never; this.bbiAddObject.Visibility = BarItemVisibility.Never; } }
public override bool Init() { this.BindTypeData(); CustomException ce = null; var parmList = new List <KeyValuePair <string, string> > { new KeyValuePair <string, string>("branchId", EnvInfo.BranchId.ToString()) }; // 根据机构ID查询出全部参数 List <BDictParameter> parameterList = HttpDataHelper.GetWithInfo <List <BDictParameter> >( "BASE", "/setup/paramsget", out ce, parmList); this.gcParameterList.DataSource = parameterList; this.SetStatus(false); return(base.Init()); }
/// <summary> /// 刷新数据 /// </summary> private void Fresh() { try { // TODO: 获取员工参数列表 var parmList = new List <KeyValuePair <string, string> > { new KeyValuePair <string, string>("empId", m_EmpId.ToString()) }; CustomException ce = null; List <BDictParameterEmp> parms = HttpDataHelper.GetWithInfo <List <BDictParameterEmp> >( "BASE", "/setup/paramsemp", out ce, parmList); this.gcParameterList.DataSource = parms; } catch (Exception ex) { MessageHelper.ShowError(ex.Message); } }
private void freshFP(TreeListNode node) { CDictFunctionPoint fp = node.Tag as CDictFunctionPoint; this.teCode.Text = fp.Code; this.teName.Text = fp.Name; this.teDescribe.Text = fp.Describe; // 获取功能点角色及人员数据 var parmList = new List <KeyValuePair <string, string> > { new KeyValuePair <string, string>("fpCode", fp.Code) }; CustomException ce = null; List <BDictRole> roles = HttpDataHelper.GetWithInfo <List <BDictRole> >("BASE", "/setup/fprole", out ce, parmList); List <DataEmpDir> emps = HttpDataHelper.GetWithInfo <List <DataEmpDir> >("BASE", "/setup/fpemp", out ce, parmList); this.gcEmp.DataSource = emps; this.gcRole.DataSource = roles; this.bbiSetup.Enabled = true; }
private void freshData() { CustomException ce = null; // 获取模块列表、有功能点的对象列表数据, 以下为测试数据 List <CDictModule> modules = HttpDataHelper.GetWithInfo <List <CDictModule> >("BASE", "/setup/module", out ce); List <CDictObject> objects = HttpDataHelper.GetWithInfo <List <CDictObject> >("BASE", "/setup/object", out ce); this.tlSysObject.FocusedNodeChanged -= tlSysObject_FocusedNodeChanged; this.tlSysObject.BeginUpdate(); // 停止控件刷新 this.tlSysObject.Nodes.Clear(); int j = 0; foreach (CDictModule module in modules) { TreeListNode rnode = this.tlSysObject.Nodes.Add(new object[] { module.Code, module.Name }); rnode.Tag = module; for (; j < objects.Count; j++) { if (module.Code == objects[j].ModuleCode) { TreeListNode node = rnode.Nodes.Add(new object[] { objects[j].Code, objects[j].Name }); node.Tag = objects[j]; } else { break; } } } this.tlSysObject.FocusedNodeChanged += tlSysObject_FocusedNodeChanged; this.tlSysObject.EndUpdate(); // 控件刷新从BeginUpdate开始的改变 this.groupControl1.Visible = false; this.gcEmp.Visible = false; this.gcRole.Visible = false; this.setStatus(false); }
/// <summary> /// /// </summary> private void RefreshList() { tlSysMenu.FocusedNodeChanged -= tvFunction_FocusedNodeChanged; tlSysMenu.BeginUpdate(); tlSysMenu.Nodes.Clear(); CustomException ce = null; // 获取系统信息 List <BDictSystem> systemList = HttpDataHelper.GetWithInfo <List <BDictSystem> >("BASE", "/setup/systemget", out ce); // 获取菜单信息 List <BDictMenu> menuList = HttpDataHelper.GetWithInfo <List <BDictMenu> >("BASE", "/setup/menuget", out ce); foreach (BDictSystem dataSystem in systemList) { TreeListNode rnode = tlSysMenu.Nodes.Add(new object[] { dataSystem.Code, dataSystem.Name }); rnode.Tag = dataSystem; if (dataSystem.Id > 1000) { rnode.ImageIndex = 2; } else { rnode.ImageIndex = 1;//设置节点的图标 } TreeListNode lnode = null; string lcode = string.Empty; for (var j = 0; j < menuList.Count; j++) { if (dataSystem.Id == menuList[j].SystemId) { if (menuList[j].Code.Length == 1) { lcode = menuList[j].Code; lnode = rnode.Nodes.Add(new object[] { menuList[j].Code, menuList[j].Title }); lnode.Tag = menuList[j]; lnode.ImageIndex = 3; } else { // 找上级菜单 bool ok = true; TreeListNode bnode = lnode; // 备份旧的节点,防止找不到上级时可以回到原节点 while (lcode != menuList[j].Code.Substring(0, menuList[j].Code.Length - 1)) { lnode = lnode.ParentNode; lcode = lnode.GetValue(tlcCode).ToString(); if (lnode.Level == 0) { lnode = bnode; lcode = lnode.GetValue(tlcCode).ToString(); ok = false; MessageHelper.ShowError("菜单号:" + menuList[j].Code + " 找不到上级菜单,请与管理员联系!"); break; } } if (ok) { lcode = menuList[j].Code; lnode = lnode.Nodes.Add(new object[] { menuList[j].Code, menuList[j].Title }); lnode.Tag = menuList[j]; lnode.ImageIndex = 3; } } } else { continue; } } } this.ucSystem1.SetStatus(false, false); this.ucMenu1.SetStatus(false); tlSysMenu.CollapseAll(); tlSysMenu.EndUpdate(); tlSysMenu.FocusedNodeChanged += tvFunction_FocusedNodeChanged; }
/// <summary> /// 形成Page及Item /// </summary> private void Create_Page(string open_menu_code) { // 取菜单表 // 获取可用菜单信息 String roles = EmpInfo.Roles; var parmList = new List <KeyValuePair <string, string> > { new KeyValuePair <string, string>("systemId", EnvInfo.SystemId.ToString()), new KeyValuePair <string, string>("empId", EmpInfo.Id.ToString()), new KeyValuePair <string, string>("roles", EmpInfo.Roles), }; CustomException ce = null; List <DataMenu> menuList = HttpDataHelper.GetWithInfo <List <DataMenu> >("BASE", "/sys/menu", out ce, parmList); // 删除失效菜单(模块或对象不可用) for (int i = menuList.Count - 1; i >= 0; i--) { if (!String.IsNullOrEmpty(menuList[i].ObjectCode) && (String.IsNullOrEmpty(menuList[i].ObjectName) || String.IsNullOrEmpty(menuList[i].ModuleName))) { menuList.RemoveAt(i); } } int num = 0; string curPageOrd = ""; RibbonPage rbPage = new RibbonPage(); RibbonPageGroup rbPageGroup = new RibbonPageGroup(); for (int i = 0; i < menuList.Count; i++) { string code = menuList[i].Code; string title = menuList[i].Title; if (code.Length == 1) // 对应页 { rbPage = new RibbonPage(title); rbPage.Name = "rbPage" + code; this.ribbon.Pages.Insert(num, rbPage); this.ribbon.Pages[num].Visible = false; curPageOrd = code; num++; } if (code.Length == 2) // 对应页组 { int funcount = CountFunctionItem(menuList, i); // 是否存在功能 if (funcount > 0 && num > 0 && curPageOrd == code.Substring(0, 1)) { this.ribbon.Pages[num - 1].Visible = true; // 加入页组 rbPageGroup = new RibbonPageGroup(""); rbPageGroup.Name = "rbPageGroup" + code; rbPageGroup.ShowCaptionButton = false; rbPage.Groups.Add(rbPageGroup); string funname = menuList[i].ObjectName; if (!string.IsNullOrEmpty(funname)) { BarButtonItem bbi = new BarButtonItem(); bbi.Caption = title; bbi.Id = this.ribbon.Items.Count; bbi.Name = "bbi" + code; if (!string.IsNullOrEmpty(menuList[i].Prompt)) { SuperToolTip stt = new SuperToolTip(); ToolTipItem tti = new ToolTipItem(); tti.Text = menuList[i].Prompt; stt.Items.Add(tti); bbi.SuperTip = stt; } string ico = menuList[i].Ico; if (!ico.IsNullOrEmpty()) // 图标 { if (ico.ToLower().EndsWith("svg")) { bbi.ImageOptions.SvgImage = BmpHelper.GetSvg(ico); } else { bbi.LargeGlyph = BmpHelper.GetIco(ico); } bbi.RibbonStyle = RibbonItemStyles.Default; } bbi.Tag = ToFunction(menuList[i]); bbi.ItemClick += new ItemClickEventHandler(this.dynamic_bbi_ItemClick); this.ribbon.Items.Add(bbi); rbPageGroup.ItemLinks.Add(bbi); rbPageGroup.Visible = true; } else { BarSubItem bsimenu = this.CreateMenu(menuList, ref i); // 产生菜单 if (bsimenu.LinksPersistInfo.Count > 0 || bsimenu.Tag != null) // 有子项才加入 { this.ribbon.Items.Add(bsimenu); rbPageGroup.ItemLinks.Add(bsimenu); rbPageGroup.Visible = true; } } } } } this.ribbon.SelectedPage = this.ribbon.Pages[0]; // 找自动打开菜单 if (open_menu_code != null) { DataMenu default_menu = menuList.Find(o => o.Code == open_menu_code); if (default_menu != null && !String.IsNullOrEmpty(default_menu.ObjectName) && !String.IsNullOrEmpty(default_menu.ModuleName)) { Execute(ToFunction(default_menu)); } } return; }