コード例 #1
0
ファイル: UserController.cs プロジェクト: dalinhuang/newcqgj
        /// <summary>
        /// 删除心得体会
        /// </summary>
        public ActionResult LearnDel(int id)
        {
            UserPLViewData viewData = new UserPLViewData();

            viewData.user = GetUser();
            int userID = viewData.user.UserID;

            viewData.course = (from c in CQGJ.Course
                               where c.CourseID == id
                               select c).First();
            LearnGain LearnDel = (from l in CQGJ.LearnGain
                                  where l.CourseResult.Course.CourseID == id && l.CourseResult.Student.User.UserID == userID
                                  select l).First();

            CQGJ.DeleteObject(LearnDel);
            CQGJ.SaveChanges(true);
            return RedirectToAction("courseinfo/" + viewData.course.CourseID, "user");// 对话框
        }
コード例 #2
0
ファイル: UserController.cs プロジェクト: dalinhuang/newcqgj
 /// <summary>
 /// 某一课程的心得
 /// </summary>
 /// <param name="id"></param>
 public ActionResult LearnDetail(int id)
 {
     UserPLViewData viewData = new UserPLViewData();
     viewData.learn = (from l in CQGJ.LearnGain
                       where l.LearnGainID == id
                       select l).First();
     int userID = GetUser().UserID;
     return View(viewData);
 }
コード例 #3
0
ファイル: UserController.cs プロジェクト: dalinhuang/newcqgj
        /// <summary>
        /// 某一课程的论文列表
        /// </summary>
        /// <param name="id"></param>
        public ActionResult PaperList(int id)
        {
            UserPLViewData viewData = new UserPLViewData();
            viewData.user = GetUser();
            int userID = viewData.user.UserID;

            //现在班级
            viewData.CureentClassesList = (from c in CQGJ.Classes
                                           from s in CQGJ.Student
                                           where s.Classes == c && s.User.UserID == userID && c.Status == 2  //修改刘涛, status=2为开班中,3为结束
                                           select c).ToList();

                       viewData.course = (from c in CQGJ.Course
                               where c.CourseID == id
                               select c).First();

            //所在班级
            foreach (Classes c in viewData.CureentClassesList)
            {
                if (c.ClassID == viewData.course.Classes.ClassID)
                {
                    viewData.Classes = c;
                }
            }

            int ClassID = viewData.Classes.ClassID;
            // int TID = viewData.Classes.Teacher
            viewData.ClassBBS = (from b in CQGJ.BBS
                                 where b.Classes.ClassID == ClassID
                                 select b).First();
            List<int> ListID = (from s in CQGJ.Student
                                where s.Classes.ClassID == id
                                select s.User.UserID).ToList();

            viewData.learnlist = (from l in CQGJ.LearnGain
                                  where l.CourseResult.Course.Classes.ClassID == ClassID && l.CourseResult.Student.User.UserID == userID
                                  select l).ToList();
            viewData.paperlist = (from p in CQGJ.Paper
                                  where p.CourseResult.Course.Classes.ClassID == ClassID && p.CourseResult.Student.User.UserID == userID
                                  select p).ToList();
            viewData.Classpaperlist = (from p in CQGJ.Paper
                                       where p.CourseResult.Course.CourseID == id
                                       select p).ToList();

            if (viewData.ClassBBS != null)
            {
                int BBSID = viewData.ClassBBS.BBSID;
                //班级论坛帖子
                viewData.BBSItemList = (from b in CQGJ.BBSItem
                                        orderby b.SubmitTime descending
                                        where b.BBS.BBSID == BBSID && b.ParentID == -1
                                        select b).Take(10).ToList();
            }
            return View("PaperList", viewData);
        }
コード例 #4
0
ファイル: UserController.cs プロジェクト: dalinhuang/cqgj
        /// <summary>
        /// 添加心得体会
        /// </summary>
        public void LearnAdd()
        {
            IsLogin();
            UserPLViewData viewData = new UserPLViewData();
            viewData.user = (CQGJ.passport.User)HttpContext.Session["userobject"];
            int userID = viewData.user.UserID;
            userID = ToUserID(userID); //SSO用户ID转换为系统用户ID

            viewData.ClassCourseList = (from cs in CQGJ.Course
                                        where cs.Classes.ClassID == 1
                                        select cs).ToList();
            RenderView("LearnAdd", viewData);
        }
