Esempio n. 1
0
 public ActionResult ItemList(int currentpage = 1, int status = 0, long del = 0)
 {
     #region 翻页定义
     ViewBag.CurrentPage = 0;  //当前页
     ViewBag.PPage       = 0;  //上一页
     ViewBag.NPage       = 0;  //下一页
     ViewBag.PageCount   = 0;  //总页数
     ViewBag.RecordCount = 0;  //记录总数
     ViewBag.IsFirstPage = ""; //第一条记录,禁用首页和上一页
     ViewBag.IsEndPage   = ""; //最后条记录,禁用首页和下一页
     #endregion
     //
     ViewBag.Headline = "文章列表";//栏目主题
     //
     ViewBag.DataList   = null;
     ViewBag.RecordItem = null;
     //
     StatusData myStatusData = new StatusData();                           //返回状态
     //
     using (chefuzi_dataEntities myOperating = new chefuzi_dataEntities()) //数据库操作
     {
         #region  除
         if (del > 0)
         {
             Discover_Article myDelRecord = myOperating.Discover_Article.FirstOrDefault(p => p.ArticlId == del);
             if (myDelRecord != null)
             {
                 FunctionClass.delFile(myDelRecord.ArticleImages);
                 FunctionClass.delFile(myDelRecord.ArticleVideo);
                 myOperating.Discover_Article.Remove(myDelRecord);
                 #region  步删除收藏中的内容
                 DataOptionClass myDataOptionClass = new DataOptionClass();
                 myDataOptionClass.CollectOption(9, del, true);//删除收藏中的内容
                 #endregion
                 myOperating.SaveChanges();
             }
         }
         #endregion
         //
         #region 审核
         if (status > 0)
         {
             Discover_Article myStatusRecord = myOperating.Discover_Article.FirstOrDefault(p => p.ArticlId == status);
             if (myStatusRecord != null)
             {
                 if (myStatusRecord.Status == 200)
                 {
                     myStatusRecord.Status = 300;
                 }
                 else
                 {
                     myStatusRecord.Status = 200;
                 }
                 myOperating.SaveChanges();
             }
         }
         #endregion
         //
         #region 翻页属性
         int    recordCount  = 0;
         int    pageCount    = 0;
         string orderbyfiled = "ArticlId";
         //
         //当前页
         int sqlCurrentpage = currentpage;
         if (sqlCurrentpage < 1)
         {
             sqlCurrentpage = 1;
         }
         //页大小
         int sqlPagesize = 10;
         #endregion
         //
         #region 取出内容
         IQueryable <Discover_Article> myIQueryable = null;
         myIQueryable = myOperating.Discover_Article;
         //
         if (myIQueryable != null)
         {
             IQueryable <Discover_Article> BookTable             = QueryableExtensions.OrderBy(myIQueryable, orderbyfiled, out recordCount, out pageCount, ref sqlCurrentpage, sqlPagesize, true);
             List <DiscoverArticleList>    myDiscoverArticleList = new List <DiscoverArticleList>();
             long temId = 0;
             foreach (Discover_Article item in BookTable)
             {
                 temId = item.ArticlId;
                 DiscoverArticleList DiscoverArticleItem = new DiscoverArticleList();
                 DiscoverArticleItem.ArticlId     = temId;
                 DiscoverArticleItem.ArticleTitle = item.ArticleTitle;
                 DiscoverArticleItem.AddDate      = item.AddDate;
                 DiscoverArticleItem.MobilePhone  = item.MobilePhone;
                 DiscoverArticleItem.ReadTimes    = item.ReadTimes;
                 DiscoverArticleItem.Status       = item.Status;
                 DiscoverArticleItem.CommentCount = myOperating.Discover_Article_Comment.Count(p => p.AboutId == temId);
                 myDiscoverArticleList.Add(DiscoverArticleItem);
             }
             //
             ViewBag.DataList = myDiscoverArticleList;
             #region 页数取值
             ViewBag.CurrentPage = sqlCurrentpage;
             ViewBag.PageCount   = pageCount;
             ViewBag.RecordCount = recordCount;
             if (sqlCurrentpage > 1)
             {
                 ViewBag.PPage = sqlCurrentpage - 1;
             }
             else
             {
                 ViewBag.IsFirstPage = "disabled";
                 ViewBag.PPage       = 1;
             }
             if (sqlCurrentpage < pageCount)
             {
                 ViewBag.NPage = sqlCurrentpage + 1;
             }
             else
             {
                 ViewBag.NPage     = sqlCurrentpage;
                 ViewBag.IsEndPage = "disabled";
             }
             #endregion
         }
         #endregion
     }
     return(View());
 }
