示例#1
0
 public ActionResult Adm(string id)
 {
     var list = new List<DayStory>();
     var dirs = new DirectoryInfo(_root);
     var fldrs = dirs.GetDirectories();
     foreach (var dirInfo in fldrs) {
         var d = new DayStory().GetAllDays(dirInfo.Name);
         list.AddRange(d);
     }
     return View(list);
 }
示例#2
0
        public ActionResult Day(BasePath b)
        {
            var d = new DayStory();
            if (b.Date == null) {
                d.Day = DateTime.Now.ToShortDateString();
                //d.Category = "main";
            }
            else {
                d = DayStory.GetSingleDay(b);
            }

            return View("Day", d);
        }
示例#3
0
        public ActionResult SaveDay(FormCollection collection)
        {
            var d = new DayStory {Day = collection[0], Header = collection[1], Text = collection[3], Category = collection[2]};

               try {
                DayStory.Save(d);
               return Redirect("/Home/UploadEdit/" + d.Category + "/" + d.Day);

               }
            catch(Exception ex) {
                throw ex;
            }
        }
示例#4
0
        public static void Save(DayStory d)
        {
            if (d.Category.Length == 0)
                d.Category = "main";

            var sPath = ConfigurationManager.AppSettings["UploadUrl"] + d.Category + "\\" + d.Day;
            Directory.CreateDirectory(sPath);
            Directory.CreateDirectory(sPath+"\\thumbnails");

            TextFile.CreateFile(sPath + "\\main.txt");
            TextFile.AppendToFile(sPath + "\\main.txt", d.Text);

            TextFile.CreateFile(sPath + "\\header.txt");
            TextFile.AppendToFile(sPath + "\\header.txt", d.Header);

            TextFile.CreateFile(sPath + "\\category.txt");
            TextFile.AppendToFile(sPath + "\\category.txt", d.Category);
        }
示例#5
0
        public static void Save(DayStory d)
        {
            if (d.Category.Length == 0)
            {
                d.Category = "main";
            }

            var sPath = ConfigurationManager.AppSettings["UploadUrl"] + d.Category + "\\" + d.Day;

            Directory.CreateDirectory(sPath);
            Directory.CreateDirectory(sPath + "\\thumbnails");

            TextFile.CreateFile(sPath + "\\main.txt");
            TextFile.AppendToFile(sPath + "\\main.txt", d.Text);

            TextFile.CreateFile(sPath + "\\header.txt");
            TextFile.AppendToFile(sPath + "\\header.txt", d.Header);

            TextFile.CreateFile(sPath + "\\category.txt");
            TextFile.AppendToFile(sPath + "\\category.txt", d.Category);
        }
示例#6
0
 //toDo: Exclude data to ext ilayer and dal-class
 public static DayStory GetSingleDay(BasePath b)
 {
     try {
         var d = new DayStory();
         var date = b.Date;
         d.Day = date;
         string sPath = String.Concat(b.Path, b.Category, "\\", b.Date + "\\");
         d.Text = TextFile.ReadFileWithoutEncoding(sPath + "main.txt");
         d.Header = TextFile.ReadFileWithoutEncoding(sPath + "header.txt");
         d.Category = TextFile.ReadFileWithoutEncoding(sPath + "category.txt");
         d.Comments = Reply.GetReplies(sPath);
         if (Image.GetAllImages(b).Count > 0) {
             d.Img = Image.GetAllImages(b)[0].Url;
             d.Images = Image.GetAllImages(b);
         }
         return d;
         //diaryText = diaryText.Replace("\r\n", "<br>").Replace("\r", "<br>").Replace("\n", "<br>");
     }
     catch (Exception ex) {
         return null;
         //throw ex;
     }
 }
示例#7
0
        //toDo: Exclude data to ext ilayer and dal-class

        public static DayStory GetSingleDay(BasePath b)
        {
            try {
                var d    = new DayStory();
                var date = b.Date;
                d.Day = date;
                string sPath = String.Concat(b.Path, b.Category, "\\", b.Date + "\\");
                d.Text     = TextFile.ReadFileWithoutEncoding(sPath + "main.txt");
                d.Header   = TextFile.ReadFileWithoutEncoding(sPath + "header.txt");
                d.Category = TextFile.ReadFileWithoutEncoding(sPath + "category.txt");
                d.Comments = Reply.GetReplies(sPath);
                if (Image.GetAllImages(b).Count > 0)
                {
                    d.Img    = Image.GetAllImages(b)[0].Url;
                    d.Images = Image.GetAllImages(b);
                }
                return(d);
                //diaryText = diaryText.Replace("\r\n", "<br>").Replace("\r", "<br>").Replace("\n", "<br>");
            }
            catch (Exception ex) {
                return(null);
                //throw ex;
            }
        }
示例#8
0
 public ActionResult Upload(DayStory d)
 {
     return View("Upload", d);
 }