コード例 #5
0
ファイル: UserController.cs プロジェクト: dalinhuang/newcqgj
        /// <summary>
        /// 某一课程的论文
        /// </summary>
        public ActionResult PaperAdd()
        {
            UserPLViewData viewData = new UserPLViewData();
            viewData.user = GetUser();
            int userID = viewData.user.UserID;

            viewData.ClassCourseList = (from c in CQGJ.Classes
                                        from s in CQGJ.Student
                                        from cs in CQGJ.Course
                                        where s.Classes == c && s.StudentID == userID
                                        where cs.Classes.ClassID == c.ClassID
                                        select cs).ToList();
            return View("PaperAdd", viewData);
        }
コード例 #6
0
ファイル: UserController.cs プロジェクト: dalinhuang/newcqgj
 /// <summary>
 /// 某一课程的论文
 /// </summary>
 /// <param name="id"></param>
 public ActionResult PaperDetail(int id)
 {
     UserPLViewData viewData = new UserPLViewData();
     viewData.paper = (from p in CQGJ.Paper
                       where p.PaperID == id
                       select p).First();
     return View(viewData);
 }
コード例 #7
0
ファイル: UserController.cs プロジェクト: dalinhuang/cqgj
        /// <summary>
        /// 用户的心得列表
        /// </summary>
        /// <param name="id"></param>
        public void MyLearn()
        {
            IsLogin();
            UserPLViewData viewData = new UserPLViewData();
            viewData.user = (CQGJ.passport.User)HttpContext.Session["userobject"];
            int userID = viewData.user.UserID;
            userID = ToUserID(userID); //SSO用户ID转换成系统用户ID

            try
            {
                viewData.learnlist = (from l in CQGJ.LearnGain
                                      where l.CourseResult.Student.User.UserID == userID
                                      select l).ToList();
            }
            catch
            {
                //nothing
            }
            viewData.user = (CQGJ.passport.User)HttpContext.Session["userobject"];
            RenderView("mylearn", viewData);
        }
コード例 #8
0
ファイル: UserController.cs プロジェクト: dalinhuang/newcqgj
        /// <summary>
        /// 用户的论文列表
        /// </summary>
        /// <param name="id"></param>
        public ActionResult MyPaper()
        {
            UserPLViewData viewData = new UserPLViewData();
            viewData.user = GetUser();
            int userID = viewData.user.UserID;

            viewData.paperlist = (from p in CQGJ.Paper
                                  where p.CourseResult.Student.User.UserID == userID
                                  select p).ToList();

            return View("MyPaper", viewData);
        }
