private void Fill()
        {
            try
            {
                Models.Archive archive = new Archive();

                doc = XDocument.Load(paths);
                var q = from clg in doc.Elements("collages").Elements("collage") select clg;

                    foreach (var elem in q)
                    {
                        Collage c = new Collage();
                        c.storyId = new List<string>();
                        c.id = Int32.Parse(elem.Element("id").Value);

                        c.collageName = elem.Element("collageName").Value;
                        var ids = from s in elem.Elements("storyId") select s;
                        foreach (var id in ids)
                        {
                            c.storyId.Add(id.Value.ToString());
                        }
                        CollectionList.Add(c);

                    }
                }

            catch
            {
                return;
            }
            return;
        }
Exemple #2
0
        private void Fill_collage()
        {
            try
            {
                Models.Archive archive = new Archive();

                List<int> styId = new List<int>();
                foreach (int a in archive.archiveList)
                {
                    string collection = HttpContext.Current.Server.MapPath("~\\App_Data\\StoryCollection.xml");
                    XDocument docu = XDocument.Load(collection);

                    var cos = from s in docu.Element("collages").Elements("collage") select s;
                    foreach (var co in cos)
                    {
                        if (co.Element("id").Value == a.ToString())
                        {
                            var ids = from s in co.Elements("storyId") select s;
                            foreach (var id in ids)
                            {
                                styId.Add(Int32.Parse(id.Value));
                            }
                        }
                    }
                }

                    doc = XDocument.Load(path);
                    var q = from sty in doc.Elements("collages").Elements("collage").Elements("story") select sty;
                    foreach (var elem in q)
                    {
                        Story c = new Story();
                        c.id = Int32.Parse(elem.Element("id").Value);
                        c.storyCaption = elem.Element("storyCaption").Value;
                        c.storyTime = elem.Element("storyTime").Value;
                        c.storyOrder = elem.Element("storyOrder").Value;

                        storyList.Add(c);
                        foreach (int i in styId)
                        {
                            if (i == c.id)
                            {
                                storyList.Remove(c);
                            }
                        }
                    }

            }
            catch
            {
                return;
            }
            return;
        }