コード例 #1
0
        private Tuple <List <ReceivedLetter>, List <SendLetter> > GetChildItem(Guid parentId, Tuple <List <ReceivedLetter>, List <SendLetter> > emptylists)
        {
            var gettedRow = GetRowsByParent(parentId);


            if (gettedRow.Count > 0) // If this item have childs then i print them
            {
                //Label1.Text += "<ul>";
                foreach (var row in gettedRow)
                {
                    if (row.ParentSendLetterOut != null && row.ParentSendLetterOut.Count > 0)
                    {
                        foreach (var row2 in row.ParentSendLetterOut)
                        {
                            emptylists.Item1.Add(row2);
                            ReceiveLetterManager myReceiveLetterManager = new ReceiveLetterManager();
                            myReceiveLetterManager.GetChildItems(row2.Id, emptylists);
                        }
                        emptylists.Item2.Add(row);
                    }
                    GetChildItems(row.Id, emptylists); // Search for childs that belong to this item
                }
            }
            return(emptylists);
        }
コード例 #2
0
        //Logic to find Childrens of a parent

        public Tuple <List <ReceivedLetter>, List <SendLetter> > GetChildItems(Guid parentId, Tuple <List <ReceivedLetter>, List <SendLetter> > emptylists)
        {
            SendLetter sendLetter = Read(x => x.Id == parentId, null,
                                         "ParentSendLetterOut,ParentSendLetter").First();

            if (sendLetter != null)
            {
                emptylists.Item2.Add(sendLetter);
                if (sendLetter.ParentSendLetterOut != null && sendLetter.ParentSendLetterOut.Count > 0)
                {
                    foreach (var row2 in sendLetter.ParentSendLetterOut)
                    {
                        emptylists.Item1.Add(row2);
                        ReceiveLetterManager myReceiveLetterManager = new ReceiveLetterManager();
                        myReceiveLetterManager.GetChildItems(row2.Id, emptylists);
                    }
                }
                GetChildItem(parentId, emptylists);
                //emptylists.Item1.AddRange(sendLetter.ParentSendLetterOut);
            }
            return(emptylists);
        }