コード例 #9
0
ファイル: UserController.cs プロジェクト: dalinhuang/cqgj
        /// <summary>
        /// 某一课程的心得列表
        /// </summary>
        /// <param name="id"></param>
        public void LearnList(int id)
        {
            IsLogin();

            UserPLViewData viewData = new UserPLViewData();

            viewData.user = (CQGJ.passport.User)HttpContext.Session["userobject"];
            int userID = viewData.user.UserID;

            userID = ToUserID(userID); //zhuanhua

            //班级通知
            //viewData.NotifyList = (from n in CQGJ.Notify where  select n).ToList();

            //现在班级
            viewData.CureentClassesList = (from c in CQGJ.Classes
                                           from s in CQGJ.Student
                                           where s.Classes == c && s.User.UserID == userID && c.Status == 2  //修改刘涛, status=2为开班中,3为结束
                                           select c).ToList();

            string str = ConfigurationManager.AppSettings["PhotoUrl"].ToString();
            viewData.URL = str;

            try
            {
                viewData.course = (from c in CQGJ.Course where c.CourseID == id select c).First();
            }
            catch
            {
                //错误
            }

            try
            {
                //所在班级
                foreach (Classes c in viewData.CureentClassesList)
                {
                    if (c.ClassID == viewData.course.Classes.ClassID)
                    {
                        viewData.Classes = c;
                    }
                }

                int ClassID = viewData.Classes.ClassID;
                // int TID = viewData.Classes.Teacher
                viewData.ClassBBS = (from b in CQGJ.BBS where b.Classes.ClassID == ClassID select b).First();
                //viewData.teacher = (from t in CQGJ.Teacher where t.TeacherID == ClassID select b).First();
                List<int> ListID = (from s in CQGJ.Student where s.Classes.ClassID == id select s.User.UserID).ToList();

            }
            catch
            {
                ;
            }
            try
            {
                int ClassID = viewData.Classes.ClassID;
                viewData.learnlist = (from l in CQGJ.LearnGain where l.CourseResult.Course.Classes.ClassID == ClassID && l.CourseResult.Student.User.UserID == userID select l).ToList();
                viewData.paperlist = (from p in CQGJ.Paper where p.CourseResult.Course.Classes.ClassID == ClassID && p.CourseResult.Student.User.UserID == userID select p).ToList();
                viewData.Classlearnlist = (from l in CQGJ.LearnGain where l.CourseResult.Course.CourseID == id select l).ToList();
            }
            catch
            {
                ;
            }

            if (viewData.ClassBBS != null)
            {
                int BBSID = viewData.ClassBBS.BBSID;
                //班级论坛帖子
                viewData.BBSItemList = (from b in CQGJ.BBSItem
                                        orderby b.SubmitTime descending
                                        where b.BBS.BBSID == BBSID && b.ParentID == -1
                                        select b).Take(10).ToList();
            }
            viewData.user = (CQGJ.passport.User)HttpContext.Session["userobject"];

            RenderView("learnList", viewData);
        }
コード例 #10
0
ファイル: UserController.cs プロジェクト: dalinhuang/cqgj
        /// <summary>
        /// 心得体会保存 - 编辑时
        /// </summary>
        public void LearnSave()
        {
            IsLogin();
            UserPLViewData viewData = new UserPLViewData();
            viewData.user = (CQGJ.passport.User)HttpContext.Session["userobject"];
            int userID = viewData.user.UserID;
            userID = ToUserID(userID); //SSO用户ID转换成系统用户ID
            int learnid = GetInt("LearnID");
            int courseid = GetInt("CourseID");

            viewData.course = (from c in CQGJ.Course
                               where c.CourseID == courseid
                               select c).First();
            LearnGain LearnEdit = (from l in CQGJ.LearnGain
                                   where l.LearnGainID == learnid
                                   select l).First();
            LearnEdit.Title = GetString("lTitle");
            LearnEdit.Content = GetString("ctl00$MainContentPlaceHolder$ArticleContent");
            CQGJ.SaveChanges(true);
            RedirectToAction("learndetail/" + learnid, "user");
        }
コード例 #11
0
ファイル: UserController.cs プロジェクト: dalinhuang/cqgj
        /// <summary>
        /// 心得体会编辑
        /// </summary>
        public void LearnEdit(int id)
        {
            IsLogin();
            UserPLViewData viewData = new UserPLViewData();
            viewData.user = (CQGJ.passport.User)HttpContext.Session["userobject"];
            int userID = viewData.user.UserID;
            userID = ToUserID(userID); //SSO用户ID转换成系统用户ID

            viewData.ClassCourseList = (from cs in CQGJ.Course
                                        where cs.Classes.ClassID == 1
                                        select cs).ToList();
            viewData.learn = (from l in CQGJ.LearnGain
                              where l.LearnGainID == id
                              select l).First();
            int ResultID = int.Parse(viewData.learn.CourseResultReference.EntityKey.EntityKeyValues.First().Value.ToString());
            CourseResult crt = (from cr in CQGJ.CourseResult
                                where cr.ResultID == ResultID
                                select cr).First();
            viewData.CourseID = int.Parse(crt.CourseReference.EntityKey.EntityKeyValues.First().Value.ToString());

            RenderView("LearnEdit", viewData);
        }
