//private void gridView1_CustomColumnDisplayText(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs e) //{ //if (e.ListSourceRowIndex < 0) return; //IList<Model._pronoteProceduresAbilityCJDetail> details = this.bindingSource1.DataSource as IList<Model._pronoteProceduresAbilityCJDetail>; //if (details == null || details.Count < 1) return; //Model.Product detail = details[e.ListSourceRowIndex].Product; //switch (e.Column.Name) //{ // case "colProductId": // if (detail == null) return; // e.DisplayText = string.IsNullOrEmpty(detail.Id) ? "" : detail.Id; // break; //} //} /// <summary> /// 加载tree /// </summary> protected void TreeLoad() { this.treeList1.ClearNodes(); foreach (Model.WorkHouse workHouse in workHouseManager.Select()) { DevExpress.XtraTreeList.Nodes.TreeListNode treeNode = treeList1.AppendNode(new object[] { workHouse.Workhousename }, null, workHouse.WorkHouseId); foreach (Model.Procedures procedures in proceduresManager.Select(workHouse.WorkHouseId)) { treeList1.AppendNode(new object[] { procedures.Id }, treeNode, procedures.ProceduresId); } } }
/*专业班级树中显示所有的学院专业班级信息*/ private void showAllClass() { //string sql = "select CollName,MajorName,ClassName from Collage, Major, Class where Collage.CollNo = Major.CollNo and Major.MajorNo = Class.MajorNo"; string sql = "select MajorName from Major"; DataSet dataSet = GetData(sql); foreach (DataRow dataRow in dataSet.Tables[0].Rows) { //添加一级节点 DevExpress.XtraTreeList.Nodes.TreeListNode FistLevelNode = treeListMajor.AppendNode(null, null); //添加第一节点显示的值 FistLevelNode.SetValue(treeListMajor.Columns[0], dataRow["MajorName"].ToString().Trim()); } }
void band() { this.treeList1.ClearNodes(); IList <Model.Depot> list = depotManager.Select(); foreach (Model.Depot depot in list) { DevExpress.XtraTreeList.Nodes.TreeListNode treeNode = treeList1.AppendNode(new object[] { depot.DepotName }, null, depot.DepotId); foreach (Model.DepotPosition dp in this.depotPositionManager.Select(depot)) { treeList1.AppendNode(new object[] { dp.Id }, treeNode, null); } } }
protected void TreeLoad() { this.treeList1.ClearNodes(); foreach (Model.UnitGroup ug in unitGroupManager.Select()) { DevExpress.XtraTreeList.Nodes.TreeListNode treeNode = treeList1.AppendNode(new object[] { ug.UnitGroupName }, null, ug.UnitGroupId); foreach (Model.ProductUnit ProductUnit in productUnitManager.Select(ug.UnitGroupId)) { treeList1.AppendNode(new object[] { ProductUnit.CnName }, treeNode, ProductUnit.UnitGroup.UnitGroupId); } } }
private void GetNodesParentID(DevExpress.XtraTreeList.Nodes.TreeListNode node) { if (node.ParentNode != null) { if (!MenuSelectResult.Contains(node.ParentNode.GetValue("ID").ToString())) { MenuSelectResult += node.ParentNode.GetValue("ID").ToString() + ","; LMenuID.Add(node.ParentNode.GetValue("ID").ToString()); LMenuName.Add(node.ParentNode.GetValue("sMenuName").ToString()); LMenuParentID.Add(node.ParentNode.GetValue("iParentID").ToString()); } GetNodesParentID(node.ParentNode); } }
private void fAccPeriod_FormClosing(object sender, FormClosingEventArgs e) { if (bHasChanges) { DialogResult oTempResult = XtraMessageBox.Show("Data has been changed, do you want to save the changes?", Application.ProductName, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question); if (oTempResult == DialogResult.Yes) { if (Validation(cxDBTreeList1.FocusedNode)) { DevExpress.XtraTreeList.Nodes.TreeListNode tlNode = cxDBTreeList1.FocusedNode; if (tlNode != null && tlNode.Id > 0) { var currDr1 = ((DataRowView)cxDBTreeList1.GetDataRecordByNode(tlNode)).Row; if (currDr1.RowState == DataRowState.Added) { currDr1["COMP_PERIOD_CODE"] = currDr1["COMPANY_ID"].ToString() + " - " + currDr1["PERIOD_CODE"].ToString(); currDr1["COMP_MAJ_PERIOD_CODE"] = DBNull.Value; } this.Cursor = Cursors.WaitCursor; //splashScreenManager1.ShowWaitForm(); SaveAccountingPeriod(currDr1); //splashScreenManager1.CloseWaitForm(); this.Cursor = Cursors.Default; e.Cancel = false; } } else { e.Cancel = true; } } else if (oTempResult == DialogResult.No) { cxDBTreeList1.CancelUpdate(); e.Cancel = false; //dtOpCompMast.RejectChanges(); } else { e.Cancel = true; } } if (e.Cancel) { return; } }
private void cxDBTreeList1_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Escape) { if (drParent != null) { DevExpress.XtraTreeList.Nodes.TreeListNode tlNode = cxDBTreeList1.FocusedNode; if (vIns) { cxDBTreeList1.DeleteNode(tlNode); } dtAccountPeriod.RejectChanges(); if (dtAccountPeriod != null) { dtAccountPeriod.RejectChanges(); cxDBTreeList1cxDBTreeListCOMPANY_ID.OptionsColumn.AllowEdit = false; cxDBTreeList1cxDBTreeListCODE.OptionsColumn.AllowEdit = false; cxDBTreeList1cxDBTreeListFROM.OptionsColumn.AllowEdit = false; } if (dtAccountPeriod.Rows.Count == 0) { dxBarBtnsave.Enabled = false; dxBarBtnCancel.Enabled = false; dxBarBtnAddNode.Enabled = true; dxBarBtnDelNode.Enabled = false; dxBarBtnExp.Enabled = false; dxBarBtnCollp.Enabled = false; } else { cxDBTreeList1.DataSource = dtAccountPeriod; dxBarBtnsave.Enabled = false; dxBarBtnCancel.Enabled = false; dxBarBtnAddNode.Enabled = true; dxBarBtnDelNode.Enabled = true; dxBarBtnExp.Enabled = true; dxBarBtnCollp.Enabled = true; } drParent = null; } } else if (e.KeyCode == Keys.Insert) { vIns = true; } }
private void PopulaListaRequisicoes(Int32 NroProcesso, Int32 NroRequisicao) { //************** //* Declarações //************** Requisicao_Manager oRequisicaoManager = new Requisicao_Manager(UserLogin.LoginInfo.Master_DevArtConexaoString); DevExpress.XtraTreeList.Nodes.TreeListNode oRootNode = null; DevExpress.XtraTreeList.Nodes.TreeListNode oNode = null; //*********************** //* Anula lista anterior //*********************** this.trvProdutos.BeginUpdate(); this.trvProdutos.Nodes.Clear(); //*********************************************** //* Obtem lista de requisições do processo atual //*********************************************** List <Lista_Requesicoes_Fields> oRequisicoes = oRequisicaoManager.GetReqsFromProcess(NroProcesso); //**************************** //* Insere registros na lista //**************************** foreach (Lista_Requesicoes_Fields oRequisicao in oRequisicoes) { //************************************** //* Insere ítem na lista de requisições //************************************** oNode = this.trvProdutos.AppendNode(new object[] { oRequisicao.NroRequis, oRequisicao.Produto, oRequisicao.Pax, oRequisicao.DataIn, oRequisicao.DataOut }, oRootNode); //************************************* //* Deve selecionar a requsição atual? //************************************* if (oRequisicao.NroRequis == NroRequisicao) { oNode.Selected = true; } } //********************** //* Conclui atualização //********************** this.trvProdutos.EndUpdate(); }
private void CreateNode(DevExpress.XtraTreeList.TreeList tl) { tl.BeginUnboundLoad(); // Create a root node DevExpress.XtraTreeList.Nodes.TreeListNode parentForRootNodes = null; DevExpress.XtraTreeList.Nodes.TreeListNode rootNode2 = tl.AppendNode(new object[] { "Thiết bị quản lý theo số lượng", 0 }, parentForRootNodes); DevExpress.XtraTreeList.Nodes.TreeListNode rootNode = tl.AppendNode(new object[] { "Thiết bị quản lý theo cá thể", 1 }, parentForRootNodes); // Create a child for a root Node tl.AppendNode(new object[] { "Thiết bị đang được sử dụng", 2 }, rootNode); tl.AppendNode(new object[] { "Thiết bị chưa được sử dụng", 3 }, rootNode); tl.EndUnboundLoad(); }
/*当打开界面的时候,就执行一次,刷新学院树*/ private void showAllCollage() { string sql = "select CollName from Collage"; DataSet dataSet = GetData(sql); //循环,将查询的学院信息显示在树中 foreach (DataRow dataRow in dataSet.Tables[0].Rows) { //添加一级节点 DevExpress.XtraTreeList.Nodes.TreeListNode FistLevelNode = treeListCollageList.AppendNode(null, null); //添加第一节点显示的值 FistLevelNode.SetValue(treeListCollageList.Columns[0], dataRow["CollName"].ToString().Trim()); } }
/// <summary> /// 判断此节点下的所有子节点是否选中 /// </summary> /// <param name="node"></param> /// <returns></returns> public Boolean IsChildsChecked(DevExpress.XtraTreeList.Nodes.TreeListNode node) { for (int i = 0; i < node.Nodes.Count; i++) { if (node.Nodes[i].CheckState == CheckState.Unchecked) { return(false); } if (node.Nodes[i].HasChildren) { IsChildsChecked(node.Nodes[i]); } } return(true); }
private void AccountGroup_GridView_FocusedRowChanged(object sender, FocusedRowChangedEventArgs e) { Account_TreeList.ClearColumnsFilter(); AccountGroup selectedRow = AccountGroup_GridView.GetFocusedRow().CastTo <AccountGroup>(); if (selectedRow == null) { return; } // filter grid Account_TreeList.ActiveFilterString = $"[AccountGroupID] = '{selectedRow.AccountGroupID}'"; DevExpress.XtraTreeList.Nodes.TreeListNode node = this.Account_TreeList.GetNodeByVisibleIndex(0); this.Account_TreeList.SetFocusedNode(this.Account_TreeList.GetNodeByVisibleIndex(0)); }
public override void Execute(DevExpress.XtraTreeList.Nodes.TreeListNode node) { if (NodeContainsPattern(node, pattern)) { node.Visible = true; if (node.ParentNode != null) { node.ParentNode.Visible = true; } } else { node.Visible = false; } }
/// <summary> /// 通过模块ID打开模块 /// </summary> /// <param name="id"></param> /// <param name="opennedFrom"></param> /// <param name="openState">调用者自定义的参数</param> public void OpenFunctionModuleById(int id, ModuleOpenState moduleOpenState) { DevExpress.XtraTreeList.Nodes.TreeListNode treeNode = trvListMain.FindNodeByFieldValue("ID", id); if (treeNode == null) { MB.WinBase.MessageBoxEx.Show("模块ID输入无效"); return; } if (treeNode.Nodes.Count > 0) { MB.WinBase.MessageBoxEx.Show("不是有效的功能模块节点ID"); return; } OpenModuleByTreeNode(treeNode, moduleOpenState); }
private void dxBarBtnSave_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { cxDBTreeList1.CloseEditor(); cxDBTreeList1.EndCurrentEdit(); var currDr = (DataRow)dtAccountPeriod.Rows[cxDBTreeList1.FocusedNode.Id]; if (currDr == null) { return; } //if (currDr.RowState == DataRowState.Added) //{ // currDr["COMP_PERIOD_CODE"] = currDr["COMPANY_ID"].ToString() + " - " + currDr["PERIOD_CODE"].ToString(); // currDr["COMP_MAJ_PERIOD_CODE"] = DBNull.Value; //} this.Cursor = Cursors.WaitCursor; /*splashScreenManager1.ShowWaitForm(); * splashScreenManager1.SetWaitFormDescription("");*/ if (currDr.RowState == DataRowState.Added || currDr.RowState == DataRowState.Modified) { try { if (Validation(cxDBTreeList1.FocusedNode)) { DevExpress.XtraTreeList.Nodes.TreeListNode tlNode = cxDBTreeList1.FocusedNode; if (tlNode != null) { var currDr1 = ((DataRowView)cxDBTreeList1.GetDataRecordByNode(tlNode)).Row; SaveAccountingPeriod(currDr1); } } } catch (Exception ex) { XtraMessageBox.Show(ex.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); //splashScreenManager1.CloseWaitForm(); //return; } } //splashScreenManager1.CloseWaitForm(); this.Cursor = Cursors.Default; }
/// <summary> /// 取选择变化后的对应表 /// </summary> /// <param name="p_dtDef">关联表</param> /// <param name="p_strFilter">关联表的过滤字段</param> /// <param name="p_intFilterValue">关联表过滤的值</param> /// <param name="p_strKeyName">对应的关键字段</param> public void GetChange(ref DataTable p_dtDef, string p_strFilter, object p_objFilterValue, string p_strKeyName) { DataView dv = new DataView(p_dtDef); string sf = p_dtDef.Columns[p_strFilter].DataType == typeof(String) ? "{0}='{1}'" : "{0}={1}"; dv.RowFilter = string.Format(sf, p_strFilter, p_objFilterValue); for (int i = 0; i < lstCheck.AllNodesCount; i++) { bool add = true; DevExpress.XtraTreeList.Nodes.TreeListNode tn = lstCheck.FindNodeByID(i); foreach (DataRowView r in dv) { if ((p_dtDef.Columns[p_strKeyName].DataType == typeof(String) && Convert.ToString(r[p_strKeyName]).Trim() == Convert.ToString(tn.GetValue(p_strKeyName)).Trim()) || (p_dtDef.Columns[p_strKeyName].DataType != typeof(String) && weCare.Core.Utils.Function.Dec(r[p_strKeyName]) == weCare.Core.Utils.Function.Dec(tn.GetValue(p_strKeyName)))) { add = false; if (!tn.Checked) { r.Delete(); } break; } } if (add && tn.Checked) { DataRow r = p_dtDef.NewRow(); if (p_dtDef.Columns[p_strFilter].DataType == typeof(String)) { r[p_strFilter] = Convert.ToString(p_objFilterValue); } else { r[p_strFilter] = weCare.Core.Utils.Function.Dec(p_objFilterValue); } if (p_dtDef.Columns[p_strKeyName].DataType == typeof(String)) { r[p_strKeyName] = Convert.ToString(tn.GetValue(p_strKeyName)); } else { r[p_strKeyName] = weCare.Core.Utils.Function.Dec(tn.GetValue(p_strKeyName)); } p_dtDef.Rows.Add(r); } } }
/// <summary> /// 移除节点后,判断其父节点是否也需要移除 /// </summary> /// <param name="node"></param> public void Remove(DevExpress.XtraTreeList.Nodes.TreeListNode node) { try { if (node.PrevNode.Nodes.Count == 1)// && node.PrevNode. != "Root") { Remove(node.PrevNode); } else { node.Remove(); } } catch { } }
private bool?GetCheckValue(DevExpress.XtraTreeList.Nodes.TreeListNode node) { if (node.GetValue("Bool0") == null || node.GetValue("Bool1") == null || node.GetValue("Bool0") == DBNull.Value || node.GetValue("Bool1") == DBNull.Value) { return(null); } if (Convert.ToBoolean(node.GetValue("Bool0")) == true && Convert.ToBoolean(node.GetValue("Bool1")) == true) { return(true); } if ((bool)node.GetValue("Bool0") == false && (bool)node.GetValue("Bool1") == false) { return(false); } return(null); }
/// <summary> /// 根据当前节点递归选中父节点 added by xs 2011.04.19 /// </summary> /// <param name="node">当前节点</param> public void ChangeChildCheck(DevExpress.XtraTreeList.Nodes.TreeListNode node, ref bool flag) { foreach (DevExpress.XtraTreeList.Nodes.TreeListNode item in node.Nodes) { flag = false; if (item.Nodes.Count == 0) { flag = true; } item.Checked = node.Checked; if (!flag) { ChangeChildCheck(item, ref flag); } } }
private DevExpress.XtraTreeList.Nodes.TreeListNode GetMacroNode(string p) { DevExpress.XtraTreeList.Nodes.TreeListNode macroNode = null; bool found = CheckNodeExist(null, p, ref macroNode); if (!found) { macroNode = uxTreeView.AppendNode(new object[] { p }, null); macroNode.Tag = p; } return(macroNode); }
private void LoadUser(User user) { grdUsers.Enabled = false; pnlUserInfo.Visible = true; userBindingSource.DataSource = user; if (user.Modules.Any(m => m.Key.Equals(HertexCore.Modules.Excelsior))) { foreach (Permission permission in user.Modules.FirstOrDefault(m => m.Key.Equals(HertexCore.Modules.Excelsior)).Value) { DevExpress.XtraTreeList.Nodes.TreeListNode node = treeList1.FindNodeByFieldValue("AutoIDX", int.Parse(permission.PermissionValue)); if (node != null) { node.Checked = true; } } } }
/// <summary> /// 向下遍历 /// </summary> /// <param name="node"></param> private void SetState(DevExpress.XtraTreeList.Nodes.TreeListNode node, int n) { if (node != null) { if (node.StateImageIndex != n) { node.StateImageIndex = n; } if (node.Nodes.Count > 0) { for (int i = 0; i < node.Nodes.Count; i++) { SetState(node.Nodes[i], n); } } } }
/// <summary> /// 关联表并显示 /// </summary> ///<param name="p_dtDef">定义关联的表</param> ///<param name="p_strKeyName">对应的关键字段</param> public void JoinDataSource(DataTable p_dtDef, string p_strKeyName) { for (int i = 0; i < lstCheck.AllNodesCount; i++) { DevExpress.XtraTreeList.Nodes.TreeListNode tn = lstCheck.FindNodeByID(i); tn.Checked = false; foreach (DataRow r in p_dtDef.Rows) { if ((p_dtDef.Columns[p_strKeyName].DataType == typeof(String) && Convert.ToString(r[p_strKeyName]).Trim() == Convert.ToString(tn.GetValue(p_strKeyName)).Trim()) || (p_dtDef.Columns[p_strKeyName].DataType != typeof(String) && weCare.Core.Utils.Function.Dec(r[p_strKeyName]) == weCare.Core.Utils.Function.Dec(tn.GetValue(p_strKeyName)))) { tn.Checked = true; break; } } } }
void loadTree() { try { DataTable tbl = TextUtils.Select("Select * from ProductGroup with(nolock) order by Code"); treeData.DataSource = tbl; treeData.KeyFieldName = "ID"; treeData.PreviewFieldName = "Name"; treeData.ExpandAll(); DevExpress.XtraTreeList.Nodes.TreeListNode currentNode = treeData.FindNodeByFieldValue("ID", _curentNode); treeData.SetFocusedNode(currentNode); } catch (Exception ex) { } }
protected override void AddObject() { CodeEditWindow form = new CodeEditWindow(2, CharacterCasing.Upper, false); form.FormClosed += (o, e) => { if (form.DialogResult == System.Windows.Forms.DialogResult.OK) { T_CodeType codeType = new T_CodeType() { Code = form.Code, Desc = form.Desc }; if (this.MatCodeTreeList.DataSource != null) { List <T_CodeType> codeList = this.MatCodeTreeList.DataSource as List <T_CodeType>; codeType.Id = codeList.Select(t => t.Id).Max() + 1; } else { codeType.Id = 0; } if (this.MatCodeTreeList.FocusedNode == null) { codeType.ParentId = -1; } else { codeType.ParentId = Convert.ToInt16(this.MatCodeTreeList.FocusedNode.GetValue("Id")); } //_Proxy.AddCodeType(codeType); this.MatCodeTreeList.BeginUnboundLoad(); DevExpress.XtraTreeList.Nodes.TreeListNode node = this.MatCodeTreeList.AppendNode(codeType, this.MatCodeTreeList.FocusedNode); node.SetValue("Id", codeType.Id); node.SetValue("Code", codeType.Code); node.SetValue("Desc", codeType.Desc); this.MatCodeTreeList.EndUnboundLoad(); } }; form.ShowDialog(); }
//<treeList1> private void SetCheckedNode(DevExpress.XtraTreeList.Nodes.TreeListNode node) { CheckState check = GetCheckState(node.Tag); if (check == CheckState.Indeterminate || check == CheckState.Unchecked) { check = CheckState.Checked; } else { check = CheckState.Unchecked; } treeList1.BeginUpdate(); node.Tag = check; SetCheckedChildNodes(node, check); SetCheckedParentNodes(node, check); treeList1.EndUpdate(); }
public void ChequearEnConsulta(List <Permiso> Consulta, DevExpress.XtraTreeList.Nodes.TreeListNode Nodos) { foreach (DevExpress.XtraTreeList.Nodes.TreeListNode Nodo in Nodos.Nodes) { foreach (var item in Consulta) { var obj = (((clsMenu)trlPerfil.GetDataRecordByNode(Nodo))); if (obj.IdMenu == item.IdMenu) { Nodo.Checked = true; } if (Nodo.HasChildren) { ChequearEnConsulta(Consulta, Nodo); } } } }
private void btnThem_Child_Click(object sender, EventArgs e) { if (!this.EnableAdd) { GoobizFrame.Windows.Forms.UserMessage.Show("SYS_NOTALLOW_ADD", new string[] { }); return; } //if (Convert.ToBoolean(treelist_Phucap.FocusedNode.GetValue("Phucap_Chung"))) //{ // return; //} treelist_Phucap.LockReloadNodes(); try { Frmrex_Dm_Chucvu_Add frmrex_Chucvu = new Frmrex_Dm_Chucvu_Add(true); GoobizFrame.Windows.MdiUtils.ThemeSettings.SetDialogShow(frmrex_Chucvu); frmrex_Chucvu.StartPosition = FormStartPosition.CenterScreen; frmrex_Chucvu.ShowDialog(); DevExpress.XtraTreeList.Nodes.TreeListNode nodeParent = treelist_Phucap.FocusedNode; if (frmrex_Chucvu.row_Select != null) { var Id_Dm_Phucap = long.MaxValue; foreach (DataRow r in frmrex_Chucvu.row_Select) { DevExpress.XtraTreeList.Nodes.TreeListNode node = treelist_Phucap.AppendNode(new object[] { }, nodeParent); node.SetValue("Id_Dm_Phucap", Id_Dm_Phucap--); node.SetValue("Ma_Phucap", r["Ma_Chucvu"]); node.SetValue("Ten_Phucap", r["Ten_Chucvu"]); node.SetValue("Id_Chucvu", r["Id_Chucvu"]); treelist_Phucap.Nodes.Add(node); treelist_Phucap.SetFocusedNode(node); } } } catch (Exception ex) { GoobizFrame.Windows.TrayMessage.TrayMessage.Status = new GoobizFrame.Windows.TrayMessage.TrayMessageInfo(MessageBoxIcon.Asterisk, ex.Message, ex.StackTrace); } finally { treelist_Phucap.UnlockReloadNodes(); } }
// ------------------------------------------------------------------------- public void ADD_TRENODE(DevExpress.XtraTreeList.TreeList treeView, DevExpress.XtraTreeList.Nodes.TreeListNode prjNode) { object[] oo = new object[] { this.Name }; DevExpress.XtraTreeList.Nodes.TreeListNode dsNode = treeView.AppendNode(oo, prjNode.Id, -1, -1, this.GET_DS_ICON( ), this); if (this.IS_FIXED( )) { // FIXED SNAPSHOT... object[] ooo = new object[] { this.SnapshotFile }; DevExpress.XtraTreeList.Nodes.TreeListNode child = treeView.AppendNode(ooo, dsNode.Id, -1, -1, this.GET_SS_ICON( ), this); dsNode.Expand( ); } else { // DYNAMIC SNAPSHOT... object[] ooo = new object[] { this.GET_SSP_FILENAME() }; DevExpress.XtraTreeList.Nodes.TreeListNode child = treeView.AppendNode(ooo, dsNode.Id, -1, -1, this.GET_SS_ICON( )); dsNode.Collapse( ); } }
//创建根节点 xisheng 20111128 public void CreatRootNode(IMap pMap, string strLayerTreePath, DevExpress.XtraTreeList.TreeList advTreeLayerList, bool isTbClick) { //初始化图层树列表 if (File.Exists(strLayerTreePath)) { if (_LayerTreeXmldoc == null) { _LayerTreeXmldoc = new XmlDocument(); } _LayerTreeXmldoc.Load(strLayerTreePath); advTreeLayerList.Nodes.Clear(); //获取Xml的根节点并作为根节点加到UltraTree上 XmlNode xmlnodeRoot = _LayerTreeXmldoc.DocumentElement; XmlElement xmlelementRoot = xmlnodeRoot as XmlElement; xmlelementRoot.SetAttribute("NodeKey", "Root"); string sNodeText = xmlelementRoot.GetAttribute("NodeText"); //创建并设定树的根节点 DevExpress.XtraTreeList.Nodes.TreeListNode treenodeRoot = new DevExpress.XtraTreeList.Nodes.TreeListNode(); //treenodeRoot.n = "Root"; //treenodeRoot.Text = sNodeText; treenodeRoot.Tag = "Root"; // treenodeRoot.DataKey = xmlelementRoot; treenodeRoot.Expanded = true; if (m_checkbox) { //treenodeRoot.CheckBoxVisible = true; treenodeRoot.Checked = true; } advTreeLayerList.Nodes.Add(treenodeRoot); //treenodeRoot = _Imagelist.Images["Root"]; if (_ListLayerKeys == null) { InitLayerTreeByXmlNode(pMap, treenodeRoot, xmlnodeRoot, isTbClick); } else { InitLayerTreeByLayerKeys(pMap, treenodeRoot, xmlnodeRoot, isTbClick); } } }
/// <summary> /// 右键文档夹菜单事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void contextMenuFiles_ItemClicked(object sender, ToolStripItemClickedEventArgs e) { this.contextMenuFiles.Visible = false; if (e.ClickedItem.Name == "cutFileItem") { // 剪切 cutNode = node; this.cutFileItem.Enabled = false; this.cutItem.Enabled = false; this.copyDocClassItem.Enabled = false; this.pasteItem.Enabled = true; } else if (e.ClickedItem.Name == "pasteItem") { // 粘贴 if (cutNode.Tag.GetType() == typeof(document)) { // 更新后台的数据 document doc = ((document)cutNode.Tag); doc.document_type_id = ((document_tree)node.Tag).id; doc.document_type_name = ((document_tree)node.Tag).name; // 调用接口来更新后台数据 //粘贴的当前节点添加 DevExpress.XtraTreeList.Nodes.TreeListNode tns = node.TreeList.AppendNode(doc.id, node); tns.SetValue(DocName, doc.cn_name); tns.SetValue(DocID, doc.id); tns.SetValue(DocType, "File"); tns.Tag = doc; //剪切的当前节点减少 this.treeList1.DeleteNode(cutNode); } else { document_tree docTree = (document_tree)cutNode.Tag; docTree.parent_id = ((document_tree)node.Tag).id; docTree.parent_name = ((document_tree)node.Tag).name; // 调用接口来更新后台数据 //粘贴的当前节点添加 DevExpress.XtraTreeList.Nodes.TreeListNode tns = node.TreeList.AppendNode(docTree.id, node); tns.SetValue(DocName, docTree.name); tns.SetValue(DocID, docTree.id); tns.SetValue(DocType, "Files"); tns.ImageIndex = 0; tns.Tag = docTree; GetCentralChild(tns, docTree.id, docTree.all_name); //剪切的当前节点减少 this.treeList1.DeleteNode(cutNode); } this.cutFileItem.Enabled = true; this.cutItem.Enabled = true; this.copyDocClassItem.Enabled = true; this.pasteItem.Enabled = false; } else if (e.ClickedItem.Name == "copyDocClassItem") { // 复制文档分类 this.cutFileItem.Enabled = false; this.cutItem.Enabled = false; this.copyDocClassItem.Enabled = false; this.pasteItem.Enabled = true; } else if (e.ClickedItem.Name == "expandAllItem") { // 展开 node.ExpandAll(); } else if (e.ClickedItem.Name == "collapseAllItem") { // 折叠 treeList1.CollapseAll(); } else if (e.ClickedItem.Name == "loadingItem") { // 加载文档 // 加载文档是指将该分类的分类和文档呈树形显示供查看其中内容; } else if (e.ClickedItem.Name == "addDocItem") { // 录入已有文档 // 录入已有文档是指将本地已完成的文档录入到PDM系统中; document document = new document(); document.document_type_id = ((document_tree)node.Tag).id; document.document_type_name = ((document_tree)node.Tag).all_name; DocModify docModify = new DocModify(document, 1); if (DialogResult.OK == docModify.ShowDialog()) { DevExpress.XtraTreeList.Nodes.TreeListNode tns = node.TreeList.AppendNode(docModify.docSave.id, node); tns.SetValue(DocName, docModify.docSave.cn_name); tns.SetValue(DocID, docModify.docSave.id); tns.SetValue(DocType, "Files"); tns.Tag = docModify.docSave; // 修改文档成功! MessageBox.Show("创建成功!"); } } else if (e.ClickedItem.Name == "importItem") { // 批量导入文档 // 文档批量导入是指将本地已完成的多个文档一次录入到PDM系统中; DocBulkImport import = new DocBulkImport((document_tree)node.Tag); if (DialogResult.OK == import.ShowDialog()) { // 批量导入成功! } } else if (e.ClickedItem.Name == "downDocItem") { // 下载 // 打开文件夹 FolderBrowserDialog dlg = new FolderBrowserDialog(); if (dlg.ShowDialog() == DialogResult.OK) { // 开启socket文件 SocketServer s = new SocketServer("127.0.0.1", 7774, dlg.SelectedPath + "\\"); s.start(); var files = from d in doclist where d.document_type_id != 0 && d.document_type_id == ((document_tree)node.Tag).id select d; if (files.Count() < 1) return; List<document> list = new List<document>(); foreach (document st in files) { st.ipaddress = "127.0.0.1"; st.port = 7774; list.Add(st); } bool flag = WcfServiceLocator.Create<IDocManageTool>().downDocumentAll(list); while (!(flag && s.flag)) { System.Threading.Thread.Sleep(1000); } s.lisner.Stop(); s.TempThread.Abort(); } } else if (e.ClickedItem.Name == "updateDocTreeStatusItem") { // 更新文档状态 // 更新文档状态是指将该分类下文档状态已改变而显示界面上无变化时,点击改变界面显示; } else if (e.ClickedItem.Name == "grantDocItem") { // 发放文档 // } else if (e.ClickedItem.Name == "permissionApplyDocItem") { // 申请权限 } else if (e.ClickedItem.Name == "scanDocGrantRItem") { // 查看文档发放规则 } else if (e.ClickedItem.Name == "addDocTreeItem") { // 增加文档分类 document_tree doct = new document_tree(); doct.parent_id = ((document_tree)node.Tag).id; doct.parent_name = ((document_tree)node.Tag).name; BuildDocCategory docCat = new BuildDocCategory(doct, 1); if (docCat.ShowDialog() == DialogResult.OK) { DevExpress.XtraTreeList.Nodes.TreeListNode tns = node.TreeList.AppendNode(docCat.docTree.id, node); tns.SetValue(DocName, docCat.docTree.name); tns.SetValue(DocID, docCat.docTree.id); tns.SetValue(DocType, "Files"); docCat.docTree.all_name = ((document_tree)(node.Tag)).all_name + @"\" + docCat.docTree.name; tns.Tag = docCat.docTree; // 添加成功! } } else if (e.ClickedItem.Name == "updatedocTreeItem") { // 修改文档分类 document_tree docType = new document_tree(); docType.parent_id = ((document_tree)node.Tag).parent_id; docType.parent_name = ((document_tree)node.Tag).parent_name; docType.id = ((document_tree)node.Tag).id; docType.name = ((document_tree)node.Tag).name; BuildDocCategory docCat = new BuildDocCategory(docType, 2); if (docCat.ShowDialog() == DialogResult.OK) { // 修改成功! ((document_tree)node.Tag).name = docCat.docTree.name; node.SetValue(DocName, docCat.docTree.name); } } else if (e.ClickedItem.Name == "delDocTreeItem") { // 删除文档分类 if (MessageBox.Show("确认删除?", "警告", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) { bool flag = WcfServiceLocator.Create<IDocManageTool>().delDocumentTree((document_tree)node.Tag); if (flag) { // 删除文件夹 this.treeList1.DeleteNode(node); } } } else if (e.ClickedItem.Name == "scanDocTypeItem") { // 查看文档分类 document_tree docType = new document_tree(); docType.parent_id = ((document_tree)node.Tag).parent_id; docType.parent_name = ((document_tree)node.Tag).parent_name; docType.id = ((document_tree)node.Tag).id; docType.name = ((document_tree)node.Tag).name; BuildDocCategory docCat = new BuildDocCategory(docType, 3); docCat.ShowDialog(); } else if (e.ClickedItem.Name == "execlEmportItem") { // excel导出 } else if (e.ClickedItem.Name == "userImportItem") { // 自定义导出 } else if (e.ClickedItem.Name == "docCountStaItem") { // 文档数量统计,统计该节点下文件的数目 int count = GetChildNodes(node); MessageBox.Show("共有文档" + count + "个"); } }
/// <summary> /// 判断是文件夹还是文件点击 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void treeList1_MouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { DevExpress.XtraTreeList.TreeListHitInfo hInfo = this.treeList1.CalcHitInfo(new Point(e.X, e.Y)); if (hInfo.HitInfoType == DevExpress.XtraTreeList.HitInfoType.Cell) //在单元格上右击了 { if (hInfo.Node.Tag.GetType() == typeof(document_tree)) { this.treeList1.ContextMenuStrip = this.contextMenuFiles; node = hInfo.Node; // 粘贴按钮不可用 //pasteItem.Enabled = false; } else { this.treeList1.ContextMenuStrip = this.contextMenuFile; node = hInfo.Node; selTreeNode = (document)hInfo.Node.Tag; } } } }
/// <summary> /// 文档树右击事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void treeList1_MouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { DevExpress.XtraTreeList.TreeListHitInfo hInfo = this.TreeUser.treeList1.CalcHitInfo(new Point(e.X, e.Y)); if (hInfo.HitInfoType == DevExpress.XtraTreeList.HitInfoType.Cell) //在单元格上右击了 { this.TreeUser.treeList1.ContextMenuStrip = this.contextMenuStrip1; userNode = hInfo.Node; } } }
/// <summary> /// 右键文档菜单事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void contextMenuFile_ItemClicked(object sender, ToolStripItemClickedEventArgs e) { this.contextMenuFile.Visible = false; if (e.ClickedItem.Name == "cutItem") { // 剪切 cutNode = node; this.cutFileItem.Enabled = false; this.cutItem.Enabled = false; this.copyDocClassItem.Enabled = false; this.pasteItem.Enabled = true; } else if (e.ClickedItem.Name == "controlBrowseItem") { // 控件浏览 // 开启socket文件 ,下载文件, SocketServer s = new SocketServer("127.0.0.1", 7774, @"G:\asp.net\" + selTreeNode.cn_name + "." + selTreeNode.format_name); s.start(); selTreeNode.physical_file_location = @"g:\11.xls"; selTreeNode.ipaddress = "127.0.0.1"; selTreeNode.port = 7774; // 再浏览 System.Diagnostics.Process.Start("rundll32.exe", @"shell32,OpenAs_RunDLL " + @"G:\asp.net\" + selTreeNode.cn_name + "." + selTreeNode.format_name); } else if (e.ClickedItem.Name == "browseItem") { //浏览 //获取选中的行 DocModify modify = new DocModify(selTreeNode, 3); if (DialogResult.OK == modify.ShowDialog()) { // 修改文档成功! MessageBox.Show("文档修改成功!"); } } else if (e.ClickedItem.Name == "downItem") { //下载 // 打开文件夹 FolderBrowserDialog dlg = new FolderBrowserDialog(); if (dlg.ShowDialog() == DialogResult.OK) { // 开启socket文件 SocketServer s = new SocketServer("127.0.0.1", 7774, dlg.SelectedPath + "\\"); s.start(); selTreeNode.physical_file_location = @"g:\11.xls"; selTreeNode.ipaddress = "127.0.0.1"; selTreeNode.port = 7774; bool flag = WcfServiceLocator.Create<IDocManageTool>().downDocument(selTreeNode); while (!(flag && s.flag)) { System.Threading.Thread.Sleep(1000); } s.lisner.Stop(); s.TempThread.Abort(); } } else if (e.ClickedItem.Name == "alterDocumentItem") { //修改文档 //获取选中的行 DocModify modify = new DocModify(selTreeNode, 2); if (DialogResult.OK == modify.ShowDialog()) { // 修改文档成功! MessageBox.Show("文档修改成功!"); } } else if (e.ClickedItem.Name == "delDocumentItem") { // 删除文档 if (DialogResult.OK == MessageBox.Show("确认删除!", "警告", MessageBoxButtons.OKCancel, MessageBoxIcon.Question)) { bool flag = WcfServiceLocator.Create<IDocManageTool>().delDocument(selTreeNode); // 调用后台删除方法,来删除数据! if (flag) { this.treeList1.DeleteNode(node); } } } else if (e.ClickedItem.Name == "pigeonholeItem") { // 归档文档 ,是选择正在执行的文档批量归档 } else if (e.ClickedItem.Name == "openWithItem") { //打开方式 } else if (e.ClickedItem.Name == "updateDocStatusItem") { //更新文档状态 } else if (e.ClickedItem.Name == "permissionApplyItem ") { //获取选中的行 //document doc = (document)this.gridView1.GetFocusedRow(); //DocModify modify = new DocModify(doc, 2); //List<document> list = new List<document>(); //list.Add(doc); //申请权限 // DocQuery.PermissionApply permissionApply = new DocQuery.PermissionApply(list); //if (DialogResult.OK == permissionApply.ShowDialog()) //{ // MessageBox.Show("申请权限成功!"); //} } else if (e.ClickedItem.Name == "prinApplyItem") { //申请打印 } else if (e.ClickedItem.Name == "grantItem") { // 发放文档 } else if (e.ClickedItem.Name == "grantHistoryItem") { //文档发放情况 } else if (e.ClickedItem.Name == "docPropertyItem") { // 文档属性 } else if (e.ClickedItem.Name == "updateHistoryItem") { //查看变更历史 } else if (e.ClickedItem.Name == "relationDocItem") { // 关联文档 DocModify modify = new DocModify(selTreeNode, 4); if (DialogResult.OK == modify.ShowDialog()) { // 修改文档成功! MessageBox.Show("文档修改成功!"); } } }
/// <summary> /// 文档树右击事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void treeList1_MouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { DevExpress.XtraTreeList.TreeListHitInfo hInfo = this.TreeDocTemplate.treeList1.CalcHitInfo(new Point(e.X, e.Y)); if (hInfo.HitInfoType == DevExpress.XtraTreeList.HitInfoType.Cell) //在单元格上右击了 { if (hInfo.Node.Tag.GetType() == typeof(doc_template_tree)) { this.TreeDocTemplate.treeList1.ContextMenuStrip = this.contextMenuStrip1; node = hInfo.Node; } else { this.TreeDocTemplate.treeList1.ContextMenuStrip = this.contextMenuStrip2; selTreeNode = (doc_template)hInfo.Node.Tag; node = hInfo.Node; } } } }
private void treeList1_FocusedNodeChanged(object sender, DevExpress.XtraTreeList.FocusedNodeChangedEventArgs e) { if (tabTreeQaqc.SelectedTabPageIndex == 0 && e.Node != null) // 0: the tray is waiting to analize { if (e.Node.ParentNode == null && e.Node.Level == 0) Focused_batch = e.Node; else if (e.Node.Level == 1) Focused_batch = e.Node.ParentNode; else Focused_batch = treeTrayWaiting.MoveFirst(); // --- get data by node selected if (Focused_batch.GetValue("Cod_repetition") != null && Focused_batch.GetValue("Id") != null && Focused_batch.GetValue("Idtemplate_method") != null && Focused_batch.GetValue("Cod_repetition").ToString().Trim().Length != 0 && Focused_batch.GetValue("Id").ToString().Trim().Length != 0 && Focused_batch.GetValue("Idtemplate_method").ToString().Trim().Length != 0) { Num_repetitions = Convert.ToInt32(Focused_batch.GetValue("Cod_repetition")); Idbatch = Convert.ToInt64(Focused_batch.GetValue("Id")); Idtemplate_method = Convert.ToInt32(Focused_batch.GetValue("Idtemplate_method")); Show_batch(); // --- OPTIMIZAR A USER CONTROL if (AllSamplesApproveSelected()) paAuthorization.Visible = true; else paAuthorization.Visible = false; } } InitConfigurationAbsStd(); }
private void treeTrayFinished_FocusedNodeChanged(object sender, DevExpress.XtraTreeList.FocusedNodeChangedEventArgs e) { if (tabTreeQaqc.SelectedTabPageIndex == 1 && e.Node != null) // --- only when the tray has finished { if (e.Node.ParentNode == null && e.Node.Level == 0) Focused_batch = e.Node; else if (e.Node.Level == 1) Focused_batch = e.Node.ParentNode; else Focused_batch = treeTrayWaiting.MoveFirst(); // --- get data by node selected Num_repetitions = Convert.ToInt32(Focused_batch.GetValue("Cod_repetition")); Idbatch = Convert.ToInt64(Focused_batch.GetValue("Id")); Idtemplate_method = Convert.ToInt32(Focused_batch.GetValue("Idtemplate_method")); Show_batch_finished(); } InitConfigurationAbsStd(); }