/// <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 执行出现错误!");
            IObjectContainer db = DataHelper.Instance.GetDbObj(typeof(RootAlbum));
            try
            {
                IObjectSet _result = db.Query(typeof(RootAlbum));
                RootAlbum root = (RootAlbum)_result.Next();
                if (root.SubAlbums != null && root.SubAlbums.Count > 0)
                {
                    foreach (Album _album in root.SubAlbums)
                    {
                        if (_album.AlbumNO == _albumNo)
                        {
                            ChangeAlbumTitleImg(_album, _photoNo);//更新相册封面

                            db.Store(root);
                            db.Commit();

                            msg.MsgInfo = "相册首页更新成功!";
                            msg.Statevalue = true;
                            break;
                        }
                    }
                }
                if (msg.Statevalue)
                {
                }
                else
                {
                    msg.MsgInfo = "未找到符合条件的相册!";
                }
            }
            catch (Exception ex)
            {
                msg.MsgInfo = ex.Message;
            }
            finally
            {
                db.Close();
            }

            return msg;
        }
        /// <summary>
        /// 创建相册
        /// </summary>
        /// <param name="_albuminfo"></param>
        /// <returns></returns>
        public ManagerStateMsg SaveAlbum(Album _albuminfo)
        {
            bool albumIsExtbol = AlbumBolIsExt(_albuminfo.AlbumName);//相册是否已存在
            ManagerStateMsg msg = new ManagerStateMsg(false, "");
            if (!albumIsExtbol)
            {
                IObjectContainer db = DataHelper.Instance.GetDbObj(typeof(RootAlbum));
                try
                {
                    IObjectSet _result = db.Query(typeof(RootAlbum));
                    RootAlbum root = (RootAlbum)_result.Next();
                    if (root.SubAlbums != null && root.SubAlbums.Count > 0)
                    {
                        root.SubAlbums.Add(_albuminfo);
                    }
                    else
                    {
                        root.SubAlbums = new List<Album>();
                        root.SubAlbums.Add(_albuminfo);
                    }
                    db.Store(root);
                    db.Commit();
                    msg.ReturnValue = _albuminfo;
                    msg.Statevalue = true;
                    msg.MsgInfo = "保存成功";
                }
                catch (Exception ex)
                {
                }
                finally
                {
                    db.Close();
                }
            }
            else
            {
                msg.MsgInfo = "同名相册已存在!";
            }

            return msg;
        }
        /// <summary>
        /// 编辑相册信息
        /// </summary>
        /// <param name="_albuminfo">相册信息</param>
        /// <returns></returns>
        public ManagerStateMsg EditAlbum(Album _albuminfo)
        {
            ManagerStateMsg msg = new ManagerStateMsg(false, "方法 EditAlbum 执行出现错误!");
            IObjectContainer db = DataHelper.Instance.GetDbObj(typeof(RootAlbum));
            try
            {
                IObjectSet _result = db.Query(typeof(RootAlbum));
                RootAlbum root = (RootAlbum)_result.Next();
                if (root.SubAlbums != null && root.SubAlbums.Count > 0)
                {
                    foreach (Album _album in root.SubAlbums)
                    {
                        if (_album.AlbumNO == _albuminfo.AlbumNO)
                        {
                            _album.AlbumName = _albuminfo.AlbumName;
                            _album.AlbumRemark = _albuminfo.AlbumRemark;
                            _album.UpdateDate = DateTime.Now;

                            db.Store(root);
                            db.Commit();

                            msg.MsgInfo = "相册信息更新成功!";
                            msg.Statevalue = true;
                            break;
                        }
                    }
                }
                if (msg.Statevalue)
                {
                }
                else
                {
                    msg.MsgInfo = "未找到符合条件的相册!";
                }
            }
            catch (Exception ex)
            {
                msg.MsgInfo = ex.Message;
            }
            finally
            {
                db.Close();
            }

            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;
        }
        /// <summary>
        /// 创建相册
        /// </summary>
        /// <param name="_albuminfo"></param>
        /// <returns></returns>
        public ManagerStateMsg SaveAlbum(Album _albuminfo)
        {
            bool albumIsExtbol = AlbumBolIsExt(_albuminfo.AlbumName);//相册是否已存在
            ManagerStateMsg msg = new ManagerStateMsg(false, "");
            if (!albumIsExtbol)
            {
                SQLiteParameter[] pars = null;
                try
                {
                    pars = new SQLiteParameter[7];
                    pars[0] = new SQLiteParameter("@AlbumNo", DbType.String);
                    pars[0].Value = _albuminfo.AlbumNO;
                    pars[1] = new SQLiteParameter("@AlbumName", DbType.String);
                    pars[1].Value = _albuminfo.AlbumName;
                    pars[2] = new SQLiteParameter("@AlbumRootPath", DbType.String);
                    pars[2].Value = _albuminfo.AlbumRootPath;
                    pars[3] = new SQLiteParameter("@AlbumRemark", DbType.String);
                    pars[3].Value = _albuminfo.AlbumRemark;
                    pars[4] = new SQLiteParameter("@AlbumTitleImg", DbType.String);
                    pars[4].Value = _albuminfo.AlbumTitleImg;
                    pars[5] = new SQLiteParameter("@CreateDate", DbType.String);
                    pars[5].Value = _albuminfo.CreateDate;
                    pars[6] = new SQLiteParameter("@UpdateDate", DbType.String);
                    pars[6].Value = _albuminfo.UpdateDate;

                    string strSQL = "insert into Album (AlbumNo,AlbumName,AlbumRootPath,AlbumRemark,AlbumTitleImg,CreateDate,UpdateDate) values (@AlbumNo,@AlbumName,@AlbumRootPath,@AlbumRemark,@AlbumTitleImg,@CreateDate,@UpdateDate)";
                    int _uprows=SQLiteHelper.Instance.ExecuteNonQuery(strSQL, pars);
                    if (_uprows > 0)
                    {
                        msg.ReturnValue = _albuminfo;
                        msg.Statevalue = true;
                        msg.MsgInfo = "保存成功";
                    }
                    else
                    {
                        msg.MsgInfo = "写入数据库失败!";
                    }
                }
                catch (Exception ex)
                {
                }
            }
            else
            {
                msg.MsgInfo = "同名相册已存在!";
            }

            return msg;
        }
        /// <summary>
        /// 编辑相册信息
        /// </summary>
        /// <param name="_albuminfo">相册信息</param>
        /// <returns></returns>
        public ManagerStateMsg EditAlbum(Album _albuminfo)
        {
            ManagerStateMsg msg = new ManagerStateMsg(false, "方法 EditAlbum 执行出现错误!");
            try
            {
                SQLiteParameter[] pars = null;
                pars = new SQLiteParameter[4];
                pars[0] = new SQLiteParameter("@AlbumNo", DbType.String);
                pars[0].Value = _albuminfo.AlbumNO;
                pars[1] = new SQLiteParameter("@AlbumName", DbType.String);
                pars[1].Value = _albuminfo.AlbumName;
                pars[2] = new SQLiteParameter("@AlbumRemark", DbType.String);
                pars[2].Value = _albuminfo.AlbumRemark;
                pars[3] = new SQLiteParameter("@UpdateDate", DbType.String);
                pars[3].Value = _albuminfo.UpdateDate;

                string strQuerySQL ="update Album set AlbumName=@AlbumName,AlbumRemark=@AlbumRemark,UpdateDate=@UpdateDate where AlbumNo=@AlbumNo";
                int _upRowscount= SQLiteHelper.Instance.ExecuteNonQuery(strQuerySQL, pars);
                if (_upRowscount>0)
                {
                    msg.MsgInfo = "相册信息更新成功!";
                    msg.Statevalue = true;
                }
                else
                {
                    msg.MsgInfo = "更新相册信息失败!";
                }
            }
            catch (Exception ex)
            {
                msg.MsgInfo = ex.Message;
            }
            return msg;
        }
        /// <summary>
        /// 删除相册
        /// </summary>
        /// <param name="_albumNo"></param>
        /// <returns></returns>
        public ManagerStateMsg DeleteAlbum(string _albumNo)
        {
            ManagerStateMsg msg = new ManagerStateMsg(false, "方法 DeleteAlbum 执行出现错误!");
            try
            {
                string strQuerystr = "delete from Album where AlbumNo=@AlbumNo";
                SQLiteParameter[] pars = new SQLiteParameter[1];
                pars[0] = new SQLiteParameter("@AlbumNo", DbType.String);
                pars[0].Value =_albumNo;
                int uprowscount=SQLiteHelper.Instance.ExecuteNonQuery(strQuerystr,pars);
                if(uprowscount>0)
                {
                    msg.MsgInfo = "相册删除成功!";
                    msg.Statevalue = true;
                }
                else
                {
                    msg.Statevalue = true;
                    msg.MsgInfo = "未找到符合条件的相册!";
                }
            }
            catch (Exception ex)
            {
                msg.MsgInfo = ex.Message;
            }

            return msg;
        }