private void FlagChildren(TreeListNodes nodes, bool value)
 {
     foreach (TreeListNode node in nodes)
     {
         if (node.HasChildren)
         {
             this.FlagChildren(node.Nodes, value);
         }
         node[this.colVisible] = value;
         this.CheckNode(node, true);
     }
 }
Example #2
0
        string getcode(TreeListNode pnode, TreeListNodes nodes) {
            string code = "";
            int levenum = 3;
            if (pnode!=null && pnode.Level == 0) levenum = 4;
            string linecode = "";// pnode["LineCode"].ToString();
            if (pnode != null ) {//可能与低压线路重号
                linecode = pnode["LineCode"].ToString();
                string sql = string.Format("Select max(linecode) as LineCode from ps_xl where len(linecode)={2} and Left(linecode,{0})='{1}'", linecode.Length,linecode,linecode.Length+levenum);
                Hashtable ht = Client.ClientHelper.PlatformSqlMap.GetObject("Select", sql) as Hashtable;
                if (ht != null && ht["LineCode"]!=null) {
                    string childcode = ht["LineCode"].ToString();
                    if (!string.IsNullOrEmpty(childcode)) {
                        int maxcode = int.Parse(childcode.Substring(linecode.Length, levenum));
                        if (levenum == 4) {
                            code = linecode + (maxcode + 10).ToString("0000");
                        } else {
                            code = linecode + (maxcode + 1).ToString("000");
                        }
                    }
                }
            } 
           if(code==""){
               if (nodes.Count > 0) {
                   int maxcode = 0;
                   foreach (TreeListNode node in nodes) {
                       linecode = node["LineCode"].ToString();
                       maxcode = Math.Max(maxcode, int.Parse(linecode.Substring(linecode.Length - levenum, levenum)));
                   }
                   if (levenum == 4) {
                       code = linecode.Substring(0, linecode.Length - levenum) + (maxcode + 10).ToString("0000");
                   } else {
                       code = linecode.Substring(0, linecode.Length - levenum) + (maxcode + 1).ToString("000");
                   }

               } else 
               {
                    if (pnode != null) {
                        if (pnode.Level == 0)
                            code = pnode["LineCode"].ToString() + "0010";
                        else
                            code = pnode["LineCode"].ToString() + "001";
                    } else {
                        code = ParentObj.OrgCode + "001";
                    }
                }
            }

            return code;
        }
Example #3
0
        private void getCheckList(TreeListNodes nodes, IList<string> list)
        {
            foreach (TreeListNode node in nodes)
            {
                if (node.Checked && node["ParentID"].ToString() != "")
                {

                    list.Add(node["ID"].ToString());
                }
                if (node.HasChildren)
                {
                    this.getCheckList(node.Nodes, list);
                }
            }
        }
Example #4
0
        private void setImages(TreeListNodes nodes)
        {
	treeList1.BeginInit();
            foreach (TreeListNode node in nodes)
            {
                if (node.Nodes.Count > 0)
                {
                    setImages(node.Nodes);
                    node.ImageIndex = 0;
                }
                else
                {
                    node.ImageIndex = 1;
                }
            }
	treeList1.EndInit();
        }
Example #5
0
        private void AddDT(TreeListNodes Nodes)
        {
            foreach (TreeListNode Node in Nodes)
            {
                DataRow newrow = DT.NewRow();

                newrow["Title"] = AddStr(Node.Level) + Node["Title"].ToString();

                newrow["ID"] = Node["ID"].ToString();
                newrow["ParentID"] = Node["ParentID"].ToString();
                for (int i = firstyear; i <= endyear; i++)
                {
                    newrow["y" + i] = Node["y" + i];
                }
                DT.Rows.Add(newrow);
                if (Node.Nodes.Count>0)
                {
                    AddDT(Node.Nodes);
                }
            }
        }
