Esempio n. 1
0
 /// <summary>
 /// 用户添加学习心得
 /// </summary>
 /// <param name="userid"></param>
 public void AddLearnGain(int userid, int resultID)
 {
     CourseResult result = (from r in CQGJ.CourseResult
                            where r.ResultID == resultID
                            select r).First();
     LearnGain learn = new LearnGain();
     if (GetString("title") != "")
     {
         learn.CourseResult = result;
         learn.Title = GetString("title");
         learn.Content = GetString("Content");
         learn.PubTime = GetDate("PubTime");
         CQGJ.AddToLearnGain(learn);
         CQGJ.SaveChanges();
     }
     RenderView("AddLearnGain");
 }
Esempio n. 2
0
 /// <summary>
 /// There are no comments for LearnGain in the schema.
 /// </summary>
 public void AddToLearnGain(LearnGain learnGain)
 {
     base.AddObject("LearnGain", learnGain);
 }
Esempio n. 3
0
 /// <summary>
 /// Create a new LearnGain object.
 /// </summary>
 /// <param name="learnGainID">Initial value of LearnGainID.</param>
 public static LearnGain CreateLearnGain(int learnGainID)
 {
     LearnGain learnGain = new LearnGain();
     learnGain.LearnGainID = learnGainID;
     return learnGain;
 }
Esempio n. 4
0
        /// <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
            {
                //错误
            }
        }