Esempio n. 2
0
 public ActionResult ItemList(int currentpage = 1, int ClassId = 0, long del = 0)
 {
     #region 翻页定义
     ViewBag.CurrentPage = 0;  //当前页
     ViewBag.PPage       = 0;  //上一页
     ViewBag.NPage       = 0;  //下一页
     ViewBag.PageCount   = 0;  //总页数
     ViewBag.RecordCount = 0;  //记录总数
     ViewBag.IsFirstPage = ""; //第一条记录,禁用首页和上一页
     ViewBag.IsEndPage   = ""; //最后条记录,禁用首页和下一页
     #endregion
     //
     ViewBag.Headline = "图书管理";//栏目主题
     //
     ViewBag.DataList   = null;
     ViewBag.RecordItem = null;
     ViewBag.Operate    = "add";                                           //add添加;edit编辑取出数据;editsave编辑保存
     //
     StatusData myStatusData = new StatusData();                           //返回状态
     //
     using (chefuzi_dataEntities myOperating = new chefuzi_dataEntities()) //数据库操作
     {
         #region  除
         if (del > 0)
         {
             Child_Book_Click myDelRecord = myOperating.Child_Book_Click.FirstOrDefault(p => p.BookID == del);
             if (myDelRecord != null)
             {
                 myOperating.Child_Book_Click.Remove(myDelRecord);
                 #region  步删除收藏中的内容
                 DataOptionClass myDataOptionClass = new DataOptionClass();
                 myDataOptionClass.CollectOption(1, del, true);//删除收藏中的内容
                 #endregion
                 myOperating.SaveChanges();
             }
         }
         #endregion
         //
         #region 翻页属性
         int    recordCount  = 0;
         int    pageCount    = 0;
         string orderbyfiled = "OrderBy";
         //
         //当前页
         int sqlCurrentpage = currentpage;
         if (sqlCurrentpage < 1)
         {
             sqlCurrentpage = 1;
         }
         //页大小
         int sqlPagesize = 10;
         #endregion
         //
         #region 取出内容
         IQueryable <Child_Book_Click> myIQueryable = null;
         if (ClassId > 0)
         {
             myIQueryable = myOperating.Child_Book_Click.Where(p => p.BookClassID == ClassId);
         }
         else
         {
             myIQueryable = myOperating.Child_Book_Click;
         }
         //
         if (myIQueryable != null)
         {
             List <Child_Book_Click> BookTable = QueryableExtensions.OrderBy(myIQueryable, orderbyfiled, out recordCount, out pageCount, ref sqlCurrentpage, sqlPagesize, true).ToList();
             //
             ViewBag.DataList = BookTable;
             #region 页数取值
             ViewBag.CurrentPage = sqlCurrentpage;
             ViewBag.PageCount   = pageCount;
             ViewBag.RecordCount = recordCount;
             if (sqlCurrentpage > 1)
             {
                 ViewBag.PPage = sqlCurrentpage - 1;
             }
             else
             {
                 ViewBag.IsFirstPage = "disabled";
                 ViewBag.PPage       = 1;
             }
             if (sqlCurrentpage < pageCount)
             {
                 ViewBag.NPage = sqlCurrentpage + 1;
             }
             else
             {
                 ViewBag.NPage     = sqlCurrentpage;
                 ViewBag.IsEndPage = "disabled";
             }
             #endregion
         }
         #endregion
         //
         ViewBag.ClassId = ClassId;//当前类别
         //
         List <Child_Book_Click_Class> ClassTable = myOperating.Child_Book_Click_Class.Where(p => p.Status == 200).OrderByDescending(p => p.OrderBy).ToList();
         ViewBag.DataListClass = ClassTable;
     }
     return(View());
 }