Example #6
0
 int GetExpandedRowCount(TreeListNodes nodes) {
     int count = 0;
     foreach(TreeListNode node in nodes) {
         count++;
         if(node.Expanded)
             count += GetExpandedRowCount(node.Nodes);
     }
     return count;
 }
        private string GenerateSelectionFilterStringbyNodeNoLevel(TreeListNodes Nodes, DevExpress.XtraTreeList.TreeList treeList)
        {
            string Filter = "";
            foreach (TreeListNode tn in Nodes)
            {
                DataRowView dr = (treeList.GetDataRecordByNode(tn) as DataRowView);
                if (tn.Checked)
                    Filter = Filter + dr["Value"] + ",";
                else
                    Filter = Filter + GenerateSelectionFilterStringbyNode(tn.Nodes, treeList);

            }
            return Filter;
        }
Example #8
0
 private TreeListNode FindLastNode(TreeListNodes parentNodes, string name)
 {
     foreach (TreeListNode node in parentNodes)
     {
         if (node["NAME"].ToString() == name)
         {
             return node;
         }
     }
     return null;
 }
Example #9
0
 private void FoucsLocation(string id, TreeListNodes tlns)
 {
     foreach (TreeListNode tln in tlns)
     {
         if (tln["ID"].ToString() == id)
         {
             treeList1.FocusedNode = tln;
             return;
         }
         FoucsLocation(id, tln.Nodes);
     }
 }
Example #10
0
        private void getOrgCheckList(TreeListNodes nodes, IList<string> list)
        {
            foreach (TreeListNode node in nodes)
            {
                if (node.Checked && node["Type"].ToString() == "orgtemp")
                {

                    list.Add(node["UserID"].ToString());
                }
                if (node.HasChildren)
                {
                    this.getOrgCheckList(node.Nodes, list);
                }
            }
        }
        private bool FindNodeBySettings(TreeListNodes treeListNodes, int iDepths, int iCurrentDep, string[] arrSearchItems, ref TreeListNode objFindNode, int iColumnId = 0)
        {
            Logger.logBegin(string.Format("FindNodeBySettings with level [{0}]", iCurrentDep));

            try
            {
                IEnumerator en = treeListNodes.GetEnumerator();
                en.Reset();
                while (en.MoveNext())
                {
                    TreeListNode objOneItem = (TreeListNode)en.Current;
                    if (objOneItem.GetValue(iColumnId) == null) continue;
                    string strNodeCaption = objOneItem.GetValue(iColumnId).ToString();
                    Logger.Info("FindNodeBySettings", string.Format("tring to compare node value [{0}] against [{1}]", strNodeCaption, arrSearchItems[iCurrentDep]));

                    if (TigerMarsUtil.RegularTest(arrSearchItems[iCurrentDep], strNodeCaption))
                    {
                        if (iCurrentDep == iDepths - 1)
                        {
                            objFindNode = objOneItem;
                            /** expand all **/
                            ExpandParents(objOneItem);
                            return true;
                        }

                        if (objOneItem.HasChildren)
                        {
                            bool isFind = FindNodeBySettings(objOneItem.Nodes, iDepths, iCurrentDep + 1, arrSearchItems, ref objFindNode,iColumnId);
                            if (isFind)
                            {
                                Logger.Info("FindNodeBySettings", "find node");
                                return true;
                            }
                            else
                            {
                                Logger.Info("FindNodeBySettings", string.Format("Not find for node:[{0}] and its Descendants", strNodeCaption));
                                continue;
                            }
                        }
                        else
                        {
                            continue;
                        }
                    }
                    else
                    {
                        continue;
                    }
                }
                return false;
            }
            catch (Exception e)
            {
                Logger.Error("FindNodeBySettings",string.Format("Exceptions:[{0}]",e.Message),e);
                return false;
            }
            finally
            {
                Logger.logBegin(string.Format("FindNodeBySettings with level [{0}]", iCurrentDep));
            }
        }
