コード例 #1
0
 /// <summary>
 /// 处理课程信息,图片转为全路径,并生成clone对象
 /// </summary>
 /// <param name="cour">课程对象的clone</param>
 /// <returns></returns>
 private Song.Entities.Course _tran(Song.Entities.Course cour)
 {
     if (cour == null)
     {
         return(cour);
     }
     Song.Entities.Course curr = cour.Clone <Song.Entities.Course>();
     curr.Cou_Logo      = WeiSha.Common.Upload.Get["Course"].Virtual + curr.Cou_Logo;
     curr.Cou_LogoSmall = WeiSha.Common.Upload.Get["Course"].Virtual + curr.Cou_LogoSmall;
     return(curr);
 }
コード例 #2
0
ファイル: Course.cs プロジェクト: redcat789/LearningSystem
        /// <summary>
        /// 处理课程信息,图片转为全路径,并生成clone对象
        /// </summary>
        /// <param name="cour">课程对象的clone</param>
        /// <returns></returns>
        private Song.Entities.Course _tran(Song.Entities.Course cour)
        {
            if (cour == null)
            {
                return(cour);
            }
            //是否免费,或是限时免费
            if (cour.Cou_IsLimitFree)
            {
                DateTime freeEnd = cour.Cou_FreeEnd.AddDays(1).Date;
                if (!(cour.Cou_FreeStart <= DateTime.Now && freeEnd >= DateTime.Now))
                {
                    cour.Cou_IsLimitFree = false;
                }
            }
            string vpath = WeiSha.Common.Upload.Get["Course"].Virtual;
            string hpath = WeiSha.Common.Upload.Get["Course"].Physics;

            Song.Entities.Course curr = cour.Clone <Song.Entities.Course>();
            curr.Cou_Logo      = System.IO.File.Exists(hpath + curr.Cou_Logo) ?  vpath + curr.Cou_Logo : "";
            curr.Cou_LogoSmall = System.IO.File.Exists(hpath + curr.Cou_LogoSmall) ? vpath + curr.Cou_LogoSmall : "";
            return(curr);
        }