コード例 #12
0
ファイル: UserController.cs プロジェクト: dalinhuang/cqgj
        /// <summary>
        /// 删除心得体会
        /// </summary>
        public void LearnDel(int id)
        {
            IsLogin();

            UserPLViewData viewData = new UserPLViewData();

            viewData.user = (CQGJ.passport.User)HttpContext.Session["userobject"];
            int userID = viewData.user.UserID;

            userID = ToUserID(userID); //zhuanhua

            try
            {
                viewData.course = (from c in CQGJ.Course where c.CourseID == id select c).First();
                LearnGain LearnDel = (from l in CQGJ.LearnGain where l.CourseResult.Course.CourseID == id && l.CourseResult.Student.User.UserID == userID select l).First();

                CQGJ.DeleteObject(LearnDel);
                CQGJ.SaveChanges(true);
                RedirectToAction("courseinfo/" + viewData.course.CourseID, "user");// 对话框
            }
            catch
            {
                ;//错误
            }
        }
コード例 #13
0
ファイル: UserController.cs プロジェクト: dalinhuang/cqgj
        /// <summary>
        /// 心得体会保存 - 创建时
        /// </summary>
        public void LearnCreate()
        {
            IsLogin();
            UserPLViewData viewData = new UserPLViewData();
            viewData.user = (CQGJ.passport.User)HttpContext.Session["userobject"];
            int userID = viewData.user.UserID;
            userID = ToUserID(userID); //SSO用户ID转换为系统用户ID
            int id = GetInt("lCourse");
            try
            {
                var courseResultTemp = (from cr in CQGJ.CourseResult
                                        where cr.Course.CourseID == id && cr.Student.User.UserID == userID
                                        select cr);
                bool flag = false;
                viewData.course = (from c in CQGJ.Course
                                   where c.CourseID == id
                                   select c).First();
                CourseResult crTmp = new CourseResult();
                try
                {
                    crTmp = courseResultTemp.First();
                }
                catch
                {
                    flag = true;
                }
                if (flag)
                {
                    crTmp.Course = viewData.course;
                    crTmp.Student = (from s in CQGJ.Student
                                     where s.User.UserID == userID
                                     select s).First();
                    CQGJ.AddToCourseResult(crTmp);
                    CQGJ.SaveChanges(true);
                }

                LearnGain learn = new LearnGain();
                learn.CourseResult = crTmp;
                learn.Content = GetString("Content");
                learn.Title = GetString("lTitle");
                learn.PubTime = DateTime.Now;
                CQGJ.AddToLearnGain(learn);
                CQGJ.SaveChanges(true);
                RedirectToAction("mylearn", "user");
            }
            catch
            {
                //错误
            }
        }
コード例 #14
0
ファイル: UserController.cs プロジェクト: dalinhuang/newcqgj
        /// <summary>
        /// 心得体会保存 - 编辑时
        /// </summary>
        public ActionResult LearnSave()
        {
            UserPLViewData viewData = new UserPLViewData();
            viewData.user = GetUser();
            int userID = viewData.user.UserID;
            int learnid = GetInt("LearnID");
            int courseid = GetInt("CourseID");

            viewData.course = (from c in CQGJ.Course
                               where c.CourseID == courseid
                               select c).First();
            LearnGain LearnEdit = (from l in CQGJ.LearnGain
                                   where l.LearnGainID == learnid
                                   select l).First();
            LearnEdit.Title = GetString("Title");
            LearnEdit.Content = GetString("ctl00$MainContentPlaceHolder$ArticleContent");
            CQGJ.SaveChanges(true);
            return RedirectToAction("learndetail/" + learnid, "user");
        }
コード例 #15
0
ファイル: UserController.cs プロジェクト: dalinhuang/cqgj
        /// <summary>
        /// 用户的论文列表
        /// </summary>
        /// <param name="id"></param>
        public void MyPaper()
        {
            IsLogin();

            UserPLViewData viewData = new UserPLViewData();
            viewData.user = (CQGJ.passport.User)HttpContext.Session["userobject"];
            int userID = viewData.user.UserID;
            userID = ToUserID(userID); //SSO用户ID转换成系统用户ID

            try
            {
                viewData.paperlist = (from p in CQGJ.Paper
                                      where p.CourseResult.Student.User.UserID == userID
                                      select p).ToList();
            }
            catch
            {
                //nothing
            }

            viewData.user = (CQGJ.passport.User)HttpContext.Session["userobject"];
            RenderView("MyPaper", viewData);
        }