Example #12
0
        string getcode(TreeListNode pnode, TreeListNodes nodes) {
            string code = "";
            int levenum = 3;
            //if (pnode != null && pnode.Level == 0) levenum = 4;
            string linecode = "";// pnode["LineCode"].ToString();
            if (pnode != null) {
                linecode = pnode["材料代码"].ToString();
                string sql = string.Format("Select max(材料代码) as LineCode from JH_yearkst where len(材料代码)={2} and Left(材料代码,{0})='{1}'", linecode.Length, linecode, linecode.Length + levenum);
                Hashtable ht = Client.ClientHelper.TransportSqlMap.GetObject("Select", sql) as Hashtable;
                if (ht != null && ht["LineCode"] != null) {
                    string childcode = ht["LineCode"].ToString();
                    if (!string.IsNullOrEmpty(childcode)) {
                        int maxcode = int.Parse(childcode.Substring(linecode.Length, levenum));
                        code = linecode + (maxcode + 1).ToString("000");
                    }
                }
            }
            if (code == "") {
                if (nodes.Count > 0) {
                    int maxcode = 0;
                    foreach (TreeListNode node in nodes) {
                        linecode = node["材料代码"].ToString();
                        maxcode = Math.Max(maxcode, int.Parse(linecode.Substring(linecode.Length - levenum, levenum)));
                    }
                    code = linecode.Substring(0, linecode.Length - levenum) + (maxcode + 1).ToString("000");
                } else {
                    if (pnode != null) {

                        code = pnode["材料代码"].ToString() + "001";
                    } else {
                        code = "001";
                    }
                }
            }

            return code;
        }
Example #13
0
 private void AddNode(TreeList tree, TreeListNodes nodeSource, TreeListNode nodeParent)
 {
     foreach (DevExpress.XtraTreeList.Nodes.TreeListNode nodeSub in nodeSource)
     {
         object[] objValues = new object[2];
         objValues[0] = nodeSub.GetValue("RuleName");
         objValues[1] = nodeSub.GetValue("rulesCount");
         TreeListNode nodeCurrent = tree.AppendNode(objValues, nodeParent);
         if (nodeSub.HasChildren)
         {
             AddNode(tree, nodeSub.Nodes, nodeCurrent);
         }
     }
 }
Example #14
0
 //����ID�ҵ�����㲢��Ϊ��ǰ���
 private void FindCurrentNodeById(TreeListNodes nodes, string ID)
 {
     foreach (TreeListNode node in nodes)
     {
         if (node["ID"].ToString() == ID)
         {
             treeList1.FocusedNode = node;
             break;
         }
         else
         {
             if (node.Nodes.Count != 0)
             {
                 FindCurrentNodeById(node.Nodes, ID);
             }
         }
     }
 }
Example #15
0
 private void AcceptSelectedNode_GroupChild(TreeListNodes nodes)
 {
     foreach (TreeListNode n in nodes)
     {
         if (n.Checked && n[IsGroupField].ToString() == "N")
         {
             SelectedNames += n[DisplayField].ToString() + ",";
             SelectedIDs.Add(HelpNumber.ParseInt64(n[IDField]));
         }
         AcceptSelectedNode_GroupChild(n.Nodes);
     }
 }
Example #16
0
        //�������ɺ�check��oldcheck��Ϊ���ֵ���Ա��´θ���ʱ���
        private void EqueValueBynode(TreeListNodes nodes)
        {
            //if (nodes != null)
            //{
            //    foreach (TreeListNode node in nodes)
            //    {
            //        EqueVlaueDataTable(node.GetValue("ID").ToString(), (CheckState)node.GetValue("check"), (CheckState)node.GetValue("check"));
            //        if (node.HasChildren)
            //        {
            //            EqueValueBynode(node.Nodes);
            //        }
            //    }

            //}
            if (nodes != null)
            {
                for (int i = 0; i < nodes.Count; i++)
                {
                    TreeListNode node = nodes[i];
                    EqueVlaueDataTable(node.GetValue("ID").ToString(), (CheckState)node.GetValue("check"), (CheckState)node.GetValue("check"));
                    if (node.HasChildren)
                    {
                        EqueValueBynode(node.Nodes);
                    }
                }

            }
        }
