/// <summary> /// 获取照片缩略图数据 /// </summary> /// <param name="_PhotoNo"></param> /// <returns></returns> public string GetPhotoMiniImgData(string _PhotoNo) { string strMiniData = ""; try { IPhotoManager manager = new PhotoApp.SQLitBLL.PhotoManager(); PhotoInfo _photo = manager.GetPhotoInfoByNo(_PhotoNo); strMiniData = PhotoApp.SQLitBLL.ImgManager.Instance.GetImgData(_photo.PhotoMiniData, false);//获取缩略图数据 } catch (Exception ex) { } return strMiniData; }
/// <summary> /// 获取照片原图数据 /// </summary> /// <param name="_PhotoNo"></param> /// <returns></returns> public string GetPhotoImgData(string _PhotoNo) { string strMiniData = ""; try { IPhotoManager manager = new PhotoApp.SQLitBLL.PhotoManager(); PhotoInfo _photo = manager.GetPhotoInfoByNo(_PhotoNo); strMiniData = PhotoApp.SQLitBLL.ImgManager.Instance.GetImgData(_photo.PhotoData, false);//获取原图数据 } catch (Exception ex) { } return(strMiniData); }
/// <summary> /// 更改相册封面 /// </summary> /// <param name="_albumNo">相册编号</param> /// <param name="_photoNo">封面照片编号</param> /// <returns></returns> public ManagerStateMsg ChangeTitleImg(string _albumNo, string _photoNo) { ManagerStateMsg msg = new ManagerStateMsg(false, "方法 ChangeTitleImg 执行出现错误!"); try { PhotoManager manager = new PhotoManager(); PhotoInfo _photo = manager.GetPhotoInfoByNo(_photoNo);//获取照片信息 if (_photo != null) { string strUpALLPhotoSQL = "update Photo set IsTitleImg=0 where AlbumNo=@AlbumNo"; SQLiteParameter[] photopars = new SQLiteParameter[1]; photopars[0] = new SQLiteParameter("@AlbumNo", DbType.String); photopars[0].Value = _albumNo; int uprowscount = SQLiteHelper.Instance.ExecuteNonQuery(strUpALLPhotoSQL, photopars); photopars = null; if (uprowscount > 0) { string strQuerystr = "update Album set AlbumTitleImg=@AlbumTitleImg where AlbumNo=@AlbumNo;update Photo set IsTitleImg=1 where PhotoNO=@photoNO"; SQLiteParameter[] pars = new SQLiteParameter[3]; pars[0] = new SQLiteParameter("@AlbumTitleImg", DbType.String); pars[0].Value = _photo.PhotoMiniData; pars[1] = new SQLiteParameter("@AlbumNo", DbType.String); pars[1].Value = _albumNo; pars[2] = new SQLiteParameter("@PhotoNO", DbType.String); pars[2].Value = _photoNo; uprowscount = SQLiteHelper.Instance.ExecuteNonQuery(strQuerystr, pars); pars = null; if (uprowscount > 0) { msg.Statevalue = true; msg.MsgInfo = "更新成功!"; } else { msg.MsgInfo = "更新失败!"; } } else { msg.MsgInfo = "恢复所有照片的首页状态失败!"; } } else { msg.MsgInfo = "未找到符合条件的照片信息!"; } msg.Statevalue = true; if (msg.Statevalue) { } else { msg.MsgInfo = "未找到符合条件的相册!"; } } catch (Exception ex) { msg.MsgInfo = ex.Message; } return(msg); }
/// <summary> /// 更改相册封面 /// </summary> /// <param name="_albumNo">相册编号</param> /// <param name="_photoNo">封面照片编号</param> /// <returns></returns> public ManagerStateMsg ChangeTitleImg(string _albumNo, string _photoNo) { ManagerStateMsg msg = new ManagerStateMsg(false, "方法 ChangeTitleImg 执行出现错误!"); try { PhotoManager manager = new PhotoManager(); PhotoInfo _photo = manager.GetPhotoInfoByNo(_photoNo);//获取照片信息 if (_photo!=null) { string strUpALLPhotoSQL = "update Photo set IsTitleImg=0 where AlbumNo=@AlbumNo"; SQLiteParameter[] photopars = new SQLiteParameter[1]; photopars[0] = new SQLiteParameter("@AlbumNo", DbType.String); photopars[0].Value = _albumNo; int uprowscount = SQLiteHelper.Instance.ExecuteNonQuery(strUpALLPhotoSQL, photopars); photopars = null; if (uprowscount > 0) { string strQuerystr = "update Album set AlbumTitleImg=@AlbumTitleImg where AlbumNo=@AlbumNo;update Photo set IsTitleImg=1 where PhotoNO=@photoNO"; SQLiteParameter[] pars = new SQLiteParameter[3]; pars[0] = new SQLiteParameter("@AlbumTitleImg", DbType.String); pars[0].Value = _photo.PhotoMiniData; pars[1] = new SQLiteParameter("@AlbumNo", DbType.String); pars[1].Value = _albumNo; pars[2] = new SQLiteParameter("@PhotoNO", DbType.String); pars[2].Value = _photoNo; uprowscount = SQLiteHelper.Instance.ExecuteNonQuery(strQuerystr, pars); pars = null; if (uprowscount > 0) { msg.Statevalue = true; msg.MsgInfo = "更新成功!"; } else { msg.MsgInfo = "更新失败!"; } } else { msg.MsgInfo = "恢复所有照片的首页状态失败!"; } } else { msg.MsgInfo = "未找到符合条件的照片信息!"; } msg.Statevalue = true; if (msg.Statevalue) { } else { msg.MsgInfo = "未找到符合条件的相册!"; } } catch (Exception ex) { msg.MsgInfo = ex.Message; } return msg; }