Esempio n. 3
0
 //==============================
 #region 教师社区文章列表
 public ActionResult TeacherCommunityList(int currentpage = 1, int ClassId = 0, long del = 0)
 {
     #region 翻页定义
     ViewBag.CurrentPage = 0;  //当前页
     ViewBag.PPage       = 0;  //上一页
     ViewBag.NPage       = 0;  //下一页
     ViewBag.PageCount   = 0;  //总页数
     ViewBag.RecordCount = 0;  //记录总数
     ViewBag.IsFirstPage = ""; //第一条记录,禁用首页和上一页
     ViewBag.IsEndPage   = ""; //最后条记录,禁用首页和下一页
     #endregion
     //
     ViewBag.Headline = "教师社区管理";//栏目主题
     //
     ViewBag.DataList   = null;
     ViewBag.RecordItem = null;
     ViewBag.Operate    = "add";                                           //add添加;edit编辑取出数据;editsave编辑保存
     //
     StatusData myStatusData = new StatusData();                           //返回状态
     //
     using (chefuzi_dataEntities myOperating = new chefuzi_dataEntities()) //数据库操作
     {
         #region  除
         if (del > 0)
         {
             Teacher_Article myDelRecord = myOperating.Teacher_Article.FirstOrDefault(p => p.ArticlId == del);
             if (myDelRecord != null)
             {
                 FunctionClass.delFile(myDelRecord.ArticleImages);
                 FunctionClass.delFile(myDelRecord.ArticleVideo);
                 string[] contentImages = FunctionClass.GetHtmlImageUrlList(myDelRecord.ArticleContent);
                 FunctionClass.delFile("", contentImages);
                 myOperating.Teacher_Article.Remove(myDelRecord);
                 #region  步删除收藏中的内容
                 DataOptionClass myDataOptionClass = new DataOptionClass();
                 myDataOptionClass.CollectOption(8, del, true);//删除收藏中的内容
                 #endregion
                 myOperating.SaveChanges();
             }
         }
         #endregion
         //
         #region 翻页属性
         int    recordCount  = 0;
         int    pageCount    = 0;
         string orderbyfiled = "OrderBy";
         //
         //当前页
         int sqlCurrentpage = currentpage;
         if (sqlCurrentpage < 1)
         {
             sqlCurrentpage = 1;
         }
         //页大小
         int sqlPagesize = 10;
         #endregion
         //
         #region 取出内容
         IQueryable <Teacher_Article> myIQueryable = null;
         if (ClassId > 0)
         {
             myIQueryable = myOperating.Teacher_Article.Where(p => p.ClassId == ClassId);
         }
         else
         {
             myIQueryable = myOperating.Teacher_Article;
         }
         //
         if (myIQueryable != null)
         {
             IQueryable <Teacher_Article> BookTable = QueryableExtensions.OrderBy(myIQueryable, orderbyfiled, out recordCount, out pageCount, ref sqlCurrentpage, sqlPagesize, true);
             //
             List <teacherCommunityList> myCommunityList = new List <teacherCommunityList>();
             long temId = 0;
             foreach (Teacher_Article item in BookTable)
             {
                 temId = item.ArticlId;
                 teacherCommunityList CommunityItem = new teacherCommunityList();
                 CommunityItem.ArticlId     = item.ArticlId;
                 CommunityItem.ArticleTitle = item.ArticleTitle;
                 CommunityItem.OrderBy      = item.OrderBy;
                 CommunityItem.CommentCount = myOperating.Teacher_Article_Comment.Count(p => p.AboutId == temId);
                 myCommunityList.Add(CommunityItem);
             }
             ViewBag.DataList = myCommunityList;
             #region 页数取值
             ViewBag.CurrentPage = sqlCurrentpage;
             ViewBag.PageCount   = pageCount;
             ViewBag.RecordCount = recordCount;
             if (sqlCurrentpage > 1)
             {
                 ViewBag.PPage = sqlCurrentpage - 1;
             }
             else
             {
                 ViewBag.IsFirstPage = "disabled";
                 ViewBag.PPage       = 1;
             }
             if (sqlCurrentpage < pageCount)
             {
                 ViewBag.NPage = sqlCurrentpage + 1;
             }
             else
             {
                 ViewBag.NPage     = sqlCurrentpage;
                 ViewBag.IsEndPage = "disabled";
             }
             #endregion
         }
         #endregion
         //
         ViewBag.ClassId = ClassId;//当前类别
         //
         List <Teacher_Article_Class> ClassTable = myOperating.Teacher_Article_Class.Where(p => p.Status == 200).OrderByDescending(p => p.OrderBy).ToList();
         ViewBag.DataListClass = ClassTable;
     }
     return(View());
 }
