Esempio n. 1
0
        //读现有日记文件夹
        public IActionResult ReadDiary()
        {
            Stopwatch sw = new Stopwatch();

            sw.Start();
            string dirpath = @"C:\temp\diary\";

            string[]      ss = System.IO.Directory.GetFiles(dirpath);
            StringBuilder sb = new StringBuilder();

            foreach (var item in ss)
            {
                try
                {
                    string title = new System.IO.FileInfo(item).Name;
                    string body  = System.IO.File.ReadAllText(item);
                    if (diarydal.CalcCount($"title='{title}'") == 0)
                    {
                        diarydal.Add(new Model.Diary()
                        {
                            title = title, body = body, createtime = DateTime.Now
                        });
                    }
                }
                catch (Exception ex)
                {
                    sb.Append($"插入【{item}】出错:【{ex.Message}】 ");
                    continue;
                }
            }
            sw.Stop();
            sb.Append("运行时间:" + sw.ElapsedMilliseconds + "毫秒");
            return(Content(sb.ToString()));
        }
Esempio n. 2
0
        public IActionResult Welcome()
        {
            ViewBag.blogcount    = blogdal.CalcCount("");
            ViewBag.casecount    = casedal.CalcCount("remark='case'");
            ViewBag.videocount   = casedal.CalcCount("remark='video'");
            ViewBag.diarycount   = diarydal.CalcCount("");
            ViewBag.shuqiancount = sqdal.CalcCount("");

            return(View());
        }
Esempio n. 3
0
        /// <summary>
        /// 取总记录数
        /// </summary>
        /// <returns></returns>
        public ActionResult GetTotalCount(string key, string start, string end, string cabh)
        {
            int totalcount = dal.CalcCount(GetCond(key, start, end, cabh));

            return(Content(totalcount.ToString()));
        }