コード例 #16
0
ファイル: UserController.cs プロジェクト: dalinhuang/newcqgj
 /// <summary>
 /// 用户的心得列表
 /// </summary>
 /// <param name="id"></param>
 public ActionResult MyLearn()
 {
     UserPLViewData viewData = new UserPLViewData();
     viewData.user = GetUser();
     int userID = viewData.user.UserID;
     viewData.learnlist = (from l in CQGJ.LearnGain
                           where l.CourseResult.Student.User.UserID == userID
                           select l).ToList();
     return View("mylearn", viewData);
 }
コード例 #17
0
ファイル: UserController.cs プロジェクト: dalinhuang/cqgj
        /// <summary>
        /// 用户的成绩
        /// </summary>
        public void MyScore()
        {
            IsLogin();
            UserPLViewData viewData = new UserPLViewData();
            viewData.user = (CQGJ.passport.User)HttpContext.Session["userobject"];
            int userID = viewData.user.UserID;
            userID = ToUserID(userID); //SSO用户ID转换成系统用户ID
            viewData.UserID = userID;
            viewData.ClassList = (from c in CQGJ.Classes
                                  from s in CQGJ.Student
                                  where s.User.UserID == userID && s.Classes == c
                                  select c).ToList();

            if (viewData.ClassList.Count() > 0)
            {
                int classID = viewData.ClassList.First().ClassID;
                if (GetInt("ClassID") > 0)
                { classID = GetInt("ClassID"); }
                viewData.ScoreList = (from cr in CQGJ.CourseResult
                                      where cr.Course.Classes.ClassID == classID && cr.Student.User.UserID == userID
                                      select cr).ToList();
                viewData.ClassID = classID;
            }

            RenderView("MyScore", viewData);
        }
コード例 #18
0
ファイル: UserController.cs プロジェクト: dalinhuang/newcqgj
        /// <summary>
        /// 用户的成绩
        /// </summary>
        public ActionResult MyScore()
        {
            UserPLViewData viewData = new UserPLViewData();
            viewData.user = GetUser();
            int userID = viewData.user.UserID;
            viewData.UserID = userID;
            viewData.ClassList = (from c in CQGJ.Classes
                                  from s in CQGJ.Student
                                  where s.User.UserID == userID && s.Classes == c
                                  select c).ToList();

            if (viewData.ClassList.Count() > 0)
            {
                int classID = viewData.ClassList.First().ClassID;
                if (GetInt("ClassID") > 0)
                { classID = GetInt("ClassID"); }
                viewData.ScoreList = (from cr in CQGJ.CourseResult
                                      where cr.Course.Classes.ClassID == classID && cr.Student.User.UserID == userID
                                      select cr).ToList();
                viewData.ClassID = classID;
            }
            return View("MyScore", viewData);
        }
コード例 #19
0
ファイル: UserController.cs プロジェクト: dalinhuang/cqgj
        /// <summary>
        /// 某一课程的论文
        /// </summary>
        public void PaperAdd()
        {
            IsLogin();
            UserPLViewData viewData = new UserPLViewData();
            viewData.user = (CQGJ.passport.User)HttpContext.Session["userobject"];
            int userID = viewData.user.UserID;
            userID = ToUserID(userID); //SSO用户ID转换为系统用户ID

            //用户所属的班级的课程
            //viewData.ClassCourseList = (from c in CQGJ.Classes
            //                            from s in CQGJ.Student
            //                            from cs in CQGJ.Course
            //                            where cs.Classes.ClassID == c.ClassID && s.User.UserID == userID && s.Classes.ClassID == c.ClassID
            //                            select cs).ToList();
            viewData.ClassCourseList = (from cs in CQGJ.Course
                                        where cs.Classes.ClassID == 1
                                        select cs).ToList();

            RenderView("PaperAdd", viewData);
        }
