Beispiel #1
0
 public List<Book> BookSearch(string str_sql)
 {
     using (DataEntities ent = new DataEntities())
     {
         return ent.CreateQuery<Book>(string.Format("select * from Book where {0}",str_sql)).ToList();
     }
 }
Beispiel #2
0
 public bool BookExist(string str_sql)
 {
     using (DataEntities ent = new DataEntities())
     {
         return ent.CreateQuery<Book>(string.Format("select * from Book where {0}", str_sql)).Count()>0;
     }
 }
Beispiel #3
0
 public Book BookFind(string str_sql)
 {
     using (DataEntities ent = new DataEntities())
     {
         return ent.CreateQuery<Book>(string.Format("select * from Book where {0}", str_sql)).FirstOrDefault();
     }
 }
Beispiel #4
0
        /// <summary>
        /// 书籍列表
        /// </summary>
        /// <param name="top"></param>
        /// <param name="custitle"></param>
        /// <param name="m_where"></param>
        /// <param name="orderby"></param>
        /// <param name="htmlTemp"></param>
        /// <returns></returns>
        public static string booklist(string top, string custitle, string m_where, string orderby, string htmlTemp)
        {
            StringBuilder sb = new StringBuilder();
             using (DataEntities ent = new DataEntities())
             {

                 var list = ent.CreateQuery<Book>(string.Format("select VALUE t from Book as t where {0} order by {1} limit {2}",m_where,orderby,top));
                 var i = 0;
                 foreach (var q in list)
                 {
                     i++;
                     string item = htmlTemp;
                     item = item.Replace("{addtime}", q.Addtime.ToDateTime().ToString("yyyy-MM-dd"));
                     item=item.Replace("{author}",q.Author);
                     item=item.Replace("{classid}",q.ClassID.ToS());
                     item=item.Replace("{classname}",q.ClassName);
                     item=item.Replace("{clickcount}",q.ClickCount.ToS());
                     item=item.Replace("{corpusid}",q.CorpusID.ToS());
                     item=item.Replace("{corpustitle}",q.CorpusTitle);
                     item=item.Replace("{enable}",q.Enable.ToBoolean().ToChinese());
                     item=item.Replace("{faceimage}",q.FaceImage);
                     item=item.Replace("{id}",q.ID.ToS());
                     item=item.Replace("{intro}",q.Intro);
                     item=item.Replace("{isfirstpost}",q.IsFirstPost.ToBoolean().ToChinese());
                     item=item.Replace("{isvip}",q.IsVip.ToBoolean().ToChinese());
                     item=item.Replace("{lastchapterid}",q.LastChapterID.ToS());
                     item=item.Replace("{lastchaptertitle}",q.LastChapterTitle);
                     item=item.Replace("{lastvipchapterid}",q.LastVipChapterID.ToS());
                     item=item.Replace("{lastvipchaptertitle}",q.LastVipChapterTitle);
                     item=item.Replace("{length}",q.Length.ToS());
                     item=item.Replace("{replycount}",q.ReplyCount.ToS());
                     item=item.Replace("{savecount}",q.SaveCount.ToS());
                     item=item.Replace("{status}",q.Status==0?"连载中":"已完结");
                     item=item.Replace("{title}",q.Title);
                     item=item.Replace("{tjcount}",q.TjCount.ToS());
                     item=item.Replace("{updatetime}",q.UpdateTime.ToDateTime().ToString("yyyy-MM-dd"));
                     item=item.Replace("{vipupdatetime}",q.VipUpdateTime.ToDateTime().ToString("yyyy-MM-dd"));
                     item=item.Replace("{ztid}",q.ZtID.ToS());
                     item=item.Replace("{ztname}",q.ZtName);
                     item=item.Replace("{title}",q.Title);
                     item=item.Replace("{url}",BasePage.GetBookUrl(q,q.GetClass()));
                     item = item.Replace("{ftitle}", custitle.ToInt32() > 0 ? q.Title.CutString(custitle.ToInt32()) : q.Title);
                     item = item.Replace("{index}", (i - 1).ToS());
                     item = item.Replace("{rownum}", (i).ToS());
                     sb.Append(item);
                 }
             }
             return sb.ToS();
        }
Beispiel #5
0
        public void BookDelete(string str_sql)
        {
            //删除文件
            DataEntities ent = new DataEntities();
            var books = ent.CreateQuery<Book>(string.Format("select * from Book where {0}", str_sql)).ToList();
            foreach (var book in books)
            {
                DirectoryInfo dir = new FileInfo(System.Web.HttpContext.Current.Server.MapPath(BasePage.GetBookUrl(book, book.GetClass()))).Directory;
                if (dir.Exists)
                {
                    dir.Delete(true);
                }
                ent.DeleteObject(book);
            }

            ent.SaveChanges();
            ent.Dispose();
        }
Beispiel #6
0
 public void ClassDelete(string str_sql)
 {
     DataEntities ent = new DataEntities();
     var books = ent.CreateQuery<Book>(string.Format("select * from Book where {0}", str_sql));
     foreach (var b in books)
     {
         ent.DeleteObject(b);
     }
     ent.SaveChanges();
     ent.Dispose();
 }
