/// <summary> /// 单集列表 /// </summary> /// <param name="id"></param> protected void Drama(int id) { MovieDrama d = MovieDramaView.GetModelByID(id.ToS()); Response.Clear(); Response.Write(CreateDramapage(d, MovieInfoView.GetClass(d))); }
public string GetMovieDramaUrl(MovieDrama b, Class cls) { if (b == null) { return(""); } string result = ""; string sitrurl = "/Movie/"; result = string.Format("{0}{1}/{2}/urls/{3}{4}", sitrurl, cls.ClassForder, TitleFilter(b.MovieTitle), b.id, BasePage.SystemSetting.ExtName ); result = Regex.Replace(result, "[/]{2,}", "/"); result = result.Replace(":", "_"); result = result.Replace(">", ""); result = result.Replace("<", ""); result = result.Replace("*", ""); result = result.Replace("?", ""); result = result.Replace("|", "_"); return(result); }
public static MovieInfo GetMovie(this MovieDrama drama) { using (DataEntities ent = new DataEntities()) { return((from l in ent.MovieInfo where l.id == drama.MovieID select l).FirstOrDefault()); } }
/// <summary> /// 单集列表 /// </summary> /// <param name="id"></param> protected void Drama(int id) { DataEntities ent = new DataEntities(); MovieDrama d = (from l in ent.MovieDrama where l.id == id select l).FirstOrDefault(); ent.Dispose(); Response.Clear(); Response.Write(CreateDramapage(d, d.GetClass())); }
/// <summary> /// 生成播放页面--单集列表页面 /// </summary> /// <param name="kuaib">百度影音地址</param> /// <param name="cls">分类</param> public static void CreateDramapage(MovieDrama drama, Class cls) { TemplateHelper h = new TemplateHelper(); string FileName = BasePage.GetMovieDramaUrl(drama, cls); Voodoo.IO.File.Write(System.Web.HttpContext.Current.Server.MapPath("~" + FileName), h.CreateDramapage(drama, cls)); ping(BasePage.SystemSetting.SiteUrl.TrimEnd('/') + FileName); CreatePagesByCrateWith(4); }
/// <summary> /// 生成搜索剧集 /// </summary> /// <param name="id"></param> protected void CreateDramaPage(long id) { MovieDrama d = MovieDramaView.GetModelByID(id.ToS()); if (d.Id > 0) { Class c = MovieInfoView.GetClass(d); Voodoo.Basement.CreatePage.CreateDramapage(d, c); Response.Write(string.Format("《{0}》-剧集列表《{1}》完成", d.MovieTitle, d.Title)); } }
/// <summary> /// 生成搜索剧集 /// </summary> /// <param name="id"></param> protected void CreateDramaPage(long id) { DataEntities ent = new DataEntities(); MovieDrama d = (from l in ent.MovieDrama where l.id == id select l).FirstOrDefault(); if (d.id > 0) { Class c = d.GetClass(); Voodoo.Basement.CreatePage.CreateDramapage(d, c); Response.Write(string.Format("《{0}》-剧集列表《{1}》完成", d.MovieTitle, d.Title)); } ent.Dispose(); }
/// <summary> /// 获取下一个单集 /// </summary> /// <param name="drama"></param> /// <returns></returns> public static MovieDrama GetNextDrama(MovieDrama drama) { List <MovieDrama> lresult = MovieDramaView.GetModelList(string.Format("MovieID={0} and id>{1} order by id asc", drama.MovieID, drama.Id)); if (lresult.Count == 0) { return(null); } else { return(lresult.First()); } }
/// <summary> /// 获取下一个单集 /// </summary> /// <param name="drama"></param> /// <returns></returns> public static MovieDrama GetNextDrama(MovieDrama drama) { using (DataEntities ent = new DataEntities()) { List <MovieDrama> lresult = //MovieDramaView.GetModelList(string.Format("MovieID={0} and id>{1} order by id asc", drama.MovieID, drama.Id)); (from l in ent.MovieDrama where l.MovieID == drama.MovieID && l.id > drama.id orderby l.id select l).ToList(); if (lresult.Count == 0) { return(null); } else { return(lresult.First()); } } }
/// <summary> /// DataTable转换为list /// </summary> /// <param name="dt"></param> /// <returns></returns> protected static List <MovieDrama> DataTableToList(DataTable dt) { List <MovieDrama> Ms = new List <MovieDrama>(); for (int i = 0; i < dt.Rows.Count; i++) { MovieDrama M = new MovieDrama(); M.Id = dt.Rows[i]["id"].ToInt64(); M.MovieID = dt.Rows[i]["MovieID"].ToInt32(); M.MovieTitle = dt.Rows[i]["MovieTitle"].ToString(); M.Title = dt.Rows[i]["Title"].ToString(); M.UpdateTime = dt.Rows[i]["UpdateTime"].ToDateTime(); M.Enable = dt.Rows[i]["Enable"].ToBoolean(); Ms.Add(M); } return(Ms); }
/// <summary> /// 将修改过的实体修改到数据库 /// </summary> /// <param name="M">赋值后的实体</param> /// <returns></returns> public static int Update(MovieDrama M) { IDbHelper Sql = GetHelper(); StringBuilder sb = new StringBuilder(); sb.Append("update [MovieDrama] set "); sb.Append("[MovieID]=" + M.MovieID.ToS()); sb.Append(","); sb.Append("[MovieTitle]=N'" + M.MovieTitle + "'"); sb.Append(","); sb.Append("[Title]=N'" + M.Title + "'"); sb.Append(","); sb.Append("[UpdateTime]=N'" + M.UpdateTime + "'"); sb.Append(","); sb.Append("[Enable]=" + M.Enable.ToS()); sb.Append(" where Id='" + M.Id + "'"); sb.Append(""); if (DataBase.CmsDbType == DataBase.DbType.SqlServer) { sb.Append(";select @@ROWCOUNT"); } if (DataBase.CmsDbType == DataBase.DbType.SQLite) { sb.Append(";select 0"); } if (DataBase.CmsDbType == DataBase.DbType.MySql) { sb.Append(";SELECT ROW_COUNT()"); } if (DataBase.CmsDbType == DataBase.DbType.Access) { sb.Append(";select 0"); } if (DataBase.CmsDbType == DataBase.DbType.Oracle) { sb.Append(";select SQL%ROWCOUNT"); } return(Sql.ExecuteScalar(CommandType.Text, sb.ToString()).ToInt32()); }
/// <summary> /// 将数据插入表 /// </summary> /// <param name="M">赋值后的实体</param> /// <returns></returns> public static void Insert(MovieDrama M) { IDbHelper Sql = GetHelper(); StringBuilder sb = new StringBuilder(); sb.Append("insert into [MovieDrama]([id],[MovieID],[MovieTitle],[Title],[UpdateTime],[Enable]) values("); sb.Append(M.MovieID.ToS()); sb.Append(","); sb.Append("N'" + M.MovieTitle + "'"); sb.Append(","); sb.Append("N'" + M.Title + "'"); sb.Append(","); sb.Append("N'" + M.UpdateTime + "'"); sb.Append(","); sb.Append(M.Enable.ToS()); sb.Append(")"); if (DataBase.CmsDbType == DataBase.DbType.SqlServer) { sb.Append(";select @@Identity"); } if (DataBase.CmsDbType == DataBase.DbType.SQLite) { sb.Append(";select last_insert_rowid()"); } if (DataBase.CmsDbType == DataBase.DbType.MySql) { sb.Append(";select LAST_INSERT_ID()"); } if (DataBase.CmsDbType == DataBase.DbType.Access) { sb.Append(";select max(id) from MovieDrama"); } if (DataBase.CmsDbType == DataBase.DbType.Oracle) { sb.Append(";select LAST_INSERT_ID()"); } M.Id = Sql.ExecuteScalar(CommandType.Text, sb.ToString()).ToInt32(); }
/// <summary> /// 根据条件语句取得第一个实体 /// </summary> /// <param name="m_where">条件语句,不包含“where”</param> /// <returns></returns> public static MovieDrama Find(string m_where) { IDbHelper Sql = GetHelper(); MovieDrama M = new MovieDrama(); DbDataReader Rs = Sql.ExecuteReader(CommandType.Text, "select [id],[MovieID],[MovieTitle],[Title],[UpdateTime],[Enable] from [MovieDrama] where " + m_where, true); if (!Rs.Read()) { M.Id = long.MinValue; } else { M.Id = Rs["id"].ToInt64(); M.MovieID = Rs["MovieID"].ToInt32(); M.MovieTitle = Rs["MovieTitle"].ToString(); M.Title = Rs["Title"].ToString(); M.UpdateTime = Rs["UpdateTime"].ToDateTime(); M.Enable = Rs["Enable"].ToBoolean(); } Rs.Close(); Rs = null; return(M); }
public static string GetMovieDramaUrl(MovieDrama b, Class cls) { return(GetConverter().GetMovieDramaUrl(b, cls)); }
public string GetMovieDramaUrl(MovieDrama b, Class cls) { if (b == null) { return ""; } string result = ""; string sitrurl = "/Movie/"; result = string.Format("{0}{1}/{2}/urls/{3}{4}", sitrurl, cls.ClassForder, TitleFilter(b.MovieTitle), b.id, BasePage.SystemSetting.ExtName ); result = Regex.Replace(result, "[/]{2,}", "/"); result = result.Replace(":", "_"); result = result.Replace(">", ""); result = result.Replace("<", ""); result = result.Replace("*", ""); result = result.Replace("?", ""); result = result.Replace("|", "_"); return result; }
public string GetMovieDramaUrl(MovieDrama b, Class cls) { return(string.Format("/Dynamic/Movie/?a=drama&id={0}", b.id)); }
public static Class GetClass(MovieDrama mu) { return(ClassView.GetModelByID(MovieInfoView.GetModelByID(mu.MovieID.ToS()).ClassID.ToS())); }
public void AddToMovieDrama(MovieDrama movieDrama) { base.AddObject("MovieDrama", movieDrama); }
public static MovieDrama CreateMovieDrama(long id) { MovieDrama movieDrama = new MovieDrama(); movieDrama.id = id; return movieDrama; }