Esempio n. 1
0
 public string Delete(CoursePicture cp)
 {
     try
     {
         return _ICorsePictureDao.Delete(cp);
     }
     catch (Exception ex)
     {
         throw new Exception("CourseDao-->Query" + ex.Message, ex);
     }    
 }
Esempio n. 2
0
 public string Save(CoursePicture c)
 {
     try
     {
         return _ICorsePictureDao.Save(c);
     }
     catch (Exception ex)
     {
         throw new Exception("CoursePictureMgr-->Save" + ex.Message, ex);
     }
 }
Esempio n. 3
0
 public List<CoursePicture> Query(CoursePicture cp)
 {
     try
     {
         return _ICorsePictureDao.Query(cp);
     }
     catch (Exception ex)
     {
         throw new Exception("CourseDao-->Query" + ex.Message, ex);
     }
 }
Esempio n. 4
0
 public string Delete(CoursePicture cp)
 {
     StringBuilder sb = new StringBuilder();
     try
     {
         sb.AppendFormat("SET sql_safe_updates = 0; DELETE FROM course_picture WHERE course_id = {0};SET sql_safe_updates = 1;", cp.course_id);
         return sb.ToString();
     }
     catch (Exception ex)
     {
         throw new Exception("CourseDao-->Delete" + ex.Message, ex);
     }
 }
Esempio n. 5
0
 public List<CoursePicture> Query(CoursePicture cp)
 {
     StringBuilder sb = new StringBuilder();
     try
     {
         sb.AppendFormat("SELECT `id`,`course_id`,`picture_name`,`picture_type`,`picture_status`,`picture_sort` FROM course_picture WHERE course_id = {0}",cp.course_id);
         return _dbAccess.getDataTableForObj<CoursePicture>(sb.ToString());
     }
     catch (Exception ex)
     {
         throw new Exception("CourseDao-->Query" + ex.Message, ex);
     }
 }
Esempio n. 6
0
 public string Save(CoursePicture cp)
 {
     StringBuilder sb = new StringBuilder();
     try
     {
         sb.AppendFormat("INSERT INTO `course_picture`(`course_id`,`picture_name`,`picture_type`,`picture_status`,`picture_sort`) VALUES({0},'{1}','{2}',{3},{4});", cp.course_id, cp.picture_name, cp.picture_type, cp.picture_status, cp.picture_sort);
         return sb.ToString();
     }
     catch (Exception ex)
     {
         throw new Exception("CourseDao-->Save" + ex.Message, ex);
     }
 }
Esempio n. 7
0
 public List<string> GetSqlByPicture(List<CoursePicture> plist,int course_id)
 {
     List<string> list = new List<string>();
     ICoursePictureImplMgr _p = new CoursePictureMgr(conStr);
     CoursePicture c = new CoursePicture();
     c.course_id = course_id;
     list.Add(_p.Delete(c));
     try
     {
         foreach (CoursePicture item in plist)
         {
             item.course_id = course_id;
             list.Add(_p.Save(item));
         }
         
         return list;
     }
     catch (Exception ex)
     {
         throw new Exception("CourseMgr-->GetSqlByPicture" + ex, ex);
     }
 }
Esempio n. 8
0
        /// <summary>
        /// 獲取課程圖檔
        /// </summary>
        /// <returns></returns>

        public ActionResult GetCourseImg(int course_id = 0)
        {
            List<CoursePicture> list = new List<CoursePicture>();
            try
            {
                ICoursePictureImplMgr _coursePictureMgr = new CoursePictureMgr(connectionString);
                CoursePicture cp = new CoursePicture();
                cp.course_id = course_id;
   
                imgServerPath = imgServerPath + "/course/a/";
                list = _coursePictureMgr.Query(cp);
                for (int i = 0; i < list.Count;i++ )
                {
                    list[i].id =Convert.ToUInt32(i);
                    list[i].picture_name = list[i].picture_name.Replace(" ", imgServerPath);
                }

            }
            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 Json(new { images = list });
        }