コード例 #1
0
 public string Delete(CoursePicture cp)
 {
     try
     {
         return _ICorsePictureDao.Delete(cp);
     }
     catch (Exception ex)
     {
         throw new Exception("CourseDao-->Query" + ex.Message, ex);
     }    
 }
コード例 #2
0
 public string Save(CoursePicture c)
 {
     try
     {
         return _ICorsePictureDao.Save(c);
     }
     catch (Exception ex)
     {
         throw new Exception("CoursePictureMgr-->Save" + ex.Message, ex);
     }
 }
コード例 #3
0
 public List<CoursePicture> Query(CoursePicture cp)
 {
     try
     {
         return _ICorsePictureDao.Query(cp);
     }
     catch (Exception ex)
     {
         throw new Exception("CourseDao-->Query" + ex.Message, ex);
     }
 }
コード例 #4
0
ファイル: CousePictureDao.cs プロジェクト: lxh2014/gigade-net
 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);
     }
 }
コード例 #5
0
ファイル: CousePictureDao.cs プロジェクト: lxh2014/gigade-net
 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);
     }
 }
コード例 #6
0
ファイル: CousePictureDao.cs プロジェクト: lxh2014/gigade-net
 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);
     }
 }
コード例 #7
0
ファイル: CourseMgr.cs プロジェクト: lxh2014/gigade-net
 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);
     }
 }
コード例 #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 });
        }