//打开文章
        public ActionResult OpenMyEassy(string AuthorName, string W_Id, string WorkName, string WorkTime)
        {
            using (剧享网Entities db = new 剧享网Entities())
            {
                int w_id = Convert.ToInt32(W_Id);
                剧享网.Comment_cs.FatherNode father     = new Comment_cs.FatherNode();
                List <T_Comment>          FatherNode = new List <T_Comment>();
                FatherNode         = father.FatherInfo(AuthorName, w_id, WorkName, WorkTime);
                ViewBag.FatherNode = FatherNode;

                TestController test = new TestController();
                List <int>     list = new List <int>();
                list         = test.WebInitGetAgreeCount(AuthorName, w_id, WorkName, WorkTime);
                ViewBag.List = list;
                //打开文章前先更新浏览数
                UpdateViewCount(AuthorName, w_id, WorkName, WorkTime);

                //获取文章内容
                var GetCurrentInfo = from currentinfo in db.T_SendWork where currentinfo.U_UserName == AuthorName && currentinfo.W_Id == w_id && currentinfo.S_WorkName == WorkName && currentinfo.S_SendTime == WorkTime select currentinfo;
                ViewBag.EassyName     = WorkName;
                ViewBag.Author        = AuthorName;
                ViewBag.EassySendTime = WorkTime;
                string WorkPath = null;
                //浏览数
                int ViewCount = 0;
                foreach (var info in GetCurrentInfo)
                {
                    WorkPath  = info.S_WorkPath;
                    ViewCount = info.S_WorkViewCount;
                }
                string EassyName = null;
                for (int i = 10; i < WorkPath.Length; ++i)
                {
                    EassyName += WorkPath[i];
                }
                FileStream   fs     = new FileStream(Server.MapPath(WorkPath + "\\" + EassyName + ".txt"), FileMode.Open, FileAccess.Read);
                StreamReader reader = new StreamReader(fs);
                ViewBag.EassyContent = reader.ReadToEnd();
                ViewBag.ViewCount    = ViewCount;
                //给定作品类型
                ViewBag.WorkType = "MyEssay";
                //必须关掉文件流
                fs.Close();
                reader.Close();
            }
            return(View());
        }
Пример #2
0
        public ActionResult YangWanJing_bojeck(string AuthorName, string W_Id, string WorkName, string WorkTime)
        {
            using (剧享网Entities db = new 剧享网Entities())
            {
                int w_id = Convert.ToInt32(W_Id);
                剧享网.Comment_cs.FatherNode father     = new Comment_cs.FatherNode();
                List <T_Comment>          FatherNode = new List <T_Comment>();
                FatherNode         = father.FatherInfo(AuthorName, w_id, WorkName, WorkTime);
                ViewBag.FatherNode = FatherNode;

                TestController test = new TestController();
                List <int>     list = new List <int>();
                list         = test.WebInitGetAgreeCount(AuthorName, w_id, WorkName, WorkTime);
                ViewBag.List = list;
                return(View());
            }
        }
Пример #3
0
        public ActionResult OpenVideo(string AuthorName, int W_Id, string WorkName, string WorkTime)
        {
            using (剧享网Entities db = new 剧享网Entities())
            {
                剧享网.Comment_cs.FatherNode father     = new Comment_cs.FatherNode();
                List <T_Comment>          FatherNode = new List <T_Comment>();
                FatherNode         = father.FatherInfo(AuthorName, W_Id, WorkName, WorkTime);
                ViewBag.FatherNode = FatherNode;

                TestController test = new TestController();
                List <int>     list = new List <int>();
                list         = test.WebInitGetAgreeCount(AuthorName, W_Id, WorkName, WorkTime);
                ViewBag.List = list;

                //获取视频内容
                var GetCurrentInfo = from currentinfo in db.T_SendWork where currentinfo.U_UserName == AuthorName && currentinfo.W_Id == W_Id && currentinfo.S_WorkName == WorkName && currentinfo.S_SendTime == WorkTime select currentinfo;
                ViewBag.Title         = "MyVideo";
                ViewBag.VideoName     = WorkName;
                ViewBag.Author        = AuthorName;
                ViewBag.VideoSendTime = WorkTime;
                string WorkPath = null;
                foreach (var info in GetCurrentInfo)
                {
                    WorkPath = info.S_WorkPath;
                }
                //视频名(内容介绍名和视频封面图片名及父文件夹名都是一样的)
                string VideoName = null;
                for (int i = 10; i < WorkPath.Length; ++i)
                {
                    VideoName += WorkPath[i];
                }
                //获取介绍的内容
                FileStream   fs     = new FileStream(Server.MapPath(WorkPath + "\\" + VideoName + ".txt"), FileMode.Open, FileAccess.Read);
                StreamReader reader = new StreamReader(fs);
                ViewBag.VideoContent = reader.ReadToEnd();
                //获取当前打开的视频的路径
                var getVideoInfo = System.IO.Directory.GetFiles(Server.MapPath("/MyVideo/" + VideoName), "*.*", SearchOption.TopDirectoryOnly).Where(s => s.EndsWith(".mp4") || s.EndsWith(".flv") || s.EndsWith(".avi") || s.EndsWith(".wmv"));
                foreach (string info in getVideoInfo)
                {
                    FileInfo fileInfo = new FileInfo(info);
                    ViewBag.VideoPath = "/MyVideo/" + VideoName + "/" + fileInfo.Name;
                }
            }
            return(View());
        }