Example #17
0
        //��ѡ�����ı��ֵ��ѡ����
        private void AddorReduListBynode(TreeListNodes nodes, List<string> addlist,List<string> redulist)
        {
            if (nodes!= null)
            {
                foreach (TreeListNode node in nodes)
                {

                    if (node.ParentNode!=null&&node.GetValue("check").ToString() != "0" && node.GetValue("oldcheck").ToString() == "0")
                    {

                        AddListID.Add(node.GetValue("ID").ToString());
                        if (node.GetValue("nowunits").ToString()!="")
                        {
                            addlist.Add(node.GetValue("TypeName").ToString() + "(" + node.GetValue("nowunits").ToString()+")");
                        }
                        else
                        {
                            addlist.Add(node.GetValue("TypeName").ToString());
                        }

                    }
                    if (node.ParentNode != null && node.GetValue("check").ToString() == "0" && node.GetValue("oldcheck").ToString() != "0")
                    {
                        ReduceListID.Add(node.GetValue("ID").ToString());
                        if (node.GetValue("nowunits").ToString() != "")
                        {
                            redulist.Add(node.GetValue("TypeName").ToString() + "(" + node.GetValue("nowunits").ToString() + ")");
                        }
                         else
                        {
                            redulist.Add(node.GetValue("TypeName").ToString());
                        }
                    }
                    bool val1 = node.ParentNode != null && node.GetValue("check").ToString() != "0" && node.GetValue("oldcheck").ToString() == "0";
                    bool val2 = node.ParentNode != null && node.GetValue("check").ToString() == "0" && node.GetValue("oldcheck").ToString() != "0";
                    if (!val1 && !val2 && node.ParentNode != null && node.GetValue("nowunits").ToString() != node.GetValue("oldunits").ToString() && node.GetValue("check").ToString() != "0")
                    {
                        changeUnitlistID.Add(node.GetValue("ID").ToString());
                        if (node.GetValue("nowunits").ToString() != "")
                        {
                             changeUnitlist.Add(node.GetValue("TypeName").ToString() + "(" + node.GetValue("nowunits").ToString() + ")");
                        }
                        else
                        {
                            changeUnitlist.Add(node.GetValue("TypeName").ToString());
                        }
                    }
                    if (node.HasChildren)
                    {
                        AddorReduListBynode(node.Nodes, addlist, redulist);
                    }

                }

            }
        }
Example #18
0
 CheckState GetParentNodeState(TreeListNodes nodes) {
     CheckState state = nodes[0].CheckState;
     foreach (TreeListNode node in nodes)
         if (node.CheckState != state) return CheckState.Indeterminate;
     return state;
 }
Example #19
0
 private void ProcessTreeValidity(TreeListNodes nodesToProcess)
 {
     foreach (TreeListNode node in nodesToProcess)
     {
         if (GetNodeCheckState(node) == CheckState.Unchecked && node.ImageIndex == GreenBulletValue)
         {
             continue;
         }
         ValidateNode(node);
         ProcessTreeValidity(node.Nodes);
     }
 }
Example #20
0
        private bool IsAllChecked(TreeListNodes node)
        {
            bool bol = true;

            foreach (TreeListNode subNode in node)
            {
                if (!subNode.Checked)
                {
                    bol = false;
                    return bol;
                }
                else
                {
                    bol = IsAllChecked(subNode.Nodes);
                    if (!bol)
                    {
                        return bol;
                    }
                }
            }
            return bol;
        }
