Esempio n. 1
0
        /// <summary>
        /// 获取图片
        /// </summary>
        /// <param name="keyValue">主键</param>
        public void GetImg2(string keyValue)
        {
            HomeConfigEntity entity = GetEntity(keyValue);
            string           img    = "";

            if (entity != null && !string.IsNullOrEmpty(entity.F_Img))
            {
                ImgEntity imgEntity = imgIBLL.GetEntity(entity.F_Img);

                if (imgEntity != null && !string.IsNullOrEmpty(imgEntity.F_Content))
                {
                    FileDownHelper.DownLoadBase64(imgEntity.F_Content, imgEntity.F_Name);
                    return;
                }
            }
            else
            {
                img = "/Content/images/plhome/addImg.png";
            }

            if (string.IsNullOrEmpty(img))
            {
                img = "/Content/images/plhome/addImg.png";
            }
            FileDownHelper.DownLoad(img);
        }
Esempio n. 2
0
 /// <summary>
 /// 保存实体数据(新增、修改)
 /// <param name="keyValue">主键</param>
 /// <summary>
 /// <returns></returns>
 public void SaveEntity(string keyValue, HomeConfigEntity entity)
 {
     try
     {
         if (!string.IsNullOrEmpty(keyValue))
         {
             entity.Modify(keyValue);
             this.BaseRepository().Update(entity);
         }
         else
         {
             entity.Create();
             this.BaseRepository().Insert(entity);
         }
     }
     catch (Exception ex)
     {
         if (ex is ExceptionEx)
         {
             throw;
         }
         else
         {
             throw ExceptionEx.ThrowServiceException(ex);
         }
     }
 }
Esempio n. 3
0
        /// <summary>
        /// 保存轮播图片
        /// </summary>
        /// <param name="strBase64">图片字串</param>
        /// <param name="fileNmae">文件名</param>
        /// <param name="fileExName">文件扩展名</param>
        /// <param name="keyValue">主键</param>
        public void SaveImg2(string strBase64, string fileNmae, string fileExName, string keyValue, int sort)
        {
            HomeConfigEntity entity = null;

            if (string.IsNullOrEmpty(keyValue))
            {
                entity = new HomeConfigEntity();
                entity.Create();
                entity.F_Type = "8";
            }
            else
            {
                entity = GetEntity(keyValue);

                if (entity == null)
                {
                    entity        = new HomeConfigEntity();
                    entity.F_Id   = keyValue;
                    entity.F_Type = "8";

                    keyValue = "";
                }
            }
            entity.F_Sort = sort;

            string    imgKey    = null;
            ImgEntity imgEntity = null;

            if (!string.IsNullOrEmpty(entity.F_Img))
            {
                imgEntity = imgIBLL.GetEntity(entity.F_Img);
                if (imgEntity != null)
                {
                    imgKey = entity.F_Img;
                }
                else
                {
                    imgEntity = new ImgEntity();
                }
            }
            else
            {
                imgEntity = new ImgEntity();
            }

            imgEntity.F_Content = strBase64;
            imgEntity.F_Name    = fileNmae;
            imgEntity.F_ExName  = fileExName;

            imgIBLL.SaveEntity(imgKey, imgEntity);

            entity.F_Img = imgEntity.F_Id;
            homeConfigService.SaveEntity(keyValue, entity);
        }
Esempio n. 4
0
        /// <summary>
        /// 保存图片
        /// </summary>
        /// <param name="strBase64">图片字串</param>
        /// <param name="fileNmae">文件名</param>
        /// <param name="fileExName">文件扩展名</param>
        /// <param name="type">类型</param>
        public void SaveImg(string strBase64, string fileNmae, string fileExName, string type)
        {
            HomeConfigEntity entity   = GetEntityByType(type);
            string           keyValue = null;

            if (entity == null)
            {
                entity = new HomeConfigEntity();
                entity.Create();
                entity.F_Type = type;
            }
            else
            {
                keyValue = entity.F_Id;
            }

            string    imgKey    = null;
            ImgEntity imgEntity = null;

            if (!string.IsNullOrEmpty(entity.F_Img))
            {
                imgEntity = imgIBLL.GetEntity(entity.F_Img);
                if (imgEntity != null)
                {
                    imgKey = entity.F_Img;
                }
                else
                {
                    imgEntity = new ImgEntity();
                }
            }
            else
            {
                imgEntity = new ImgEntity();
            }

            imgEntity.F_Content = strBase64;
            imgEntity.F_Name    = fileNmae;
            imgEntity.F_ExName  = fileExName;

            imgIBLL.SaveEntity(imgKey, imgEntity);

            entity.F_Img = imgEntity.F_Id;
            homeConfigService.SaveEntity(keyValue, entity);
        }
Esempio n. 5
0
 /// <summary>
 /// 保存实体数据(新增、修改)
 /// <param name="keyValue">主键</param>
 /// <summary>
 /// <returns></returns>
 public void SaveEntity(string keyValue, HomeConfigEntity entity)
 {
     try
     {
         homeConfigService.SaveEntity(keyValue, entity);
     }
     catch (Exception ex)
     {
         if (ex is ExceptionEx)
         {
             throw;
         }
         else
         {
             throw ExceptionEx.ThrowBusinessException(ex);
         }
     }
 }
Esempio n. 6
0
        /// <summary>
        /// 保存文字
        /// </summary>
        /// <param name="text"></param>
        /// <param name="type"></param>
        public void SaveText(string text, string type)
        {
            HomeConfigEntity entity   = GetEntityByType(type);
            string           keyValue = null;

            if (entity == null)
            {
                entity = new HomeConfigEntity();
                entity.Create();
            }
            else
            {
                keyValue = entity.F_Id;
            }
            entity.F_Type = type;
            entity.F_Name = text;

            homeConfigService.SaveEntity(keyValue, entity);
        }