ÎļþÃû´Ó DevApp/Gs.DevApp/DevFrm/Work/SelectDictionary.cs ÐÞ¸Ä |
| | |
| | | using DevExpress.XtraEditors; |
| | | using DevExpress.XtraTreeList; |
| | | using DevExpress.XtraTreeList; |
| | | using DevExpress.XtraTreeList.Nodes; |
| | | using Gs.DevApp.Entity; |
| | | using Gs.DevApp.ToolBox; |
| | | using Newtonsoft.Json; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Data; |
| | | using System.Text; |
| | | using System.Windows.Forms; |
| | | |
| | | |
| | | namespace Gs.DevApp.DevFrm.Work |
| | | { |
| | | public partial class SelectDictionary : DevExpress.XtraEditors.XtraForm |
| | | public partial class UcDictionarySelect : DevExpress.XtraEditors.XtraForm |
| | | { |
| | | private List<string> lstCheckedKeyID = new List<string>();//éæ©å±IDéå |
| | | string strTitle = ""; |
| | | string strWhere = ""; |
| | | public SelectDictionary(string _strTitle, string _strWhere) |
| | | public UcDictionarySelect(string _strTitle, string _strWhere) |
| | | { |
| | | InitializeComponent(); |
| | | tlMenu.CustomDrawNodeCheckBox += TreeList1_CustomDrawNodeCheckBox; |
| | |
| | | this.Text = _strTitle; |
| | | btnIn.Click += (s, e) => |
| | | { |
| | | findOrigin(tlMenu); |
| | | var list = new List<dynamic>(); |
| | | list.Add(new |
| | | foreach (string key in lstCheckedKeyID) |
| | | { |
| | | dicCode = "001", |
| | | dicTxt = "test1" |
| | | }); |
| | | list.Add(new |
| | | { |
| | | // dicCode = "001", |
| | | dicTxt = key |
| | | }); |
| | | }; |
| | | UpdateParent?.Invoke(this, |
| | | new UpdateParentEventArgs { DynamicList = list }); |
| | | Close(); |
| | |
| | | MsgHelper.Warning("æç¤ºï¼" + ex.Message); |
| | | } |
| | | } |
| | | |
| | | |
| | | #region MyRegion |
| | | |
| | | /// <summary> |
| | | /// è·åéæ©ç¶æçæ°æ®ä¸»é®IDéå |
| | | /// </summary> |
| | | /// <param name="parentNode">ç¶çº§èç¹</param> |
| | | private void GetCheckedKeyID(TreeListNode parentNode) |
| | | { |
| | | if (parentNode.Nodes.Count == 0) |
| | | { |
| | | return;//éå½ç»æ¢ |
| | | } |
| | | foreach (TreeListNode node in parentNode.Nodes) |
| | | { |
| | | if (node.CheckState == CheckState.Checked) |
| | | { |
| | | DataRowView drv = tlMenu.GetDataRecordByNode(node) as DataRowView;//å
³é®ä»£ç ï¼å°±æ¯ä¸ç¥éæ¯è¿æ ·è·åæ°æ®èçº ç»äºå¾ä¹
(鬼ç¥éå¯ä»¥è½¬æ¢ä¸ºDataRowViewå) |
| | | if (drv != null) |
| | | { |
| | | string KeyFieldName = (string)drv["defectName"]; |
| | | lstCheckedKeyID.Add(KeyFieldName); |
| | | } |
| | | } |
| | | GetCheckedKeyID(node); |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// è·åéä¸çèç¹ |
| | | /// </summary> |
| | | /// <param name="tree"></param> |
| | | private void findOrigin(DevExpress.XtraTreeList.TreeList tree) |
| | | { |
| | | this.lstCheckedKeyID.Clear(); |
| | | |
| | | if (tree.Nodes.Count > 0) |
| | | { |
| | | foreach (TreeListNode root in tree.Nodes) |
| | | { |
| | | GetCheckedKeyID(root); |
| | | } |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | } |
| | | } |