Esempio n. 4
0
        //
        #region 音频列表
        public ActionResult AudioList(string albumid, string currentpage, long del = 0)
        {
            #region 翻页定义
            ViewBag.CurrentPage = 0;  //当前页
            ViewBag.PPage       = 0;  //上一页
            ViewBag.NPage       = 0;  //下一页
            ViewBag.PageCount   = 0;  //总页数
            ViewBag.RecordCount = 0;  //记录总数
            ViewBag.IsFirstPage = ""; //第一条记录,禁用首页和上一页
            ViewBag.IsEndPage   = ""; //最后条记录,禁用首页和下一页
            #endregion
            //
            ViewBag.Headline = "音频管理";//栏目主题
            //
            ViewBag.AlbumId    = albumid;
            ViewBag.DataList   = null;
            ViewBag.RecordItem = null;
            ViewBag.Operate    = "add";                                           //add添加;edit编辑取出数据;editsave编辑保存
            //
            StatusData myStatusData = new StatusData();                           //返回状态
            //
            using (chefuzi_dataEntities myOperating = new chefuzi_dataEntities()) //数据库操作
            {
                #region  除
                if (del > 0)
                {
                    Child_Audio_List myDelRecord = myOperating.Child_Audio_List.FirstOrDefault(p => p.AudioId == del);
                    if (myDelRecord != null)
                    {
                        FunctionClass.delFile(myDelRecord.AudioImage);
                        myOperating.Child_Audio_List.Remove(myDelRecord);
                        #region  步删除收藏中的内容
                        DataOptionClass myDataOptionClass = new DataOptionClass();
                        myDataOptionClass.CollectOption(2, del, true);//删除收藏中的内容
                        #endregion
                        myOperating.SaveChanges();
                    }
                }
                #endregion

                #region 翻页属性
                int    recordCount  = 0;
                int    pageCount    = 0;
                string orderbyfiled = "OrderBy";
                bool   isDesc       = true;//倒序
                //
                //当前页
                int sqlCurrentpage = 1;
                if (!String.IsNullOrWhiteSpace(currentpage))
                {
                    bool isOk = int.TryParse(currentpage, out sqlCurrentpage);
                    if (!isOk)
                    {
                        sqlCurrentpage = 1;
                    }
                }
                //页大小
                int sqlPagesize = 10;
                #endregion
                IQueryable <Child_Audio_List> myIQueryable = null;
                if (!String.IsNullOrWhiteSpace(albumid))
                {
                    int  myInt = 0;
                    bool isOk  = int.TryParse(albumid, out myInt);
                    if (isOk)
                    {
                        myIQueryable = myOperating.Child_Audio_List.Where(p => p.AlbumId == myInt);
                    }
                    else
                    {
                        myIQueryable = null;
                    }
                }
                //
                if (myIQueryable != null)
                {
                    List <Child_Audio_List> BookTable = QueryableExtensions.OrderBy(myIQueryable, orderbyfiled, out recordCount, out pageCount, ref sqlCurrentpage, sqlPagesize, isDesc).ToList();
                    ViewBag.DataList = BookTable;

                    #region 页数取值
                    ViewBag.CurrentPage = sqlCurrentpage;
                    ViewBag.PageCount   = pageCount;
                    ViewBag.RecordCount = recordCount;
                    if (sqlCurrentpage > 1)
                    {
                        ViewBag.PPage = sqlCurrentpage - 1;
                    }
                    else
                    {
                        ViewBag.IsFirstPage = "disabled";
                        ViewBag.PPage       = 1;
                    }
                    if (sqlCurrentpage < pageCount)
                    {
                        ViewBag.NPage = sqlCurrentpage + 1;
                    }
                    else
                    {
                        ViewBag.NPage     = sqlCurrentpage;
                        ViewBag.IsEndPage = "disabled";
                    }
                    #endregion
                }
            }
            return(View());
        }
