using System;
using System.Collections.Generic;
using System.Text;
using System.Reflection;
using System.Data;
using System.Data.SqlClient;
using JuSNS.Model;

namespace JuSNS.Factory
{
    public interface IMovie
    {
         /// <summary>
        /// 取得排行榜数据
        /// </summary>
        /// <param name="Num">取出数量</param>
        /// <param name="flg">0hits,1comment,2rand</param>
        /// <returns></returns>
        DataTable GetTopMovie(int Num, int flg);
        /// <summary>
        /// 取得随机电影
        /// </summary>
        /// <returns></returns>
        DataTable RandMovie();
        /// <summary>
        /// 取得好友想看的电影
        /// </summary>
        /// <param name="UsreID">会员编号</param>
        /// <returns>返回数据表</returns>
        DataTable FriendThinkLookMovie(int UsreID);
        /// <summary>
        /// 取得我想看的电影
        /// </summary>
        /// <param name="UserID"></param>
        /// <returns></returns>
        DataTable MyThinkLookMovie(int UserID);
        /// <summary>
        /// 取得好友排行榜
        /// </summary>
        /// <param name="UserID">会员编号</param>
        /// <returns>返回数据表</returns>
        DataTable getTopFriendMovie(int UserID);
        /// <summary>
        /// 取得朋友对某部电影的评论
        /// </summary>
        /// <param name="UserID">会员编号</param>
        /// <param name="MovieID">电影编号</param>
        /// <returns>返回数据表</returns>
        DataTable FriendMovieComm(int UserID, int MovieID);
        /// <summary>
        /// 添加电影类型
        /// </summary>
        /// <param name="SortName">类型名称</param>
        /// <returns>添加成功返回1</returns>
        int AddMovieSort(string SortName);
        /// <summary>
        /// 添加电影所属的类型
        /// </summary>
        /// <param name="Info">电影所属类型实体类</param>
        /// <returns>添加成功返回1</returns>
        int AddSortForMovie(MovieSortInfo Info);
        /// <summary>
        /// 取得电影类型所对应的电影
        /// </summary>
        /// <param name="SortID">类型编号</param>
        /// <returns>返回数据表</returns>
        DataTable getMoviePostFileForSort(int SortID);
        /// <summary>
        /// 取得电影类型所对应的电影海报
        /// </summary>
        /// <param name="SortID">类型编号</param>
        /// <returns>返回数据表</returns>
        DataTable getMovieUpFileForSort(int SortID);
        /// <summary>
        /// 取得电影所对应的电影类型编号
        /// </summary>
        /// <param name="movieid">电影编号</param>
        /// <returns>返回数据表</returns>
        DataTable getSortForMovie(int movieid);
        /// <summary>
        /// 取得电影类型所对应的电影编号
        /// </summary>
        /// <param name="SortID">电影类型编号</param>
        /// <returns>返回数据表</returns>
        DataTable getMovieForSort(int SortID);
        /// <summary>
        /// 取得电影类型列表
        /// </summary>
        /// <returns>返回数据表</returns>
        DataTable getDictMovieSortList();
        /// <summary>
        /// 修改电影类型
        /// </summary>
        /// <param name="SortName">类型名称</param>
        /// <param name="ID">类型编号</param>
        /// <returns>修改成功返回1</returns>
        int EditMovieSort(string SortName, int ID);
        /// <summary>
        /// 取得电影类型信息
        /// </summary>
        /// <param name="ID">电影类型编号</param>
        /// <returns>返回电影类型实体类</returns>
        Dict_MovieSortInfo MovieSortInfo(int ID);
        /// <summary>
        /// 删除电影类型
        /// </summary>
        /// <param name="ID">类型编号</param>
        /// <returns>删除成功返回1</returns>
        int DelMovieSort(int ID);
        /// <summary>
        /// 取得电影的类型
        /// </summary>
        /// <param name="MovieID">电影编号</param>
        /// <returns>返回数据表</returns>
        DataTable getMovieGut(int MovieID);
        /// <summary>
        /// 添加电影
        /// </summary>
        /// <param name="Info">电影实体类</param>
        /// <returns>添加成功返回电影编号</returns>
        int AddMovie(MovieInfo Info);
        /// <summary>
        /// 修改电影
        /// </summary>
        /// <param name="Info">电影实体类</param>
        /// <returns>修改成功返回1</returns>
        int EditMovie(MovieInfo Info);
        /// <summary>
        /// 删除电影
        /// </summary>
        /// <param name="MovieID">电影编号</param>
        /// <returns>删除成功返回1</returns>
        int DelMovie(int MovieID);
        /// <summary>
        /// 取得会员所上传的此电影海报地址
        /// </summary>
        /// <param name="movieid">电影编号</param>
        /// <returns>返回数据表</returns>
        DataTable getMoviePoster(int movieid);
        /// <summary>
        /// 获取电影海报实例
        /// </summary>
        /// <param name="ID">电影海报编号</param>
        /// <returns>返回电影海报实体类</returns>
        MoviePosterInfo getMoviePosterInfo(int ID);
        /// <summary>
        /// 删除电影海报
        /// </summary>
        /// <param name="ID">电影海报编号</param>
        /// <returns>删除成功返回1</returns>
        int DelMoviePoster(int ID);

        int LockMovie(int id, int islock);
        /// <summary>
        /// 修改电影海报
        /// </summary>
        /// <param name="MovieID">电影编号</param>
        /// <param name="PosterFile">海报地址</param>
        /// <returns>修改成功返回1</returns>
        int SetPosterFile(int MovieID, string PosterFile);
        /// <summary>
        /// 取得自已对某部电影的评论
        /// </summary>
        /// <param name="UserID">会员编号</param>
        /// <param name="MovieID">电影编号</param>
        /// <returns>返回评论信息</returns>
        string getComment(int UserID, int MovieID);
        /// <summary>
        /// 取得电影的分数
        /// </summary>
        /// <param name="UserID">会员编号</param>
        /// <param name="MovieID">电影编号</param>
        /// <returns>如果存在此记录返回分数,不存在返回-2</returns>
        int getScore(int UserID, int MovieID);
        int SaveComment(int UserID, int MovieID, string Comment);
        int SaveScore(int UserID, int MovieID, int Score);
        int UpdateWanna(int MovieID, int UserID, bool tag);
        int UpdateWonna(int MovieID, int UserID, bool tag);
        MovieInfo GetMovieInfo(int MovieID);
        //IDataReader getMovieInfo(int MovieID);
        int InsertMovieURL(int MovieID, int UserID, string MovieName, string MovieURL, int isLock);

        /// <summary>
        /// 获取分类名称
        /// </summary>
        /// <param name="SortID"></param>
        /// <returns></returns>
        string GetMovieSortName(int SortID);

        /// <summary>
        /// 得到用户上传的视频地址
        /// </summary>
        /// <param name="MovieID"></param>
        /// <returns></returns>
        DataTable GetMovieUserList(int MovieID);

        /// <summary>
        /// 上传电影海报
        /// </summary>
        /// <param name="Info">电影海报实体类</param>
        /// <returns>如果上传成功返回1</returns>
        int AddMoviePoster(MoviePosterInfo Info);
    }
    public sealed partial class DataAccess
    {
        public static IMovie CreateMovie()
        {
            string className = path + ".Movie";
            return (IMovie)Assembly.Load(path).CreateInstance(className);
        }
    }
}
