/// <summary> /// 获取用户头像 /// </summary> /// <param name="userId">用户ID</param> public void GetImg(string userId) { UserEntity entity = GetEntityByUserId(userId); string img = ""; string fileHeadImg = Config.GetValue("fileHeadImg"); if (entity != null) { if (!string.IsNullOrEmpty(entity.F_HeadIcon)) { string fileImg = string.Format("{0}/{1}{2}", fileHeadImg, entity.F_UserId, entity.F_HeadIcon); if (DirFileHelper.IsExistFile(fileImg)) { img = fileImg; } } } else { img = string.Format("{0}/{1}", fileHeadImg, "on-boy.jpg"); } if (string.IsNullOrEmpty(img)) { if (entity.F_Gender == 0) { img = string.Format("{0}/{1}", fileHeadImg, "on-girl.jpg"); } else { img = string.Format("{0}/{1}", fileHeadImg, "on-boy.jpg"); } } FileDownHelper.DownLoadnew(img); }
/// <summary> /// 获取图片 /// </summary> /// <param name="keyValue">主键</param> public void GetImg(string keyValue) { DTImgEntity entity = GetEntity(keyValue); string img = ""; if (entity != null) { if (!string.IsNullOrEmpty(entity.F_FileName)) { string fileHeadImg = Config.GetValue("fileAppDTImg"); string fileImg = string.Format("{0}/{1}{2}", fileHeadImg, entity.F_Id, entity.F_FileName); if (DirFileHelper.IsExistFile(fileImg)) { img = fileImg; FileDownHelper.DownLoadnew(img); return; } } } else { img = "/Content/images/add.jpg"; } if (string.IsNullOrEmpty(img)) { img = "/Content/images/add.jpg"; } FileDownHelper.DownLoad(img); }
/// <summary> /// 获取图片 /// </summary> /// <param name="keyValue">主键</param> public void GetImg(string keyValue) { string img = ""; if (!string.IsNullOrEmpty(keyValue)) { string fileHeadImg = Config.GetValue("fileHealthImg"); //Config.GetValue("fileAppDTImg"); string fileImg = string.Format("{0}/{1}{2}", fileHeadImg, keyValue, ".jpg"); if (DirFileHelper.IsExistFile(fileImg)) { img = fileImg; FileDownHelper.DownLoadnew(img); return; } } else { img = "/Content/images/add.jpg"; } if (string.IsNullOrEmpty(img)) { img = "/Content/images/add.jpg"; } FileDownHelper.DownLoad(img); }
/// <summary> /// 文件下载 /// </summary> /// <param name="path"></param> public void DownFile(string path) { try { FileDownHelper.DownLoadnew(path); } catch (Exception) { throw; } }
/// <summary> /// 下载文件 /// </summary> /// <param name="_"></param> /// <returns></returns> public Response DownAnnexesFile(dynamic _) { string name = this.GetReqData(); string fileId = name.Split('.')[0]; var data = annexesFileIBLL.GetEntity(fileId); string filepath = data.F_FilePath; if (FileDownHelper.FileExists(filepath)) { FileDownHelper.DownLoadnew(filepath); } return(Success("")); }
/// <summary> /// 获取logo图片 /// </summary> /// <param name="code">编码</param> public void GetImg(string code) { LogoImgEntity entity = GetEntity(code); string fileImg = ""; string fileHeadImg = Config.GetValue("fileLogoImg"); if (entity != null) { fileImg = string.Format("{0}/{1}{2}", fileHeadImg, entity.F_Code, entity.F_FileName); } else { fileImg = string.Format("{0}/{1}.png", fileHeadImg, code); } FileDownHelper.DownLoadnew(fileImg); }
/// <summary> /// 获取用户头像 /// </summary> /// <param name="userId">用户ID</param> public void GetImg(string userId) { UserEntity entity = GetEntityByUserId(userId); string img = ""; string fileHeadImg = Config.GetValue("fileHeadImg"); if (entity != null) { if (!string.IsNullOrEmpty(entity.F_HeadIcon)) { string fileImg = string.Format("{0}/{1}{2}", fileHeadImg, entity.F_UserId, entity.F_HeadIcon); if (DirFileHelper.IsExistFile(fileImg)) { img = fileImg; } } } else { img = string.Format("{0}/{1}", fileHeadImg, "on-boy.jpg"); } if (string.IsNullOrEmpty(img)) { if (entity.F_Gender == 0) { img = string.Format("{0}/{1}", fileHeadImg, "on-girl.jpg"); } else { img = string.Format("{0}/{1}", fileHeadImg, "on-boy.jpg"); } if (!File.Exists(img)) { img = @"D:\project\LR\力软敏捷开发框架专业版7.0\Code\Learun.Framework V7.0 pro\Learun.Application.Web\Content\images\head\on-boy.jpg"; } } FileDownHelper.DownLoadnew(img); }