Esempio n. 5
0
        public ActionResult TeacherVideoList(int currentpage = 1, int ClassId = 0, int LessonId = 0, long del = 0)
        {
            #region 翻页定义
            ViewBag.CurrentPage = 0;  //当前页
            ViewBag.PPage       = 0;  //上一页
            ViewBag.NPage       = 0;  //下一页
            ViewBag.PageCount   = 0;  //总页数
            ViewBag.RecordCount = 0;  //记录总数
            ViewBag.IsFirstPage = ""; //第一条记录,禁用首页和上一页
            ViewBag.IsEndPage   = ""; //最后条记录,禁用首页和下一页
            #endregion
            //
            ViewBag.Headline = "教师视频管理";//栏目主题
            #region 栏目名称
            switch (ClassId)
            {
            case 1:
                ViewBag.Headline = "芮卡课程讲解";
                break;

            case 2:
                ViewBag.Headline = "幼儿公开课";
                break;

            case 3:
                ViewBag.Headline = "教育技能";
                break;

            case 4:
                ViewBag.Headline = "芮卡多媒体操作说明";
                break;
            }
            #endregion

            //
            ViewBag.DataList   = null;
            ViewBag.RecordItem = null;
            ViewBag.Operate    = "add";                                           //add添加;edit编辑取出数据;editsave编辑保存
            //
            StatusData myStatusData = new StatusData();                           //返回状态
            //
            using (chefuzi_dataEntities myOperating = new chefuzi_dataEntities()) //数据库操作
            {
                #region  除
                if (del > 0)
                {
                    Teacher_Video_List myDelRecord = myOperating.Teacher_Video_List.FirstOrDefault(p => p.VideoId == del);
                    if (myDelRecord != null)
                    {
                        FunctionClass.delFile(myDelRecord.VideoImage);
                        FunctionClass.delFile(myDelRecord.VideoUrl);
                        myOperating.Teacher_Video_List.Remove(myDelRecord);
                        #region  步删除收藏中的内容
                        DataOptionClass myDataOptionClass = new DataOptionClass();
                        myDataOptionClass.CollectOption(4, del, true); //删除收藏中的内容
                        myDataOptionClass.CollectOption(5, del, true); //删除收藏中的内容
                        myDataOptionClass.CollectOption(6, del, true); //删除收藏中的内容
                        myDataOptionClass.CollectOption(7, del, true); //删除收藏中的内容
                        #endregion
                        myOperating.SaveChanges();
                    }
                }
                #endregion
                //
                #region 翻页属性
                int    recordCount   = 0;
                int    pageCount     = 0;
                string orderbyfiled  = "Recommended";
                string orderbyfiled2 = "OrderBy";
                //
                //当前页
                int sqlCurrentpage = currentpage;
                if (sqlCurrentpage < 1)
                {
                    sqlCurrentpage = 1;
                }
                //页大小
                int sqlPagesize = 10;
                #endregion
                //
                #region 取出内容
                IQueryable <Teacher_Video_List> myIQueryable = null;
                if (ClassId > 0)
                {
                    if ((ClassId == 1) && (LessonId > 0))
                    {
                        myIQueryable = myOperating.Teacher_Video_List.Where(p => p.ClassId == ClassId && p.LessonId == LessonId);
                    }
                    else
                    {
                        myIQueryable = myOperating.Teacher_Video_List.Where(p => p.ClassId == ClassId);
                    }
                }
                else
                {
                    myIQueryable = myOperating.Teacher_Video_List;
                }
                //
                if (myIQueryable != null)
                {
                    List <Teacher_Video_List> BookTable = QueryableExtensions.OrderBy(myIQueryable, orderbyfiled, out recordCount, out pageCount, ref sqlCurrentpage, sqlPagesize, true, orderbyfiled2).ToList();
                    //
                    ViewBag.DataList = BookTable;
                    #region 页数取值
                    ViewBag.CurrentPage = sqlCurrentpage;
                    ViewBag.PageCount   = pageCount;
                    ViewBag.RecordCount = recordCount;
                    if (sqlCurrentpage > 1)
                    {
                        ViewBag.PPage = sqlCurrentpage - 1;
                    }
                    else
                    {
                        ViewBag.IsFirstPage = "disabled";
                        ViewBag.PPage       = 1;
                    }
                    if (sqlCurrentpage < pageCount)
                    {
                        ViewBag.NPage = sqlCurrentpage + 1;
                    }
                    else
                    {
                        ViewBag.NPage     = sqlCurrentpage;
                        ViewBag.IsEndPage = "disabled";
                    }
                    #endregion
                }
                #endregion
                //
                ViewBag.ClassId  = ClassId;  //当前类别
                ViewBag.LessonId = LessonId; //当前课程门类
                //
                #region 芮卡课程讲解需要取出课程门类
                if (ClassId == 1)
                {//芮卡课程讲解
                    List <Teacher_Video_Class_Lesson> LessonTable = myOperating.Teacher_Video_Class_Lesson.Where(p => p.Status == 200).OrderByDescending(p => p.OrderBy).ToList();
                    ViewBag.DataListLesson = LessonTable;
                }
                #endregion
            }
            return(View());
        }