Example #21
0
        //private void SetChecked(TreeListNodes nodes, Dictionary<string, rUserRole> dic) {
        //    foreach (TreeListNode node in nodes) {
        //        if (dic.ContainsKey(node["UserID"].ToString()))
        //        {
        //            node.Checked = true;
        //            if (node.ParentNode != null && !node.ParentNode.Checked)
        //                node.ParentNode.Checked = true;
        //        }
        //        if (node.HasChildren) {
        //            this.SetChecked(node.Nodes, dic);
        //        }
        //    }
        //}

        private void SetChecked(TreeListNodes nodes, Dictionary<string, string > dic)
        {
            foreach (TreeListNode node in nodes)
            {
                if (dic.ContainsKey(node["UserID"].ToString()))
                {
                    node.Checked = true;
                    if (node.ParentNode != null && !node.ParentNode.Checked)
                        node.ParentNode.Checked = true;
                }
                if (node.HasChildren)
                {
                    this.SetChecked(node.Nodes, dic);
                }
            }
        }
 private TreeListNode NodeByName(TreeListNodes nodes, string name)
 {
     TreeListNode node = null;
     foreach (TreeListNode node2 in nodes)
     {
         if (node2.HasChildren && (node == null))
         {
             node = this.NodeByName(node2.Nodes, name);
         }
         if (node2.GetValue(this.colFilterName).ToString() == name)
         {
             return node2;
         }
     }
     return node;
 }
 private string CaptureAllValuesOfSubNodes(TreeListNodes lstNodes, int iColId)
 {
     Logger.logBegin("CaptureAllValuesOfSubNodes");
     string strResult = "",strCaption;
     foreach (TreeListNode objNode in lstNodes)
     {
         strCaption=objNode.GetValue(iColId).ToString() ;
         strResult = string.IsNullOrEmpty(strResult) ? strCaption : string.Format("{0}\r\n{1}", strResult, strCaption);
         if (objNode.HasChildren && objNode.Expanded)
         {
             strCaption = CaptureAllValuesOfSubNodes(objNode.Nodes, iColId);
             strResult = string.IsNullOrEmpty(strResult) ? strCaption : string.Format("{0}\r\n{1}", strResult, strCaption);
         }
     }
     Logger.logEnd("CaptureAllValuesOfSubNodes");
     return strResult;
 }
Example #24
0
 private void SetChecked(TreeListNodes nodes, Dictionary<string, rRoleModul> dic) {
     foreach (TreeListNode node in nodes) {
         if (dic.ContainsKey(node["Modu_ID"].ToString())) {
             node.Checked = true;
         }
         if (node.HasChildren) {
             this.SetChecked(node.Nodes, dic);
         }
     }
 }
Example #25
0
 void CreateMessagesList(TreeListNodes nodes)
 {
     foreach (TreeListNode node in nodes)
     {
         CreateMessagesForNode(node);
         CreateMessagesList(node.Nodes);
     }
 }
Example #26
0
        private List<SYS_tblPermissionDTO> GetAllPermission(TreeListNodes nodes)
        {
            List<SYS_tblPermissionDTO> permissionList = new List<SYS_tblPermissionDTO>();
            try
            {
                this.Cursor = Cursors.WaitCursor;
                foreach (TreeListNode node in nodes)
                {
                    permissionList.Add(new SYS_tblPermissionDTO
                    {
                        ID = node.GetValue(tlcID) + "",
                        FunctionID = node.GetValue(tlcFunctionID) + "",
                        AllowAll = Convert.ToBoolean(node.GetValue(tlcAllowAll)),
                        AllowInsert = Convert.ToBoolean(node.GetValue(tlcAllowInsert)),
                        AllowUpdate = Convert.ToBoolean(node.GetValue(tlcAllowUpdate)),
                        AllowDelete = Convert.ToBoolean(node.GetValue(tlcAllowDelete)),
                        AllowAccess = Convert.ToBoolean(node.GetValue(tlcAllowAccess)),
                        AllowPrint = Convert.ToBoolean(node.GetValue(tlcAllowPrint)),
                        AllowImport = Convert.ToBoolean(node.GetValue(tlcAllowImport)),
                        AllowExport = Convert.ToBoolean(node.GetValue(tlcAllowExport)),
                        UserLevelID = node.GetValue(tlcUserLevel) + "",
                        Note = node.GetValue(tlcNote) + ""
                    });

                    permissionList.AddRange(GetAllPermission(node.Nodes));
                }
            }
            catch (Exception ex)
            {
                CommonEngine.ShowExceptionMessage(ex);
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }

            return permissionList;
        }
Example #27
0
        private IEnumerable<int?> SaveNodeStates(TreeListNodes nodes)
        {
            foreach (TreeListNode treeListNode in nodes)
            {
                if (treeListNode.Expanded)
                {
                    var data = (Drawing) tlDarwings.GetDataRecordByNode(treeListNode);
                    yield return data.Id;

                    foreach (var id in SaveNodeStates(treeListNode.Nodes))
                    {
                        yield return id;
                    }
                }
            }
        }