コード例 #20
0
ファイル: UserController.cs プロジェクト: dalinhuang/newcqgj
        /// <summary>
        /// 论文保存 - 创建新论文时
        /// </summary>
        public ActionResult PaperCreate()
        {
            UserPLViewData viewData = new UserPLViewData();
            viewData.user = GetUser();
            int userID = viewData.user.UserID;
            int id = GetInt("pCourse");

            var courseResultTemp = (from cr in CQGJ.CourseResult
                                    where cr.Course.CourseID == id && cr.Student.User.UserID == userID
                                    select cr);
            bool flag = false;
            viewData.course = (from c in CQGJ.Course
                               where c.CourseID == id
                               select c).First();
            CourseResult crTmp = new CourseResult();
            try
            {
                crTmp = courseResultTemp.First();
            }
            catch
            {
                flag = true;
            }
            if (flag)
            {
                crTmp.Course = viewData.course;
                crTmp.Student = (from s in CQGJ.Student
                                 where s.User.UserID == userID
                                 select s).First();
                CQGJ.AddToCourseResult(crTmp);
                CQGJ.SaveChanges(true);
            }

            Paper newpaper = new Paper();
            newpaper.CourseResult = crTmp;
            newpaper.Content = GetString("Content");
            newpaper.PaperType = "1";//现在没有用
            newpaper.Title = GetString("pTitle");
            newpaper.PublishDate = DateTime.Now;
            newpaper.Publisher = viewData.user.Username;
            CQGJ.AddToPaper(newpaper);
            CQGJ.SaveChanges(true);
            return RedirectToAction("mypaper", "user");
        }
コード例 #21
0
ファイル: UserController.cs プロジェクト: dalinhuang/cqgj
        /// <summary>
        /// 论文保存 - 创建新论文时
        /// </summary>
        public void PaperCreate()
        {
            IsLogin();
            UserPLViewData viewData = new UserPLViewData();
            viewData.user = (CQGJ.passport.User)HttpContext.Session["userobject"];
            int userID = viewData.user.UserID;
            userID = ToUserID(userID); //SSO用户ID转换为系统用户ID
            int id = GetInt("pCourse");
            try
            {
                var courseResultTemp = (from cr in CQGJ.CourseResult
                                        where cr.Course.CourseID == id && cr.Student.User.UserID == userID
                                        select cr);
                bool flag = false;
                viewData.course = (from c in CQGJ.Course
                                   where c.CourseID == id
                                   select c).First();
                CourseResult crTmp = new CourseResult();
                try
                {
                    crTmp = courseResultTemp.First();
                }
                catch
                {
                    flag = true;
                }
                if (flag)
                {
                    crTmp.Course = viewData.course;
                    crTmp.Student = (from s in CQGJ.Student
                                     where s.User.UserID == userID
                                     select s).First();
                    CQGJ.AddToCourseResult(crTmp);
                    CQGJ.SaveChanges(true);
                }

                Paper newpaper = new Paper();
                newpaper.CourseResult = crTmp;
                newpaper.Content = GetString("Content");
                newpaper.PaperType = "1";//现在没有用
                newpaper.Title = GetString("pTitle");
                newpaper.PublishDate = DateTime.Now;
                newpaper.Publisher = viewData.user.Username;
                CQGJ.AddToPaper(newpaper);
                CQGJ.SaveChanges(true);
                RedirectToAction("mypaper", "user");
            }
            catch
            {
                //错误
            }
        }