Beispiel #7
0
        /// <summary>
        /// 获取电影列表
        /// </summary>
        /// <param name="top">条数</param>
        /// <param name="custitle">标题截取</param>
        /// <param name="m_where">条件语句</param>
        /// <param name="htmlTemp">模板</param>
        /// <returns></returns>
        public static string getmovielist(string top, string custitle, string m_where, string htmlTemp)
        {
            StringBuilder sb = new StringBuilder();
            using (DataEntities ent = new DataEntities())
            {
                List<MovieInfo> movies = ent.CreateQuery<MovieInfo>(string.Format("select top {0} * from MovieInfo where {1}", top, m_where)).ToList();
                var i = 0;
                foreach (MovieInfo m in movies)
                {
                    i++;
                    string item = htmlTemp;
                    item = item.Replace("{url}", BasePage.GetMovieUrl(m, m.GetClass()));
                    item = item.Replace("{id}", m.id.ToS());
                    item = item.Replace("{authors}", m.Actors);
                    item = item.Replace("{classid}", m.ClassID.ToS());
                    item = item.Replace("{classname}", m.ClassName);
                    item = item.Replace("{director}", m.Director);
                    item = item.Replace("{faceimage}", m.FaceImage);
                    item = item.Replace("{inserttime}", m.InsertTime.ToDateTime().ToString("yyyy-MM-dd"));
                    item = item.Replace("{intro}", m.Intro);
                    item = item.Replace("{ismovie}", m.IsMove == true ? "电影" : "电视剧");
                    item = item.Replace("{lastdramatitle}", m.LastDramaTitle);
                    item = item.Replace("{location}", m.Location);
                    item = item.Replace("{publicyear}", m.PublicYear);
                    item = item.Replace("{status}", m.Status == 0 ? "更新中" : "完结");
                    item = item.Replace("{tags}", m.Tags);
                    item = item.Replace("{title}", m.Title);
                    item = item.Replace("{ftitle}", m.Title.CutString(custitle.ToInt32()));
                    item = item.Replace("{updatetime}", m.UpdateTime.ToDateTime().ToString("yyyy-MM-dd"));
                    item = item.Replace("{clickcount}", m.ClickCount.ToS());
                    item = item.Replace("{replycount}", m.ReplyCount.ToS());
                    item = item.Replace("{scoreavg}", m.ScoreAvg.ToS());
                    item = item.Replace("{rownum}", i.ToS());
                    item = item.Replace("{index}", (i - 1).ToS());
                    sb.Append(item);

                }
            }
            return sb.ToS();
        }
Beispiel #8
0
        /// <summary>
        /// 获取地区列表
        /// </summary>
        /// <param name="m_where"></param>
        /// <param name="top"></param>
        /// <param name="templatestring"></param>
        /// <returns></returns>
        public static string getlocationlist(string cutstring, string m_where, string top, string templatestring)
        {
            StringBuilder sb = new StringBuilder();

            DataEntities ent = new DataEntities();
            var movies = //MovieInfoView.GetModelList(m_where);
                 ent.CreateQuery<MovieInfo>(string.Format("select * from MovieInfo where {0}", m_where)).ToList();
            ent.Dispose();

            var locations = movies.GroupBy(p => p.Location).OrderByDescending(p => p.Count()).Take(top.ToInt32(10));

            foreach (var location in locations)
            {
                string tmp = templatestring;
                tmp = tmp.Replace("{name}", location.Key.Replace(":", ""));
                tmp = tmp.Replace("{fname}", location.Key.Replace(":", "").CutString(cutstring.ToInt32(100)));
                sb.AppendLine(tmp);
            }

            return sb.ToS();
        }
Beispiel #9
0
        /// <summary>
        /// 获取行业列表
        /// </summary>
        /// <param name="top"></param>
        /// <param name="custitle"></param>
        /// <param name="m_where"></param>
        /// <param name="orderby"></param>
        /// <param name="htmlTemp"></param>
        /// <returns></returns>
        public static string getindustrylist(string top, string custitle, string m_where, string orderby, string htmlTemp)
        {
            StringBuilder sb = new StringBuilder();
            using (DataEntities ent = new DataEntities())
            {
                List<JobIndustry> list = ent.CreateQuery<JobIndustry>(string.Format("select VALUE t from JobIndustry as t where {1} order by {2} limit {0}", top, m_where, orderby)).ToList();

                var i = 0;
                foreach (var q in list)
                {
                    i++;
                    string item = htmlTemp;
                    item = item.Replace("{id}", q.ID.ToS());
                    item = item.Replace("{name}", q.Name);
                    item = item.Replace("{parentid}", q.ParentID.ToS());
                    item = item.Replace("{isleaf}", q.IsLeaf.ToS());

                    item = item.Replace("{index}", (i - 1).ToS());
                    sb.Append(item);
                }
                return sb.ToS();
            }
        }
Beispiel #10
0
        /// <summary>
        /// 获取类别列表
        /// </summary>
        /// <param name="top">获取的条数</param>
        /// <param name="custitle">标题截取长度</param>
        /// <param name="m_where">条件语句</param>
        /// <param name="htmlTemp">模板</param>
        /// <returns></returns>
        public static string getclasslist(string top, string custitle, string m_where, string htmlTemp)
        {
            StringBuilder sb = new StringBuilder();
            DataEntities ent = new DataEntities();
            List<Class> cls = ent.CreateQuery<Class>(string.Format("select VALUE t from Class as t where {1} order by t.id desc limit {0}", top, m_where)).ToList();
            ent.Dispose();

            foreach (Class c in cls)
            {
                string item = htmlTemp;
                item = item.Replace("{url}", BasePage.GetClassUrl(c));
                item = item.Replace("{alter}", c.Alter);
                item = item.Replace("{classdescription}", c.ClassDescription);
                item = item.Replace("{classfolder}", c.ClassForder);
                item = item.Replace("{classicon}", c.ClassICON);
                item = item.Replace("{classkeywords}", c.ClassKeywords);
                item = item.Replace("{classname}", c.ClassName);
                item = item.Replace("{fclassname}", c.ClassName.CutString(custitle.ToInt32(10)));
                item = item.Replace("{classpageextname}", c.ClassPageExtName);
                item = item.Replace("{id}", c.ID.ToS());
                sb.Append(item);
            }
            return sb.ToS();
        }