Example #28
0
        private async Task SavePermission(TreeListNodes nodes, bool is_user)
        {
            List<SYS_tblPermissionDTO> permissionList = new List<SYS_tblPermissionDTO>();
            try
            {
                CommonEngine.ShowWaitForm(this);
                SYS_tblPermissionDRO result = new SYS_tblPermissionDRO();
                permissionList = GetAllPermission(nodes);

                foreach (var item in oldPermissionList)
                {
                    var _item = (from per in permissionList
                                 where per.ID == item.ID && per.FunctionID == item.FunctionID
                                 select per).FirstOrDefault();
                    if (_item != null)
                    {
                        if (_item.AllowInsert == item.AllowInsert && _item.AllowUpdate == item.AllowUpdate
                        && _item.AllowDelete == item.AllowDelete && _item.AllowPrint == item.AllowPrint
                        && _item.AllowImport == item.AllowImport && _item.AllowExport == item.AllowExport
                        && _item.AllowAll == item.AllowAll && _item.AllowAccess == item.AllowAccess
                        && _item.UserLevelID == item.UserLevelID && _item.Note == item.Note)
                            permissionList.Remove(_item);
                    }
                }

                string strMessage = LanguageEngine.GetMessageCaption("000024", ConfigEngine.Language).Replace("$Type$", is_user ? (ConfigEngine.Language.Equals("vi") ? "người dùng" : "user") : (ConfigEngine.Language.Equals("vi") ? "nhóm người dùng" : "group user")).Replace("$Name$", trlUser.FocusedNode.GetDisplayText(tlcName));

                result = await SYS_tblPermissionBUS.UpdatePermission(CommonEngine.userInfo.UserID, ConfigEngine.Language, permissionList, is_user, new SYS_tblActionLogDTO
                {
                    Activity = BaseConstant.COMMAND_INSERT_EN,
                    UserID = CommonEngine.userInfo.UserID,
                    LanguageID = ConfigEngine.Language,
                    ActionEN = BaseConstant.COMMAND_UPDATE_EN,
                    ActionVN = BaseConstant.COMMAND_UPDATE_VI,
                    FunctionID = "24",
                    DescriptionVN = strMessage.Replace("$IsError$", "thành công"),
                    DescriptionEN = strMessage.Replace("$IsError$", "successfully")
                });
                CommonEngine.CloseWaitForm();
                if (CommonEngine.CheckValidResponseItem(result.ResponseItem))
                {
                    if (string.IsNullOrEmpty(result.ResponseItem.Message))
                        CommonEngine.ShowMessage(strMessage.Replace("$IsError$", ConfigEngine.Language.Equals("vi") ? "thành công" : "successfully").Trim(), MessageType.Success);
                    else CommonEngine.ShowMessage(strMessage.Replace("$IsError$", ConfigEngine.Language.Equals("vi") ? "thất bại" : "failed").Trim(), MessageType.Error);

                    await LoadPermission(trlUser.FocusedNode.GetDisplayText(tlcCode) + "", rootNode, trlUser.FocusedNode.Level == 0 ? false : true);
                }
                else return;
            }
            catch (Exception ex)
            {
                CommonEngine.ShowExceptionMessage(ex);
            }
        }
Example #29
0
        private void CheckNodes(TreeListNodes nodes, CheckState state)
        {
            foreach (TreeListNode node in nodes)
            {
                if (node.ImageIndex == FOLDERICON || node.ImageIndex == FOLDERICON_EXPAND)
                    continue;

                node.CheckState = state;

                AfterCheckNode(node);
            }
        }
 private static void TreeListExpanded(TreeListNodes treeListNodes, ICollection<object> nodesPath)
 {
     if (treeListNodes == null)
     {
         return;
     }
     if (treeListNodes.Count > 0)
     {
         foreach (TreeListNode treeListNode in treeListNodes)
         {
             if (treeListNode.Expanded)
             {
                 nodesPath.Add(treeListNode.GetValue(TreeListHelper._treeList.Columns[1].FieldName));
                 TreeListHelper.TreeListExpanded(treeListNode.Nodes, nodesPath);
             }
         }
     }
 }