コード例 #22
0
ファイル: UserController.cs プロジェクト: dalinhuang/newcqgj
        /// <summary>
        /// 心得体会编辑
        /// </summary>
        public ActionResult PaperEdit(int id)
        {
            UserPLViewData viewData = new UserPLViewData();
            viewData.user = GetUser();
            int userID = viewData.user.UserID;
            viewData.ClassCourseList = (from c in CQGJ.Classes
                                        from s in CQGJ.Student
                                        from cs in CQGJ.Course
                                        where s.Classes == c && s.StudentID == userID
                                        where cs.Classes.ClassID == c.ClassID
                                        select cs).ToList();
            viewData.paper = (from p in CQGJ.Paper
                              where p.PaperID == id
                              select p).First();
            int ResultID = int.Parse(viewData.paper.CourseResultReference.EntityKey.EntityKeyValues.First().Value.ToString());
            CourseResult crt = (from cr in CQGJ.CourseResult
                                where cr.ResultID == ResultID
                                select cr).First();
            viewData.CourseID = int.Parse(crt.CourseReference.EntityKey.EntityKeyValues.First().Value.ToString());

            return View(viewData);
        }
コード例 #23
0
ファイル: UserController.cs プロジェクト: dalinhuang/newcqgj
        /// <summary>
        /// 心得体会保存 - 创建时
        /// </summary>
        public ActionResult LearnCreate()
        {
            UserPLViewData viewData = new UserPLViewData();
            viewData.user = GetUser();
            int userID = viewData.user.UserID;
            int id = GetInt("lCourse");

            var courseResultTemp = (from cr in CQGJ.CourseResult
                                    where cr.Course.CourseID == id && cr.Student.User.UserID == userID
                                    select cr);
            bool flag = false;
            viewData.course = (from c in CQGJ.Course
                               where c.CourseID == id
                               select c).First();
            CourseResult crTmp = new CourseResult();
            try
            {
                crTmp = courseResultTemp.First();
            }
            catch
            {
                flag = true;
            }
            if (flag)
            {
                crTmp.Course = viewData.course;
                crTmp.Student = (from s in CQGJ.Student
                                 where s.User.UserID == userID
                                 select s).First();
                CQGJ.AddToCourseResult(crTmp);
                CQGJ.SaveChanges(true);
            }

            LearnGain learn = new LearnGain();
            learn.CourseResult = crTmp;
            learn.Content = GetString("Content");
            learn.Title = GetString("lTitle");
            learn.PubTime = DateTime.Now;
            CQGJ.AddToLearnGain(learn);
            CQGJ.SaveChanges(true);
            return RedirectToAction("mylearn", "user");
        }
コード例 #24
0
ファイル: UserController.cs プロジェクト: dalinhuang/newcqgj
        /// <summary>
        /// 论文保存 - 编辑新论文时
        /// </summary>
        public ActionResult PaperSave()
        {
            UserPLViewData viewData = new UserPLViewData();
            viewData.user = GetUser();
            int userID = viewData.user.UserID;
            int paperid = GetInt("PaperID");
            int courseid = GetInt("CourseID");

            viewData.course = (from c in CQGJ.Course
                               where c.CourseID == courseid
                               select c).First();
            Paper paper = (from p in CQGJ.Paper
                           where p.PaperID == paperid
                           select p).First();
            paper.Title = GetString("Title");
            paper.Content = GetString("ctl00$MainContentPlaceHolder$ArticleContent");
            CQGJ.SaveChanges(true);
            return RedirectToAction("paperdetail/" + paperid, "user");
        }
コード例 #25
0
ファイル: UserController.cs プロジェクト: dalinhuang/cqgj
        /// <summary>
        /// 论文保存 - 编辑新论文时
        /// </summary>
        public void PaperSave()
        {
            IsLogin();
            UserPLViewData viewData = new UserPLViewData();
            viewData.user = (CQGJ.passport.User)HttpContext.Session["userobject"];
            int userID = viewData.user.UserID;
            userID = ToUserID(userID); //SSO用户ID转换成系统用户ID
            int paperid = GetInt("PaperID");
            int courseid = GetInt("CourseID");

            viewData.course = (from c in CQGJ.Course
                               where c.CourseID == courseid
                               select c).First();
            Paper paper = (from p in CQGJ.Paper
                           where p.PaperID == paperid
                           select p).First();
            paper.Title = GetString("pTitle");
            paper.Content = GetString("ctl00$MainContentPlaceHolder$ArticleContent");
            CQGJ.SaveChanges(true);
            RedirectToAction("paperdetail/" + paperid, "user");
        }