Exemple #1
0
 public List<string> GetSqlByCourseDetail(List<CourseDetail> cdList, int courseId)
 {
     ICourseDetailImplMgr _detailMgr = new CourseDetailMgr(conStr);
     List<string> list = new List<string>();
     if (cdList == null)
         return null;
     int[] cdids = (from c in cdList where c.Course_Detail_Id != 0 select c.Course_Detail_Id).ToArray();
     string ids = string.Join(",", cdids);
     if (_detailMgr.Delete(cdList[0], ids))
     {
         foreach (CourseDetail cd in cdList)
         {
             if (cd.Course_Id == 0)
             {
                 cd.Course_Id = courseId;
             }
             if (cd.Course_Detail_Id == 0)
             {
                 list.Add(_detailMgr.Save(cd));
             }
             else
             {
                 list.Add(_detailMgr.Update(cd));
             }
         }
     }
     return list;
 }
 /// <summary>
 /// 獲取課程詳情 data
 /// </summary>
 /// <returns></returns>
 public ActionResult GetCurriculDetail(int course_id = 0)//add by wwei0216w 2015/5/11 修改課程F12調試時顯示的錯誤信息
 {
     try
     {
         ICourseDetailImplMgr _courseDetailMgr = new CourseDetailMgr(connectionString);
         var course = _courseDetailMgr.Query(new CourseDetail { Course_Id = course_id });
         IsoDateTimeConverter iso = new IsoDateTimeConverter() { DateTimeFormat = "yyyy-MM-dd HH:mm:ss" };
         return Content(JsonConvert.SerializeObject(course, Formatting.None, iso));
     }
     catch (Exception ex)
     {
         Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage();
         logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message);
         logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
         log.Error(logMessage);
         return new EmptyResult();
     }
 }