コード例 #1
0
ファイル: AdvertisingService.cs プロジェクト: yaotyl/spb4mono
 /// <summary>
 /// 上传示意图
 /// </summary>
 /// <param name="position">广告位</param>
 /// <param name="stream">图片流</param>
 private void UploadPositionImage(AdvertisingPosition position, Stream stream)
 {
     if (stream != null)
     {
         LogoService logoService = new LogoService(TenantTypeIds.Instance().AdvertisingPosition());
         position.FeaturedImage = logoService.UploadLogo(position.PositionId, stream);
         advertisingPositionRepository.Update(position);
     }
 }
コード例 #2
0
        /// <summary>
        /// 新建实体时使用
        /// </summary>
        public static AdvertisingPosition New()
        {
            AdvertisingPosition advertisingPosition = new AdvertisingPosition()
            {
                Description   = string.Empty,
                FeaturedImage = string.Empty
            };

            return(advertisingPosition);
        }
コード例 #3
0
ファイル: AdvertisingService.cs プロジェクト: yaotyl/spb4mono
        /// <summary>
        /// 删除广告位示意图
        /// </summary>
        /// <param name="positionId">广告位Id</param>
        public void DeletePositionImage(string positionId)
        {
            LogoService logoService = new LogoService(TenantTypeIds.Instance().AdvertisingPosition());

            logoService.DeleteLogo(positionId);

            AdvertisingPosition position = GetPosition(positionId);

            if (position == null)
            {
                return;
            }

            position.FeaturedImage = string.Empty;
            advertisingPositionRepository.Update(position);
        }
コード例 #4
0
ファイル: AdvertisingService.cs プロジェクト: yaotyl/spb4mono
        /// <summary>
        /// 删除广告位
        /// </summary>
        /// <param name="positionId"></param>
        /// <returns></returns>
        public bool DeletePosition(string positionId)
        {
            AdvertisingPosition position = advertisingPositionRepository.Get(positionId);
            int result = advertisingPositionRepository.Delete(position);

            if (result > 0)
            {
                LogoService logoService = new LogoService(TenantTypeIds.Instance().AdvertisingPosition());
                logoService.DeleteLogo(positionId);
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #5
0
ファイル: AdvertisingService.cs プロジェクト: yaotyl/spb4mono
        /// <summary>
        /// 创建广告位
        /// </summary>
        /// <param name="position">广告位</param>
        /// <param name="stream">图片流</param>
        /// <returns></returns>
        public bool CreatePosition(AdvertisingPosition position, Stream stream)
        {
            advertisingPositionRepository.Insert(position);

            AdvertisingPosition advertisingPosition = advertisingPositionRepository.Get(position.PositionId);

            if (advertisingPosition != null)
            {
                UploadPositionImage(position, stream);
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #6
0
        /// <summary>
        /// 新建实体时使用
        /// </summary>
        public static AdvertisingPosition New()
        {
            AdvertisingPosition advertisingPosition = new AdvertisingPosition()
            {
                Description = string.Empty,
                FeaturedImage = string.Empty

            };
            return advertisingPosition;
        }
コード例 #7
0
ファイル: AdvertisingService.cs プロジェクト: hbulzy/SYS
 /// <summary>
 /// 上传示意图
 /// </summary>
 /// <param name="position">广告位</param>
 /// <param name="stream">图片流</param>
 private void UploadPositionImage(AdvertisingPosition position, Stream stream)
 {
     if (stream != null)
     {
         LogoService logoService = new LogoService(TenantTypeIds.Instance().AdvertisingPosition());
         position.FeaturedImage = logoService.UploadLogo(position.PositionId, stream);
         advertisingPositionRepository.Update(position);
     }
 }
コード例 #8
0
ファイル: AdvertisingService.cs プロジェクト: hbulzy/SYS
 /// <summary>
 /// 更新广告位
 /// </summary>
 /// <param name="position">广告位</param>
 /// <param name="stream">图片流</param>
 public void UpdatePosition(AdvertisingPosition position, Stream stream)
 {
     advertisingPositionRepository.Update(position);
     UploadPositionImage(position, stream);
 }
コード例 #9
0
ファイル: AdvertisingService.cs プロジェクト: hbulzy/SYS
        /// <summary>
        /// 创建广告位
        /// </summary>
        /// <param name="position">广告位</param>
        /// <param name="stream">图片流</param>
        /// <returns></returns>
        public bool CreatePosition(AdvertisingPosition position, Stream stream)
        {
            advertisingPositionRepository.Insert(position);

            AdvertisingPosition advertisingPosition = advertisingPositionRepository.Get(position.PositionId);
            if (advertisingPosition != null)
            {
                UploadPositionImage(position, stream);
                return true;
            }
            else
            {
                return false;
            }
        }
コード例 #10
0
ファイル: AdvertisingService.cs プロジェクト: yaotyl/spb4mono
 /// <summary>
 /// 更新广告位
 /// </summary>
 /// <param name="position">广告位</param>
 /// <param name="stream">图片流</param>
 public void UpdatePosition(AdvertisingPosition position, Stream stream)
 {
     advertisingPositionRepository.Update(position);
     UploadPositionImage(position, stream);
 }