private void treeBusiness_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) { if (e.Node.Tag is SYS_BUSINESSROLE) { CurrRole = e.Node.Tag as SYS_BUSINESSROLE; } else if (e.Node.Tag is SYS_BUSINESSMATERIAL) { CurrMaterial = e.Node.Tag as SYS_BUSINESSMATERIAL; } else if (e.Node.Tag is SYS_BUSINESSFORM) { CurrForm = e.Node.Tag as SYS_BUSINESSFORM; } else if (e.Node.Tag is SYS_BUSINESSPROCESS) { CurrProcess = e.Node.Tag as SYS_BUSINESSPROCESS; } else if (e.Node.Tag is SYS_BUSINESS) { CurrBusiness = e.Node.Tag as SYS_BUSINESS; } else if (e.Node.Tag is SYS_BUSINESSGROUP) { CurrBusinessGroup = e.Node.Tag as SYS_BUSINESSGROUP; } else { // 角色,材料,表单,流程文件夹 if (e.Node.Parent.Tag is SYS_BUSINESS) { CurrBusiness = e.Node.Parent.Tag as SYS_BUSINESS; CurrBusinessGroup = e.Node.Parent.Parent.Tag as SYS_BUSINESSGROUP; } } }
public SYS_BUSINESSROLE SaveBusinessRole(SYS_BUSINESSROLE role) { if (0 == role.ID) { role.ID = ValueOperator.CreatePk("SYS_BUSINESSROLE"); } using (ORMHandler orm = Zxl.Data.DatabaseManager.ORMHandler) { orm.Save(role); return(role); } }
/// <summary> /// 刷新右侧详情树 /// </summary> /// <param name="currBusinessData">选中的业务数据</param> void RefreshUserRoleTree(SYS_BUSINESSROLE currRole) { treeUserRole.Nodes.Clear(); // 根节点 TreeListNode root = treeUserRole.AppendNode(new object[] { currRole.ROLENAME }, -1); root.Tag = currRole; List <ORUP_USERROLE> userRoles = UserService.GetUserRolesByRoleID(currRole.ID); foreach (ORUP_USERROLE ur in userRoles) { ORUP_USER user = UserService.GetUser(ur.UserID); TreeListNode node = treeUserRole.AppendNode(new object[] { user.USERNAME, user.NICKNAME, user.MOBILE, user.PHONE, user.EMAIL, user.CREATETIME }, root); node.Tag = ur; } treeUserRole.ExpandAll(); }
private void cmsiAddRole_Click(object sender, EventArgs e) { SYS_BUSINESSROLE newRole = new SYS_BUSINESSROLE(); newRole.CREATETIME = DateTime.Now; newRole.REF_BUSINESS_ID = CurrBusiness.ID; DlgEditBusinessRole dlg = new DlgEditBusinessRole(); dlg.Role = newRole; if (DialogResult.OK == dlg.ShowDialog()) { try { BusinessServcie.SaveBusinessRole(dlg.Role); RefreshBusinessTree(); MainForm.INFO("添加业务角色成功!"); } catch (Exception ex) { MainForm.ERROR("添加业务角色失败!" + ex.Message); } } }
public void CreateProcess() { XmlNodeList activityNodes = _layout.SelectNodes("process/activities/activity"); List <BaseActivity> activities = new List <BaseActivity>(); foreach (XmlNode activityNode in activityNodes) { BaseActivity activity = null; string type = activityNode.Attributes["type"].Value; int x = Convert.ToInt32(activityNode.Attributes["x"].Value); int y = Convert.ToInt32(activityNode.Attributes["y"].Value); decimal time = 0; if (null != activityNode.Attributes["time"]) { time = Convert.ToDecimal(activityNode.Attributes["time"].Value); } switch (type) { case "0": activity = new StartActivity(x, y); break; case "1": activity = new EndActivity(x, y); break; case "2": activity = new ManualActivity(x, y); (activity as ManualActivity).Time = time; //roles XmlNodeList roleNodes = activityNode.SelectNodes("roles/role"); if (null != roleNodes && roleNodes.Count > 0) { List <SYS_BUSINESSROLE> roles = new List <SYS_BUSINESSROLE>(); foreach (XmlNode node in roleNodes) { SYS_BUSINESSROLE role = new SYS_BUSINESSROLE(); role.ID = Convert.ToInt32(node.Attributes["id"].Value); role.ROLENAME = node.Attributes["name"].Value; role.Selected = Convert.ToInt32(node.Attributes["selected"].Value); roles.Add(role); } (activity as ManualActivity).Roles = roles; } //forms XmlNodeList formNodes = activityNode.SelectNodes("forms/form"); if (null != formNodes && formNodes.Count > 0) { List <SYS_BUSINESSFORM> forms = new List <SYS_BUSINESSFORM>(); foreach (XmlNode node in formNodes) { SYS_BUSINESSFORM form = new SYS_BUSINESSFORM(); form.ID = Convert.ToInt32(node.Attributes["id"].Value); form.FORMNAME = node.Attributes["name"].Value; form.Checked = Convert.ToInt32(node.Attributes["checked"].Value); forms.Add(form); } (activity as ManualActivity).Forms = forms; } break; default: break; } if (activity != null) { activity.ID = activityNode.Attributes["id"].Value; activity.Description = activityNode.Attributes["description"].Value; activity.X = x; activity.Y = y; document.ActivityList.Add(activity); activities.Add(activity); } } XmlNodeList lineNodes = _layout.SelectNodes("process/lines/line"); foreach (XmlNode lineNode in lineNodes) { int x = Convert.ToInt32(lineNode.Attributes["x"].Value); int y = Convert.ToInt32(lineNode.Attributes["y"].Value); string sourceId = lineNode.Attributes["source"].Value; string targetId = lineNode.Attributes["target"].Value; BaseActivity source = null; BaseActivity target = null; foreach (BaseActivity act in activities) { if (act.ID == sourceId) { source = act; continue; } if (act.ID == targetId) { target = act; continue; } } LineActivity activity = new LineActivity(source, target); if (activity != null) { activity.ID = lineNode.Attributes["id"].Value; activity.Description = lineNode.Attributes["description"].Value; activity.X = x; activity.Y = y; document.Lines.Add(activity); document.ActivityList.Add(activity); } } }