Beispiel #11
0
        /// <summary>
        /// 根据条件获取分类列表
        /// </summary>
        /// <param name="m_where">条件语句</param>
        /// <returns></returns>
        public static string getclassbyfilter(string m_where)
        {
            DataEntities ent = new DataEntities();

            List<Class> cls = //ClassView.GetModelList(m_where);
                ent.CreateQuery<Class>(string.Format("select VALUE t from Class as t where {0}", m_where)).ToList();
            StringBuilder sb = new StringBuilder();
            foreach (Class c in cls)
            {
                sb.AppendLine(string.Format("<a href=\"{0}\">{1}</a> ",
                    BasePage.GetClassUrl(c),
                    c.ClassName
                    ));
            }

            ent.Dispose();

            return sb.ToString();
        }
Beispiel #12
0
        public void ChapterDelete(string str_sql)
        {
            //删除文件
            DataEntities ent = new DataEntities();

            var chapters = ent.CreateQuery<BookChapter>(string.Format("select * from BookChapter where {0}",str_sql));
            foreach (var chapter in chapters)
            {
                string htmlPath = HttpContext.Current.Server.MapPath(BasePage.GetBookChapterUrl(chapter, chapter.GetClass()));
                string txtPath = HttpContext.Current.Server.MapPath(BasePage.GetBookChapterTxtUrl(chapter, chapter.GetClass()));

                Voodoo.IO.File.Delete(htmlPath);
                Voodoo.IO.File.Delete(txtPath);
                ent.DeleteObject(chapter);
            }
            ent.SaveChanges();
            ent.Dispose();
        }
Beispiel #13
0
 public List<Class> ClassSearch(string str_sql)
 {
     using (DataEntities ent = new DataEntities())
     {
         return ent.CreateQuery<Class>(string.Format("select * from Class where {0}", str_sql)).ToList();
     }
 }
Beispiel #14
0
 public Class ClassFind(string str_sql)
 {
     using (DataEntities ent = new DataEntities())
     {
         return ent.CreateQuery<Class>(string.Format("select * from Class where {0}", str_sql)).FirstOrDefault();
     }
 }
