예제 #1
0
        public DayExtra GetDayExtra(DateTime day)
        {
            DayExtra d = new DayExtra();

            d.Date = day;
            return(d);
        }
예제 #2
0
        public void Load()
        {
            if (comments.Count > 0)
            {
                loaded = true;
            }
            if (loaded)
            {
                return;
            }

            if (BlogXData.Resolver != null)
            {
                string fullPath = BlogXData.ResolvePath(FileName);
                if (File.Exists(fullPath))
                {
                    XmlSerializer ser = new XmlSerializer(typeof(DayExtra));
                    using (StreamReader reader = new StreamReader(fullPath))
                    {
                        DayExtra e = (DayExtra)ser.Deserialize(reader);
                        this.comments = e.comments;
                    }
                }
            }
            loaded = true;
        }
예제 #3
0
        public static void CreateDummyData()
        {
            for (int year = 2000; year < 2003; year++)
            {
                for (int day = 1; day < 28; day++)
                {
                    for (int month = 1; month < 13; month++)
                    {
                        DayEntry dayEntry = new DayEntry();
                        dayEntry.Initialize();
                        dayEntry.Date = new DateTime(year, month, day);

                        DayExtra dayExtra = new DayExtra();
                        dayExtra.Initialize();
                        dayExtra.Date = new DateTime(year, month, day);

                        for (int i = 0; i < 18; i++)
                        {
                            Entry e = new Entry();
                            e.Initialize();
                            e.Content = dayEntry.Date.DayOfWeek.ToString() + @"<br /> " + e.EntryId + @"
Hello <i>world</i> Hello <i>world</i> 
Hello <i>world</i> Hello <i>world</i> Hello <i>world</i> Hello <i>world</i> 
Hello <i>world</i> Hello <i>world</i> Hello <i>world</i> Hello <i>world</i> 
Hello <i>world</i> Hello <i>world</i> Hello <i>world</i> Hello <i>world</i> 
Hello <i>world</i> Hello <i>world</i> Hello <i>world</i> Hello <i>world</i> 
Hello <i>world</i> Hello <i>world</i> Hello <i>world</i> Hello <i>world</i> 
Hello <i>world</i> Hello <i>world</i> Hello <i>world</i> Hello <i>world</i> 
Hello <i>world</i> Hello <i>world</i> Hello <i>world</i> Hello <i>world</i> 
Hello <i>world</i> Hello <i>world</i> Hello <i>world</i> Hello <i>world</i> 
Hello <i>world</i> Hello <i>world</i> Hello <i>world</i> Hello <i>world</i> 
Hello <i>world</i> Hello <i>world</i> Hello <i>world</i> Hello <i>world</i> 
Hello <i>world</i> Hello <i>world</i> Hello <i>world</i> Hello <i>world</i> 
item #" + i;
                            e.Title   = "[" + dayEntry.Date.DayOfWeek.ToString() + "] title " + i;
                            switch (i % 4)
                            {
                            case 0:
                                e.Categories = "Software";
                                break;

                            case 1:
                                e.Categories = "Borg;";
                                break;

                            case 2:
                                e.Categories = "Software;Borg;";
                                break;

                            case 3:
                                e.Categories = "";
                                break;
                            }
                            dayEntry.Entries.Add(e);

                            for (int j = 0; j < (i / 3); j++)
                            {
                                Comment c = new Comment();
                                c.Initialize();
                                c.TargetEntryId  = e.EntryId;
                                c.Author         = "Chris Anderson";
                                c.AuthorEmail    = "*****@*****.**";
                                c.AuthorHomepage = "http://www.simplegeek.com";
                                c.Content        = j + " this is <i>a</i> comment. this is <i>a</i> comment. this is <i>a</i> comment. this is <i>a</i> comment. this is <i>a</i> comment. this is <i>a</i> comment. this is <i>a</i> comment. this is <i>a</i> comment.";
                                dayExtra.Comments.Add(c);
                            }
                        }

                        dayEntry.Save();
                        dayExtra.Save();
                    }
                }
            }
        }