Beispiel #15
0
        /// <summary>
        /// 轮播Flash
        /// </summary>
        /// <param name="ClassID"></param>
        /// <param name="count"></param>
        /// <param name="width"></param>
        /// <param name="height"></param>
        /// <param name="showTitle"></param>
        /// <param name="titleLength"></param>
        /// <param name="interval"></param>
        /// <param name="ExtSql"></param>
        /// <param name="Order"></param>
        /// <returns></returns>
        public static string cmsflashpic(string ClassID, string count, string width, string height, string showTitle, string titleLength, string interval, string ExtSql, string Order)
        {
            DataEntities ent = new DataEntities();

            StringBuilder sb = new StringBuilder();
            sb.AppendLine("<!--开始FLASH-->");
            sb.AppendLine("<div class=\"flash\">");
            sb.AppendLine("<script type=\"text/javascript\">");
            sb.AppendLine("<!--");

            sb.AppendLine(string.Format("var interval_time={0};", interval));
            sb.AppendLine(string.Format("var focus_width={0};", width));
            sb.AppendLine(string.Format("var focus_height={0};", height));
            if (showTitle.ToInt32() > 0)
            {
                sb.AppendLine("var text_height=20;");
            }
            else
            {
                sb.AppendLine("var text_height=0;");
            }
            sb.AppendLine("var text_align=\"center\";");
            sb.AppendLine("var swf_height = focus_height+text_height;");
            sb.AppendLine("var swfpath=\"/e/data/images/pixviewer.swf\";");
            sb.AppendLine("var swfpatha=\"/e/data/images/pixviewer.swf\";");

            StringBuilder sb_pics = new StringBuilder();
            StringBuilder sb_links = new StringBuilder();
            StringBuilder sb_texts = new StringBuilder();

            #region 图片变量
            sb_pics.Append("var pics=\"");
            sb_links.Append("var links=\"");
            sb_texts.Append("var texts=\"");

            string str_sql = string.Format("(ZtID='{0}' or ClassID='{1}') and len(TitleImage)>0", ClassID, ClassID);
            if (ExtSql.Length > 0)
            {
                str_sql += " and " + ExtSql;
            }
            if (Order.Length > 0)
            {
                str_sql += " order by " + Order;
            }

            List<News> newses = //NewsView.GetModelList(str_sql, count.ToInt32());
                ent.CreateQuery<News>(string.Format("select top {0} * from News where {1}", count, str_sql)).ToList();

            newses = newses.Where(p => p.TitleImage.IndexOf(".gif") < 0).ToList();//不支持GIF文件
            foreach (News n in newses)
            {
                sb_pics.Append(n.TitleImage + "|");
                sb_links.Append(BasePage.GetNewsUrl(n, n.GetClass()) + "|");
                sb_texts.Append(n.Title.CutString(titleLength.ToInt32()) + "|");
            }
            sb_pics = sb_pics.TrimEnd('|');
            sb_links = sb_links.TrimEnd('|');
            sb_texts = sb_texts.TrimEnd('|');

            sb_pics.Append("\";\n");
            sb_links.Append("\";\n");
            sb_texts.Append("\";\n");

            sb.Append(sb_pics.ToString());
            sb.Append(sb_links.ToString());
            sb.Append(sb_texts.ToString());
            #endregion

            #region 输出Flash
            sb.AppendLine("document.write('<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\" width=\"'+ focus_width +'\" height=\"'+ swf_height +'\">'); ");
            sb.AppendLine("document.write('<param name=\"movie\" value=\"'+swfpath+'\"><param name=\"quality\" value=\"high\"><param name=\"bgcolor\" value=\"#ffffff\">'); ");
            sb.AppendLine("document.write('<param name=\"menu\" value=\"false\"><param name=wmode value=\"opaque\">'); ");
            sb.AppendLine("document.write('<param name=\"FlashVars\" value=\"pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'&text_align='+text_align+'&interval_time='+interval_time+'\">'); ");
            sb.AppendLine("document.write('<embed src=\"'+swfpath+'\" wmode=\"opaque\" FlashVars=\"pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'&text_align='+text_align+'&interval_time='+interval_time+'\" menu=\"false\" bgcolor=\"#ffffff\" quality=\"high\" width=\"'+ focus_width +'\" height=\"'+ swf_height +'\" allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" />');");
            sb.AppendLine("document.write('</object>');");
            #endregion

            sb.AppendLine("//-->");
            sb.AppendLine("</script>");
            sb.AppendLine("</div>");
            ent.Dispose();

            return sb.ToString();
        }
Beispiel #16
0
        public static string Getnovellist(string m_where, int Top, int CutTitle, string Model)
        {
            StringBuilder sb = new StringBuilder();
            DataEntities ent = new DataEntities();
            var NovelList = ent.CreateQuery<Book>(string.Format("select VALUE t from Book as t where {1} order by t.id desc take {0}", Top, m_where)).ToList();
            ent.Dispose();

            foreach (var b in NovelList)
            {
                string str = Model;
                str = str.Replace("{id}", b.ID.ToS());
                str = str.Replace("{title}", b.Title.CutString(CutTitle));
                str = str.Replace("{author}", b.Author);
                str = str.Replace("{classid}", b.ClassID.ToS());
                str = str.Replace("{classname}", b.ClassName);
                str = str.Replace("{clickcount}", b.ClickCount.ToS());
                str = str.Replace("{lastchapterid}", b.LastChapterID.ToS());
                str = str.Replace("{lastchaptertitle}", b.LastChapterTitle);
                str = str.Replace("{tjcount}", b.TjCount.ToS());
                str = str.Replace("{url}", BasePage.GetBookUrl(b, b.GetClass()));

                sb.Append(str);
            }

            return sb.ToS();
        }
Beispiel #17
0
        /// <summary>
        /// 获取演员列表
        /// </summary>
        /// <param name="top"></param>
        /// <param name="m_where"></param>
        /// <param name="templatestring"></param>
        /// <returns></returns>
        public static string getactorlist(string cutstring, string m_where, string top, string templatestring)
        {
            StringBuilder sb = new StringBuilder();
            DataEntities ent = new DataEntities();
            var movies = //MovieInfoView.GetModelList(m_where);
                 ent.CreateQuery<MovieInfo>(string.Format("select * from MovieInfo where {0}", m_where)).ToList();
            ent.Dispose();
            List<string> results = new List<string>();

            var actors = movies.GroupBy(p => p.Actors).OrderByDescending(p => p.Count()).Take(top.ToInt32(10));
            foreach (var actor in actors)
            {
                string[] acts = actor.Key.Split('/', ':', ',');
                foreach (string str in acts)
                {
                    results.Add(str);
                }
            }

            //分组处理最终结果
            var al_result = results.GroupBy(p => p.ToString()).OrderByDescending(p => p.Count());

            foreach (var str in al_result)
            {
                string tmp = templatestring;
                tmp = tmp.Replace("{name}", str.Key.ToS());
                tmp = tmp.Replace("{fname}", str.Key.ToS().CutString(cutstring.ToInt32(100)));
                sb.AppendLine(tmp);
            }
            return sb.ToS();
        }
Beispiel #18
0
        /// <summary>
        /// 获取职位列表
        /// </summary>
        /// <param name="top"></param>
        /// <param name="custitle"></param>
        /// <param name="m_where"></param>
        /// <param name="orderby"></param>
        /// <param name="htmlTemp"></param>
        /// <returns></returns>
        public static string getpostlistkip(string skip, string top, string custitle, string m_where, string orderby, string htmlTemp)
        {
            StringBuilder sb = new StringBuilder();
            using (DataEntities ent = new DataEntities())
            {
                List<JobPost> list = ent.CreateQuery<JobPost>(string.Format("select VALUE t from JobPost as t where {0} order by {1} skip {2} limit {3}", m_where, orderby, skip, top)).ToList();
                List<JobCompany> coms = (from l in ent.JobCompany select l).ToList();

                var i = 0;
                foreach (var q in list)
                {
                    i++;

                    var com = coms.Where(p => p.ID == q.CompanyID).FirstOrDefault();

                    string item = htmlTemp;
                    item = item.Replace("{city}", JobAction.GetCityName(q.City.ToInt32()));
                    item = item.Replace("{companyid}", q.CompanyID.ToS());
                    item = item.Replace("{companyname}", com.CompanyName);
                    item = item.Replace("{employeecount}", JobAction.GetEmployeeCountName(com.EmployeeCount.ToInt32()));
                    item = item.Replace("{edu}", JobAction.GetEduName(q.Edu.ToInt32()));
                    item = item.Replace("{employeenumber}", q.EmployNumber == 0 ? "若干" : q.EmployNumber.ToS());
                    item = item.Replace("{expressions}", JobAction.GetExpressionsName(q.Expressions.ToInt32()));
                    item = item.Replace("{id}", q.ID.ToS());
                    item = item.Replace("{intro}", q.Intro);
                    item = item.Replace("{posttime}", q.PostTime.ToDateTime().ToString("yyyy-MM-dd"));
                    item = item.Replace("{province}", JobAction.GetProviceName(q.Province.ToInt32()));
                    item = item.Replace("{salary}", JobAction.GetSalaryDegreeName(q.Salary.ToInt32()));
                    item = item.Replace("{title}", q.Title);
                    item = item.Replace("{ftitle}", custitle.ToInt32() > 0 ? q.Title.CutString(custitle.ToInt32()) : q.Title);
                    item = item.Replace("{ext1}", q.GetPostEduAndNumber());
                    item = item.Replace("{postedu}", q.GetPostEdu());

                    item = item.Replace("{index}", (i - 1).ToS());
                    sb.Append(item);
                }
                return sb.ToS();
            }
        }
Beispiel #19
0
        /// <summary>
        /// 获取城市列表
        /// </summary>
        /// <param name="top"></param>
        /// <param name="custitle"></param>
        /// <param name="m_where"></param>
        /// <param name="orderby"></param>
        /// <param name="htmlTemp"></param>
        /// <returns></returns>
        public static string getcitylist(string top, string custitle, string m_where, string orderby, string htmlTemp)
        {
            StringBuilder sb = new StringBuilder();
            using (DataEntities ent = new DataEntities())
            {
                var ads = ent.CreateQuery<City>(string.Format("select VALUE t from City as t where {1} order by {2} limit {0}", top, m_where, orderby)).ToList();
                var i = 0;
                foreach (var q in ads)
                {
                    i++;
                    string item = htmlTemp;

                    item = item.Replace("{id}", q.id.ToS());
                    item = item.Replace("{hot}", q.Hot.ToS());
                    item = item.Replace("{city1}", q.city1);

                    item = item.Replace("{rownum}", i.ToS());
                    item = item.Replace("{index}", (i - 1).ToS());
                    sb.Append(item);
                }

            }

            return sb.ToS();
        }
Beispiel #20
0
        /// <summary>
        /// 获取系统搜索关键词
        /// </summary>
        /// <param name="Top"></param>
        /// <returns></returns>
        public static string getsearchkey(string Top, string ModelID)
        {
            StringBuilder sb = new StringBuilder();
            DataEntities ent = new DataEntities();

            var list = //SysKeywordView.GetModelList(string.Format("ModelID={0} order by ClickCount desc", ModelID), Top.ToInt32(10));
                ent.CreateQuery<SysKeyword>(string.Format("select VALUE t from SysKeyword as t where t.ModelID={1} order by t.ClickCount desc limit  {0}", Top, ModelID)).AsCache();
            ent.Dispose();

            foreach (var item in list)
            {
                sb.Append(string.Format("<a href=\"/Book/Search/?key={0}\">{0}</a>&nbsp;", item.Keyword, ModelID));
            }
            return sb.ToS();
        }
Beispiel #21
0
        /// <summary>
        /// 根据条件获取分类列表
        /// </summary>
        /// <param name="m_where">条件语句</param>
        /// <param name="Model">字符拼接模板</param>
        /// <returns></returns>
        public static string Getclassbyfilter(string m_where, string Model)
        {
            DataEntities ent = new DataEntities();

            List<Class> cls = ent.CreateQuery<Class>(string.Format("select VALUE t from Class as t where {0}", m_where)).ToList();
            StringBuilder sb = new StringBuilder();
            foreach (Class c in cls)
            {
                string str = Model.Replace("{classname}", c.ClassName);
                str = str.Replace("{id}", c.ID.ToS());
                str = str.Replace("{url}", BasePage.GetClassUrl(c));
                sb.Append(str);
            }
            ent.Dispose();
            return sb.ToString();
        }
Beispiel #22
0
        public static string Getsearchkey(string m_where, int Top, string Model)
        {
            StringBuilder sb = new StringBuilder();
            DataEntities ent = new DataEntities();
            var list = ent.CreateQuery<SysKeyword>(string.Format("select VALUE t from SysKeyword as t where {1} order by t.ClickCount desc limit  {0}", Top, m_where)).ToList();
            ent.Dispose();

            foreach (var item in list)
            {
                string str = Model;
                str = str.Replace("{clickcount}", item.ClickCount.ToS());
                str = str.Replace("{id}", item.ID.ToS());
                str = str.Replace("{keyword}", item.Keyword);
                sb.Append(str);
            }
            return sb.ToS();
        }
Beispiel #23
0
        /// <summary>
        /// 获取公司列表
        /// </summary>
        /// <param name="top"></param>
        /// <param name="custitle"></param>
        /// <param name="m_where"></param>
        /// <param name="orderby"></param>
        /// <param name="htmlTemp"></param>
        /// <returns></returns>
        public static string getcompanylist(string top, string custitle, string m_where, string orderby, string htmlTemp)
        {
            StringBuilder sb = new StringBuilder();
            using (DataEntities ent = new DataEntities())
            {
                List<JobCompany> list = ent.CreateQuery<JobCompany>(string.Format("select VALUE t from JobCompany as t where {1} order by {2} limit {0}", top, m_where, orderby)).ToList();

                var i = 0;
                foreach (var q in list)
                {
                    i++;
                    string item = htmlTemp;
                    item = item.Replace("{companyname}", custitle.ToInt32() > 0 ? q.CompanyName.CutString(custitle.ToInt32()) : q.CompanyName);
                    item = item.Replace("{fcompanyname}", q.CompanyName);
                    item = item.Replace("{companytype}", JobAction.GetCompanyTypeName(q.CompanyType.ToInt32()));
                    item = item.Replace("{employeecount}", JobAction.GetEmployeeCountName(q.EmployeeCount.ToInt32()));
                    item = item.Replace("{id}", q.ID.ToS());
                    item = item.Replace("{Industry}", JobAction.GetIndustryName(q.Industry.ToInt32()));
                    item = item.Replace("{intro}", q.Intro);
                    item = item.Replace("{userid}", q.UserID.ToS());
                    item = item.Replace("{dayclick}", q.DayClick.ToS());

                    item = item.Replace("{rownum}", i.ToS());
                    item = item.Replace("{index}", (i - 1).ToS());
                    sb.Append(item);
                }
                return sb.ToS();
            }
        }
Beispiel #24
0
        /// <summary>
        /// 新闻列表
        /// </summary>
        /// <param name="ClassID">栏目ID</param>
        /// <param name="TitlePreChar">标题前字符</param>
        /// <param name="count">索取条数</param>
        /// <param name="TitleLength">标题保留长度</param>
        /// <param name="ExtSql">额外的Sql条件</param>
        /// <param name="Order">排序语句</param>
        /// <returns></returns>
        public string cmsnewslist(string ClassID, string TitlePreChar, string count, string TitleLength, string showTime, string ExtSql, string Order)
        {
            Class cls = NewsAction.NewsClass.Where(p => p.ID.ToString() == ClassID).First();

            DataEntities ent = new DataEntities();

            if (cls.ModelID == 1)
            {

                string str_sql = string.Format("t.classID in ({0})", GetAllSubClass(ClassID.ToInt32()));
                if (ExtSql.Length > 1)
                {
                    str_sql += " and " + ExtSql;
                }
                str_sql += Order;

                List<News> nlist = ent.CreateQuery<News>(string.Format("select Value t from News as t where {1} Order by t.id desc take {0}", count, str_sql)).ToList();
                StringBuilder sb = new StringBuilder();
                foreach (News n in nlist)
                {
                    string title = n.Title;
                    if (TitleLength.ToInt32() > 0)
                    {
                        title = title.CutString(TitleLength.ToInt32());
                    }
                    string timespan = "";
                    if (showTime.ToInt32() > 0)
                    {
                        timespan = string.Format("<span class=\"news_time_span\">{0}</span>", n.NewsTime.ToDateTime().ToString("yyyy/MM/dd"));
                    }

                    sb.AppendLine(string.Format("<li>{0}{1}<a href='{2}' title='{3}'>{4}</a></li>", TitlePreChar, timespan, BasePage.GetNewsUrl(n, n.GetClass()), n.Title, title));
                }
                return sb.ToS();
            }//Model=1 新闻
            else if (cls.ModelID == 2)
            {
                return "图";
            }
            else if (cls.ModelID == 3)//问答
            {
                string str_sql = string.Format("t.classID in ({0})", GetAllSubClass(ClassID.ToInt32()));
                if (ExtSql.Length > 1)
                {
                    str_sql += " and " + ExtSql;
                }
                str_sql += Order;
                List<Question> qlist = ent.CreateQuery<Question>(string.Format("select VALUE t from Question as t where {1} orderby t.id desc take {0}", count, str_sql)).ToList();
                StringBuilder sb = new StringBuilder();
                foreach (Question q in qlist)
                {
                    string title = q.Title;
                    if (TitleLength.ToInt32() > 0)
                    {
                        title = title.CutString(TitleLength.ToInt32());
                    }
                    string timespan = "";
                    if (showTime.ToInt32() > 0)
                    {
                        timespan = string.Format("<span class=\"news_time_span\">{0}</span>", q.AskTime.ToDateTime().ToString("yyyy/MM/dd"));
                    }

                    sb.AppendLine(string.Format("<li>{0}{1}<a href='{2}' title='{3}'>{4}</a></li>", TitlePreChar, timespan, BasePage.GetQuestionUrl(q, q.GetClass()), q.Title, title));
                }
                return sb.ToS();
            }
            else
            {
                return "未知模型";
            }
        }
Beispiel #25
0
 /// <summary>
 /// 职位申请列表
 /// </summary>
 /// <param name="top"></param>
 /// <param name="custitle"></param>
 /// <param name="m_where"></param>
 /// <param name="htmlTemp"></param>
 /// <returns></returns>
 public static string getjobapplicationlist(string top, string custitle, string m_where, string orderby, string htmlTemp)
 {
     StringBuilder sb = new StringBuilder();
     using (DataEntities ent = new DataEntities())
     {
         List<JobApplicationRecord> list = ent.CreateQuery<JobApplicationRecord>(string.Format("select VALUE t from JobApplicationRecord as t where {1} order by {2} limit {0}", top, m_where, orderby)).ToList();
         var qs = from a in list
                  from c in ent.JobCompany
                  from u in ent.User
                  from r in ent.JobResumeInfo
                  from p in ent.JobPost
                  where
                  a.UserID == u.ID
                  && a.ResumeID == r.ID
                  && a.PostID == p.ID
                  && a.CompanyID == c.ID
                  select new
                  {
                      a.ID,
                      u.UserName,
                      c.CompanyName,
                      p.Title,
                      rTitle = r.Title,
                      a.ApplicationTime,
                      a.CompanyID,
                      a.PostID,
                      a.ResumeID,
                      a.UserID
                  };
         var i = 0;
         foreach (var q in qs)
         {
             i++;
             string item = htmlTemp;
             item = item.Replace("{applicationtime}", q.ApplicationTime.ToDateTime().ToString("yyyy-MM-dd"));
             item = item.Replace("{companyid}", q.CompanyID.ToS());
             item = item.Replace("{companyname}", q.CompanyName);
             item = item.Replace("{id}", q.ID.ToS());
             item = item.Replace("{postid}", q.PostID.ToS());
             item = item.Replace("{resumeid}", q.ResumeID.ToS());
             item = item.Replace("{rtitle}", q.rTitle);
             item = item.Replace("{title}", q.Title);
             item = item.Replace("{userid}", q.UserID.ToS());
             item = item.Replace("{username}", q.UserName);
             item = item.Replace("{index}", (i - 1).ToS());
             sb.Append(item);
         }
         return sb.ToS();
     }
 }
Beispiel #26
0
        /// <summary>
        /// 获取广告列表
        /// </summary>
        /// <param name="top"></param>
        /// <param name="custitle"></param>
        /// <param name="m_where"></param>
        /// <param name="orderby"></param>
        /// <param name="htmlTemp"></param>
        /// <returns></returns>
        public string getadlist(string top, string custitle, string m_where, string orderby, string htmlTemp)
        {
            StringBuilder sb = new StringBuilder();
            using (DataEntities ent = new DataEntities())
            {
                var ads = ent.CreateQuery<Ad>(string.Format("select VALUE t from Ad as t where {1} order by {2} limit {0}", top, m_where, orderby)).ToList();
                var i = 0;
                foreach (var q in ads)
                {
                    i++;
                    string item = htmlTemp;

                    item = item.Replace("{id}", q.ID.ToS());
                    item = item.Replace("{title}", q.Title);
                    item = item.Replace("{groupid}", q.GroupID.ToS());
                    item = item.Replace("{image}", q.Image);
                    item = item.Replace("{url}", q.Url);

                    item = item.Replace("{rownum}", i.ToS());
                    item = item.Replace("{index}", (i - 1).ToS());
                    sb.Append(item);
                }

            }

            return sb.ToS();
        }
Beispiel #27
0
        /// <summary>
        /// 获取搜索系统中,剧集播放页面的地址
        /// </summary>
        /// <param name="top"></param>
        /// <param name="custitle"></param>
        /// <param name="m_where"></param>
        /// <param name="htmlTemp"></param>
        /// <returns></returns>
        public static string getmoviedramaurllist(string top, string custitle, string m_where, string htmlTemp)
        {
            DataEntities ent = new DataEntities();
            var itemList = //MovieDramaUrlView.GetModelList(m_where, top.ToInt32(100));
                ent.CreateQuery<MovieDramaUrl>(string.Format("select top {0} * from MovieDramaUrl where {1}", top, m_where)).ToList();
            ent.Dispose();
            StringBuilder sb = new StringBuilder();

            foreach (var item in itemList)
            {
                string itemTemp = htmlTemp;
                itemTemp = itemTemp.Replace("{id}", item.id.ToS());
                itemTemp = itemTemp.Replace("{moviedramaid}", item.MovieDramaID.ToString());
                itemTemp = itemTemp.Replace("moviedramatitle", item.MovieDramaTitle);
                itemTemp = itemTemp.Replace("movieid", item.MovieID.ToS());
                itemTemp = itemTemp.Replace("{movietitle}", item.MovieTitle);
                itemTemp = itemTemp.Replace("{title}", item.Title);
                itemTemp = itemTemp.Replace("{ftitle}", item.Title.CutString(custitle.ToInt32(10)));
                itemTemp = itemTemp.Replace("{updatetime}", item.UpdateTime.ToS());
                itemTemp = itemTemp.Replace("{url}", item.Url);

                sb.Append(itemTemp);
            }
            return sb.ToString();
        }
Beispiel #28
0
        /// <summary>
        /// 通过关键词读取新闻
        /// </summary>
        /// <param name="count"></param>
        /// <param name="TitleLength"></param>
        /// <param name="showTime"></param>
        /// <param name="key"></param>
        /// <param name="Order"></param>
        /// <returns></returns>
        public string getnewsbykeywords(string count, string TitleLength, string showTime, string key, string Order)
        {
            DataEntities ent = new DataEntities();

            string str_sql = "";
            str_sql += "(";
            string[] keys = Regex.Replace(key, "\\s+", ",").Split(',');
            foreach (string k in keys)
            {
                str_sql += " t.keywords like '%" + k + "%' or ";
            }
            str_sql += " 1=2)";

            List<News> nlist = ent.CreateQuery<News>(string.Format("select VALUE t from News as t where {1} {2} order by t.id desc take {0}", count, str_sql, Order)).ToList();
            StringBuilder sb = new StringBuilder();
            foreach (News n in nlist)
            {
                string title = n.Title;
                if (TitleLength.ToInt32() > 0)
                {
                    title = title.CutString(TitleLength.ToInt32());
                }
                string timespan = "";
                if (showTime.ToInt32() > 0)
                {
                    timespan = string.Format("<span class=\"news_time_span\">{0}</span>", n.NewsTime.ToDateTime().ToString("yyyy/MM/dd"));
                }

                sb.AppendLine(string.Format("<li>{0}{1}<a href='{2}' title='{3}'>{4}</a></li>", "", timespan, BasePage.GetNewsUrl(n, n.GetClass()), n.Title, title));
            }
            ent.Dispose();

            return sb.ToS();
        }
Beispiel #29
0
        public static string getnovellist(string m_where,string Order, string Top, string CutTitle, string firstClass, string ShowClickCount)
        {
            DataEntities ent = new DataEntities();

            StringBuilder sb = new StringBuilder();

            var NovelList = //BookView.GetModelList(m_where, Top.ToInt32());
                ent.CreateQuery<Book>(string.Format("select VALUE t from Book as t where {1} order by {2} take {0}", Top, m_where,Order)).ToList();
            ent.Dispose();

            foreach (var b in NovelList)
            {
                string str_cls = "";
                if (firstClass.Length > 0 && b == NovelList.First())
                {
                    str_cls = " class=\"" + firstClass + "\"";
                }

                string str_clickcount = "";
                if (ShowClickCount.ToBoolean())
                {
                    str_clickcount = string.Format("<span>{0}</span>", b.ClickCount);
                }

                sb.Append(string.Format("<li" + str_cls + "><a title=\"{0}\" href=\"{1}\">{2}</a>{3}</li>", b.Title, BasePage.GetBookUrl(b, b.GetClass()), b.Title.CutString(CutTitle.ToInt32(10)), str_clickcount));
            }

            return sb.ToS();
        }
Beispiel #30
0
        public string GetSearchResult(string m_where, int SysModel, int page, string searchword)
        {
            DataEntities ent = new DataEntities();

            int itemcount = 0;
            int pagecount = 1;
            int recordCount = 0;

            string Content = GetTempateString(1, TempType.全站搜索);

            Content = ReplacePublicTemplate(Content);
            Content = ReplacePublicTemplate(Content);
            Content = ReplacePublicTemplate(Content);

            Content = ReplaceSystemSetting(Content);

            //此处要区分系统模型
            #region 替换列表

            TemplateList temp = GetListTemplate(new Class() { ModelID = SysModel });
            #region 小说系统

            if (SysModel == 4)
            {
                StringBuilder sb_list = new StringBuilder();
                List<Book> qs = ent.CreateQuery<Book>(string.Format("select * from Book where {0}", m_where)).ToList();
                itemcount = qs.Count;
                pagecount = (Convert.ToDouble(qs.Count) / Convert.ToDouble(20)).YueShu();
                recordCount = qs.Count;

                qs = qs.Skip((page - 1) * 20).Take(20).ToList();
                foreach (Book b in qs)
                {
                    sb_list.AppendLine(ReplaceContent(temp.ListVar, b, new Class() { ModelID = SysModel }));
                }
                Content = Content.Replace("<!--list.var-->", sb_list.ToString());
            }
            #endregion 小说系统

            #region 影视

            else if (SysModel == 6)
            {
                StringBuilder sb_list = new StringBuilder();
                List<MovieInfo> qs = ent.CreateQuery<MovieInfo>(string.Format("select * from MovieInfo where {0}", m_where)).ToList();
                itemcount = qs.Count;

                pagecount = (Convert.ToDouble(qs.Count) / Convert.ToDouble(50)).YueShu();
                recordCount = qs.Count;

                qs = qs.Skip((page - 1) * 50).Take(50).ToList();
                foreach (MovieInfo m in qs)
                {
                    sb_list.AppendLine(ReplaceContent(temp.ListVar, m, new Class()));
                }
                Content = Content.Replace("<!--list.var-->", sb_list.ToString());
            }
            #endregion

            #endregion

            //替换标签变量
            Content = ReplaceTagContent(Content);

            #region 替换分页模板

            string tmp_pager = GetTempateString(1, TempType.列表分页);
            tmp_pager = tmp_pager.Replace("[!--thispage--]", page.ToS());
            tmp_pager = tmp_pager.Replace("[!--pagenum--]", pagecount.ToS());
            tmp_pager = tmp_pager.Replace("[!--lencord--]", "50");
            tmp_pager = tmp_pager.Replace("[!--num--]", recordCount.ToS());
            tmp_pager = tmp_pager.Replace("[!--pagelink--]",
                BuildPagerLink("<a href=\"/search.aspx?m=6&key=" + searchword + "&p={first}\">首页</a> <a href=\"/search.aspx?m=6&key=" + searchword + "&p={pre}\">上页</a> <a href=\"/search.aspx?m=6&key=" + searchword + "&p={next}\">下页</a> <a href=\"/search.aspx?m=6&key=" + searchword + "&p={end}\">尾页</a>", page, pagecount)
                );
            tmp_pager = tmp_pager.Replace("[!--options--]", "");

            if (recordCount <= 50)
            {
                tmp_pager = "";
            }

            Content = Content.Replace("[!--show.listpage--]", tmp_pager);

            #endregion

            ent.Dispose();

            return Content;
        }