示例#1
0
        /// <summary>
        /// 获取最新更新的书籍 Metro风格
        /// </summary>
        /// <param name="top"></param>
        /// <returns></returns>
        public string getnoveltopmetroupdate(string top)
        {
            int           i_top = top.ToInt32();
            List <Book>   bs    = BookView.GetModelList("Enable=1 order by UpdateTime desc", i_top);
            StringBuilder sb    = new StringBuilder();
            int           i     = 1;

            foreach (Book b in bs)
            {
                Class c = BookView.GetClass(b);
                sb.AppendLine(string.Format("<li style=\" background-color:{0};\"><div class=\"item\"><h1><a href=\"{1}\">" + i + ".{2}</a></h1><div><div class=\"lastchapter\"><a href=\"{5}\">{6}</a></div></div></div><div class=\"item\"><h1><a href=\"{1}\">阅读书籍</a></h1><div><div class=\"lastchapter\"><a href=\"{5}\" title=\"{6}\">阅读最新章节</a></div><div class=\"class\">分类:<a href=\"{3}\">{4}</a></div><div class=\"author\">作者:{8}</div><div class=\"time\">更新时间:{9}</div></div></div></li>",
                                            BasePage.RandomBGColor(),
                                            BasePage.GetBookUrl(b, c),
                                            b.Title,
                                            BasePage.GetClassUrl(c),
                                            b.ClassName,
                                            BasePage.GetBookChapterUrl(BookChapterView.GetModelByID(b.LastChapterID.ToS()), c),
                                            b.LastChapterTitle,
                                            b.LastChapterTitle.CutString(12),
                                            b.Author,
                                            b.UpdateTime.ToString("MM-dd HH:mm")
                                            ));
                i++;
            }
            return(sb.ToS());
        }
示例#2
0
        /// <summary>
        /// 获取小说列表
        /// </summary>
        /// <param name="m_where"></param>
        /// <returns></returns>
        public static string getnovellist(string m_where, string Top, string CutTitle, string firstClass, string ShowClickCount)
        {
            StringBuilder sb = new StringBuilder();

            var NovelList = BookView.GetModelList(m_where, Top.ToInt32());

            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, BookView.GetClass(b)), b.Title.CutString(CutTitle.ToInt32(10)), str_clickcount));
            }

            return(sb.ToS());
        }
示例#3
0
        /// <summary>
        /// 获取最新更新的书籍
        /// </summary>
        /// <param name="top"></param>
        /// <returns></returns>
        public string getnoveltopupdate(string top)
        {
            int           i_top = top.ToInt32();
            List <Book>   bs    = BookView.GetModelList("Enable=1 order by UpdateTime desc", i_top);
            StringBuilder sb    = new StringBuilder();

            //foreach (Book b in bs)
            for (int i = 0; i < bs.Count; i++)
            {
                Book   b         = bs[i];
                Class  c         = BookView.GetClass(b);
                string str_style = "";
                if (i % 2 == 0)
                {
                    str_style = " style=\"background-color: #f5f5f5\"";
                }

                sb.AppendLine(string.Format("<tr" + str_style + "><td>[<a target=\"_blank\" href=\"{0}\" class=\"sort\">{1}</a>]</td><td><a class=\"name\" target=\"_blank\" href=\"{2}\">{3}</a> <a target=\"_blank\" href=\"{4}\" class=\"chapter\">{5}</a></td><td><a target=\"_blank\" href=\"/Search.aspx?m=4&key={6}\" class=\"author\">{6}</a></td><td style=\"color: #666666\">{7}</td></tr>",
                                            BasePage.GetClassUrl(c),
                                            b.ClassName,
                                            BasePage.GetBookUrl(b, c),
                                            b.Title,
                                            BasePage.GetBookChapterUrl(BookChapterView.GetModelByID(b.LastChapterID.ToS()), c),
                                            b.LastChapterTitle,
                                            b.Author,
                                            b.UpdateTime.ToString("MM-dd HH:mm")
                                            ));
            }
            return(sb.ToS());
        }
示例#4
0
        public static string Getnovellist(string m_where, int Top, int CutTitle, string Model)
        {
            StringBuilder sb = new StringBuilder();

            var NovelList = BookView.GetModelList(m_where, Top.ToInt32());

            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, BookView.GetClass(b)));

                sb.Append(str);
            }

            return(sb.ToS());
        }
示例#5
0
        protected void CreateTxt(int Bookid)
        {
            DataEntities ent = new DataEntities();

            Book  b   = (from l in ent.Book where l.ID == Bookid select l).FirstOrDefault();
            Class cls = b.GetClass();
            var   cs  = (from l in ent.BookChapter where l.BookID == Bookid orderby l.ChapterIndex orderby l.ID select l).ToList();

            ent.Dispose();

            StringBuilder sb = new StringBuilder();

            sb.AppendLine(string.Format("《{0}》\n 作者:{1} \n 更多精彩小说,请访问{2}\n\n\n\n\n", b.Title, b.Author, BasePage.SystemSetting.SiteName));

            foreach (var c in cs)
            {
                sb.AppendLine(c.Title);
                sb.AppendLine(Voodoo.IO.File.Read(Server.MapPath(BasePage.GetBookChapterTxtUrl(c, cls)), Voodoo.IO.File.EnCode.UTF8).TrimHTML());
            }


            HttpContext.Current.Response.ContentType = "application/text";
            HttpContext.Current.Response.AddHeader("Content-Disposition", string.Format("attachment;filename={0}.txt", b.Title));
            HttpContext.Current.Response.Clear();
            HttpContext.Current.Response.BinaryWrite(sb.ToS().ToByteArray(Encoding.UTF8));
            HttpContext.Current.Response.End();
        }
示例#6
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)
        {
            string str_sql = "";

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



            List <News>   nlist = NewsView.GetModelList(str_sql + " " + Order, count.ToInt32());
            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.ToString("yyyy/MM/dd"));
                }

                sb.AppendLine(string.Format("<li>{0}{1}<a href='{2}' title='{3}'>{4}</a></li>", "", timespan, BasePage.GetNewsUrl(n, NewsView.GetNewsClass(n)), n.Title, title));
            }
            return(sb.ToS());
        }
示例#7
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();
            var           movies  = MovieInfoView.GetModelList(m_where);
            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());
        }
示例#8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                string chapters = "";
                if (Voodoo.Cookies.Cookies.GetCookie("history") != null)
                {
                    chapters = Voodoo.Cookies.Cookies.GetCookie("history").Value;
                }
                string[] cs = chapters.Split(',');

                List <Cook> cookie = new List <Cook>();

                string ids = "";
                foreach (string chapter in cs)
                {
                    string[] Arr_chapter = chapter.Split('|');
                    cookie.Add(new Cook()
                    {
                        id = Arr_chapter[0].ToInt64(), time = Arr_chapter[1].ToDateTime()
                    });
                    ids += Arr_chapter[0] + ",";
                }

                ids = ids.TrimEnd(',');

                List <BookChapter> list_chapter = BookChapterView.GetModelList(string.Format("id in({0})", ids));

                StringBuilder sb = new StringBuilder();
                sb.Append("document.write('");
                foreach (BookChapter bc in list_chapter)
                {
                    Book  b = BookView.GetModelByID(bc.BookID.ToString());
                    Class c = ClassView.GetModelByID(bc.ClassID.ToString());

                    BookChapter new_Chapter = BookChapterView.GetModelByID(b.LastChapterID.ToString());

                    sb.Append(string.Format("<a href=\"{0}\">{1}</a>(<a href=\"{2}\">{3}</a>) 最新:<a href=\"{4}\">{5}</a><br />",
                                            BasePage.GetBookUrl(b, c),
                                            bc.BookTitle,
                                            BasePage.GetBookChapterUrl(bc, c),
                                            bc.Title,
                                            BasePage.GetBookChapterUrl(new_Chapter, c),
                                            b.LastChapterTitle
                                            ));
                }
                sb.Append("');");

                Response.Clear();
                Response.Write(sb.ToS());
            }// end try
            catch
            {
                Voodoo.Cookies.Cookies.Remove("history");
            }
        }
示例#9
0
        /// <summary>
        /// 获取小说栏目列表
        /// </summary>
        /// <param name="str"></param>
        /// <returns></returns>
        public string getallnovelclass(string str)
        {
            List <Class>  cls = ClassView.GetModelList("ModelID=4");
            StringBuilder sb  = new StringBuilder();

            foreach (Class c in cls)
            {
                sb.Append(string.Format("<a href=\"{0}\">{1}</a> ", BasePage.GetClassUrl(c), c.ClassName));
            }
            return(sb.ToS());
        }
示例#10
0
        /// <summary>
        /// 获取所有子栏目
        /// </summary>
        /// <param name="ClassID"></param>
        /// <returns></returns>
        protected string GetAllSubClass(int ClassID)
        {
            var           cls = ClassView.GetModelList(string.Format("ParentID={0}", ClassID));
            StringBuilder sb  = new StringBuilder();

            foreach (var c in cls)
            {
                sb.Append(c.ID + ",");
            }
            sb.Append(ClassID);
            return(sb.ToS());
        }
示例#11
0
        /// <summary>
        /// 获取系统搜索关键词
        /// </summary>
        /// <param name="Top"></param>
        /// <returns></returns>
        public static string getsearchkey(string Top, string ModelID)
        {
            StringBuilder sb = new StringBuilder();

            var list = SysKeywordView.GetModelList(string.Format("ModelID={0} order by ClickCount desc", ModelID), Top.ToInt32(10));

            foreach (var item in list)
            {
                sb.Append(string.Format("<a href=\"/Search.aspx?m={1}&key={0}\">{0}</a>&nbsp;", item.Keyword, ModelID));
            }
            return(sb.ToS());
        }
示例#12
0
 /// <summary>
 /// 对字符串进行MD5加密
 /// </summary>
 /// <param name="str"></param>
 /// <returns></returns>
 public static string ToMD5(this string str)
 {
     MD5 md5 = new MD5CryptoServiceProvider();
     byte[] data = Encoding.UTF8.GetBytes(str);
     byte[] md5data = md5.ComputeHash(data);
     md5.Clear();
     StringBuilder sBuilder = new StringBuilder();
     for (int i = 0; i < md5data.Length; i++)
     {
         sBuilder.Append(md5data[i].ToString("X2"));
     }
     return sBuilder.ToS();
 }
示例#13
0
        protected void LoadInfo()
        {
            StringBuilder sb = new StringBuilder();

            using (DataEntities ent = new DataEntities())
            {
                var qs = from l in ent.Province select l;
                foreach (var q in qs)
                {
                    sb.AppendLine(q.province1);
                }
            }
            txt_Provinces.Text = sb.ToS();
        }
示例#14
0
        /// <summary>
        /// 提交章节内容到目标站点
        /// </summary>
        /// <param name="b"></param>
        public void SubmitBook(BookAndChapter b)
        {
            Setting s = Book.RulesOperate.GetSetting();

            foreach (Chapter c in b.Chapters)
            {
                CollectStatus.ChapterTitle = c.Title;
                CollectStatus.Status       = "正在提交";

                BookChapter chapter_Submited;

                Status_Chage();

                StringBuilder sb = new StringBuilder();
                sb.Append(string.Format("书籍{0}的章节:{1}正在处理中,请稍后访问阅读,或者百度搜索“{0}{1}”查找本章节。阅读{0}最新章节,尽在<a href={2}>{2}</a>。", b.BookTitle, c.Title, s.TargetUrl));

                if (c.Content.IsNullOrEmpty() || c.Content.Trim().IsNullOrEmpty())
                {
                    this.CollectStatus.Status = "这张没有采集到"; Status_Chage();
                    chapter_Submited          = BH.ChapterAdd(b.ID, c.Title, sb.ToS(), true, true);

                    //生成章节页面
                    this.CollectStatus.Status = "生成章节";
                    Status_Chage();
                    BH.CreateChapters(chapter_Submited.ID);

                    continue;
                }


                chapter_Submited = BH.ChapterAdd(b.ID, c.Title, c.Content, c.IsImageChapter);

                if (chapter_Submited.ID < 0)
                {
                    this.CollectStatus.Status = "章节保存失败"; Status_Chage();
                    Thread.Sleep(2000);
                }
                else
                {
                    //保存成功 ,更新章节地址
                    c.Url     = b.Url + chapter_Submited.ID + ".htm";
                    b.Changed = true;
                }
                //生成章节页面
                this.CollectStatus.Status = "生成章节";
                Status_Chage();
                BH.CreateChapters(chapter_Submited.ID);
            }
            BookNeedCollect = b;
        }
示例#15
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();
        }
示例#16
0
        /// <summary>
        /// 对字符串进行MD5加密
        /// </summary>
        /// <param name="str"></param>
        /// <returns></returns>
        public static string ToMD5(this string str)
        {
            MD5 md5 = new MD5CryptoServiceProvider();

            byte[] data    = Encoding.UTF8.GetBytes(str);
            byte[] md5data = md5.ComputeHash(data);
            md5.Clear();
            StringBuilder sBuilder = new StringBuilder();

            for (int i = 0; i < md5data.Length; i++)
            {
                sBuilder.Append(md5data[i].ToString("X2"));
            }
            return(sBuilder.ToS());
        }
示例#17
0
        /// <summary>
        /// 获取员工数量选择项
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        public string GetEmplyeeCountItems(int?value)
        {
            StringBuilder sb = new StringBuilder();

            employeeCount = null;
            newUrl();
            sb.AppendFormat("<option value=\"{0}\" {1}>不限规模</option>", curUrl, value == null ? "selected='selected'" : "");
            foreach (var item in JobAction.EmployeeCount)
            {
                employeeCount = item.Key;
                newUrl();
                sb.AppendFormat("<option value=\"{0}\" {1}>{2}</option>", curUrl, item.Key == value ? "selected='selected'" : "", item.Value);
            }
            return(sb.ToS());
        }
示例#18
0
        public static string Getsearchkey(string m_where, int Top, string Model)
        {
            StringBuilder sb = new StringBuilder();

            var list = SysKeywordView.GetModelList(m_where, Top);

            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());
        }
示例#19
0
        /// <summary>
        /// 获取章节正文
        /// </summary>
        /// <param name="r"></param>
        /// <param name="html"></param>
        /// <returns></returns>
        public string GetChapterContent(BookRule r, string html)
        {
            StringBuilder sb          = new StringBuilder();
            var           regexResult = (ChapterContent)SetMatchResult(typeof(ChapterContent), html, r.ContentRule).FirstOrDefault();

            sb.Append(regexResult.content);

            if (r.NextContentRule.IsNullOrEmpty() == false &&
                html.GetMatchGroup(r.NextContentRule).Groups.Count > 0)
            {
                string nextHtml = Url.GetHtml(html.GetMatch(r.NextContentRule).FirstOrDefault().AppendToDomain(RootUrl));
                sb.Append(GetChapterContent(r, nextHtml));
            }

            return(sb.ToS());
        }
示例#20
0
        protected string GetUserGroupString()
        {
            List <UserGroup> gs = UserGroupView.GetModelList();

            gs = gs.Where(p => p.EnableReg).ToList();

            StringBuilder sb = new StringBuilder();

            sb.Append("<tr>");
            foreach (var g in gs)
            {
                sb.AppendLine("<td style='color:#000;width:100px'><input type=\"radio\" name=\"group\" id=\"" + g.ID + "\" value=\"" + g.ID + "\" /><label for=\"" + g.ID + "\">" + g.GroupName + "</label></td>");
            }
            sb.Append("</tr>");
            return(sb.ToS());
        }
示例#21
0
        protected void ddl_Province_SelectedIndexChanged(object sender, EventArgs e)
        {
            int           selectID = ddl_Province.SelectedValue.ToInt32();
            StringBuilder sb       = new StringBuilder();

            using (DataEntities ent = new DataEntities())
            {
                var qs = from l in ent.City where l.ProvinceID == selectID select l;
                foreach (var q in qs)
                {
                    sb.AppendLine(q.city1);
                }
            }

            txt_Provinces.Text = sb.ToS();
        }
示例#22
0
        protected string GetUserGroupString()
        {
            DataEntities ent = new DataEntities();

            List<UserGroup> gs = (from l in ent.UserGroup select l).ToList();
            ent.Dispose();
            gs = gs.Where(p => p.EnableReg==true).ToList();

            StringBuilder sb = new StringBuilder();
            sb.Append("<tr>");
            foreach (var g in gs)
            {
                sb.AppendLine("<td style='color:#000;width:100px'><input type=\"radio\" name=\"group\" id=\"" + g.ID + "\" value=\"" + g.ID + "\" /><label for=\"" + g.ID + "\">" + g.GroupName + "</label></td>");
            }
            sb.Append("</tr>");
            return sb.ToS();
        }
示例#23
0
        /// <summary>
        /// 绑定行业选项
        /// </summary>
        protected void BindIndustry()
        {
            using (DataEntities ent = new DataEntities())
            {
                StringBuilder sb = new StringBuilder();

                var qs = (from l in ent.JobIndustry where l.ParentID == 0 select l).AsCache("parent0");
                foreach (var q in qs)
                {
                    industry = q.ID;
                    newUrl();
                    sb.AppendFormat("<a href=\"{0}\" class={1}>{2}</a> ", curUrl, q.ID == WS.RequestNullInt32("i") ? "select" : "", q.Name);
                }
                str_Industry = sb.ToS();
                LoadSearchPars();
            }
        }
示例#24
0
        /// <summary>
        /// 获取小说分类新闻
        /// </summary>
        /// <param name="ClassID">分类ID</param>
        /// <param name="Top">所取条数</param>
        /// <returns></returns>
        public static string getclassnews(string ClassID, string Top)
        {
            List <Book>   qs = BookView.GetModelList(string.Format("ClassID in(select id from Class where ID={0} union select id from Class where ParentID={0}) order by clickcount desc", ClassID), Top.ToInt32(12));
            StringBuilder sb = new StringBuilder();

            for (int i = 0; i < qs.Count; i++)
            {
                if (i == 0)
                {
                    sb.AppendLine(string.Format("<ul class=\"picList\"><li><a href=\"{0}\" title=\"{1}\" class=\"ablum\"><img src=\"{3}\" alt=\"{1}\" width=\"120\" height=\"160\" /></a><div class=\"text\"><h2 class=\"h22\"><a href=\"{0}\" title=\"{1}\" target=\"_blank\">《{1}》</a></h2><p>{2}</p></div></li>",
                                                BasePage.GetBookUrl(qs[i], BookView.GetClass(qs[i])),
                                                qs[i].Title,
                                                qs[i].Intro.CutString(150),
                                                qs[i].FaceImage.IsNull("/Book/Bookface/0.jpg")
                                                ));
                }
                else if (i == 1)
                {
                    sb.AppendLine(string.Format("<li><a href=\"{0}\" title=\"{1}\" class=\"ablum\"><img src=\"{3}\" alt=\"{1}\" width=\"120\" height=\"160\" /></a><div class=\"text\"><h2 class=\"h22\"><a href=\"{0}\" title=\"{1}\" target=\"_blank\">《{1}》</a></h2><p>{2}</p></div></li></ul>",
                                                BasePage.GetBookUrl(qs[i], BookView.GetClass(qs[i])),
                                                qs[i].Title,
                                                qs[i].Intro.CutString(150),
                                                qs[i].FaceImage.IsNull("/Book/Bookface/0.jpg")
                                                ));
                }
                else if (i == 2)
                {
                    sb.AppendLine(string.Format("<ul class=\"newsList\"><li><a target=\"_blank\" title=\"{1}\" href=\"{0}\">{1}:{2}</a></li>",
                                                BasePage.GetBookUrl(qs[i], BookView.GetClass(qs[i])),
                                                qs[i].Title,
                                                qs[i].Intro.CutString(25)
                                                ));
                }
                else
                {
                    sb.AppendLine(string.Format("<li><a target=\"_blank\" title=\"{1}\" href=\"{0}\">{1}:{2}</a></li>",
                                                BasePage.GetBookUrl(qs[i], BookView.GetClass(qs[i])),
                                                qs[i].Title,
                                                qs[i].Intro.CutString(25)
                                                ));
                }
            }//end for
            sb.AppendLine("</ul>");
            return(sb.ToS());
        }
示例#25
0
        /// <summary>
        /// Load Book Info
        /// </summary>
        protected void LoadInfo()
        {
            #region 数据绑定

            var classes = NewsAction.NewsClass.Where(p => p.ModelID == 4 && p.IsLeafClass == true);
            ddl_CLass.DataSource     = classes;
            ddl_CLass.DataTextField  = "ClassName";
            ddl_CLass.DataValueField = "id";
            ddl_CLass.DataBind();

            if (cls > 0)
            {
                ddl_CLass.SelectedValue = cls.ToS();
            }

            var book = BookView.GetModelByID(id.ToS());
            if (book.ID > 0)
            {
                txt_Title.Text           = book.Title;
                txt_Author.Text          = book.Author;
                ddl_Status.SelectedValue = book.Status.ToS();
                txt_Intro.Text           = book.Intro;
                txt_Length.Text          = book.Length.ToS();
                txt_ClickCount.Text      = book.ClickCount.ToS();
                txt_SaveCount.Text       = book.SaveCount.ToS();
                txt_Replycount.Text      = book.ReplyCount.ToS();
                txt_TjCount.Text         = book.TjCount.ToS();
                chk_IsVip.Checked        = book.IsVip;
                chk_IsFirstpost.Checked  = book.IsFirstPost;
                chk_Enable.Checked       = book.Enable;
                img_Bookface.ImageUrl    = book.FaceImage;

                List <BookRole> roles = BookRoleView.GetModelList(string.Format("BookID={0}", book.ID.ToS()));
                StringBuilder   sb    = new StringBuilder();

                foreach (var role in roles)
                {
                    sb.AppendLine(role.RoleName);
                }
                txt_BookRole.Text = sb.ToS();
            }


            #endregion
        }
示例#26
0
        /// <summary>
        /// DataTable转换为XML
        /// </summary>
        /// <param name="dt">要进行转换的DataTable</param>
        /// <returns>返回XML源文件</returns>
        public static string DataTableToXML(DataTable dt)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("<" + dt.TableName + ">");
            foreach (DataRow row in dt.Rows)
            {
                sb.Append("<item>");
                for (int i = 0; i < dt.Columns.Count; i++)
                {
                    sb.Append("<" + dt.Columns[i].ColumnName + ">" + row[i].ToString() + "</" + dt.Columns[i].ColumnName + ">");
                }
                sb.Append("</item>");
            }
            sb.Append("</" + dt.TableName + ">");

            return(sb.ToS());
        }
示例#27
0
        /// <summary>
        /// 获取年代列表
        /// </summary>
        /// <param name="m_where"></param>
        /// <param name="top"></param>
        /// <param name="templatestring"></param>
        /// <returns></returns>
        public static string getyearlist(string cutstring, string m_where, string top, string templatestring)
        {
            StringBuilder sb = new StringBuilder();

            var movies = MovieInfoView.GetModelList(m_where);

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

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

            return(sb.ToS());
        }
示例#28
0
        protected void MovieClickCount(int id)
        {
            StringBuilder sb        = new StringBuilder();
            string        now       = DateTime.UtcNow.AddHours(8).ToString("yyyy-MM-dd HH:mm:ss");
            string        yesterday = DateTime.UtcNow.AddHours(8).AddDays(-1).ToString("yyyy-MM-dd 23:59:59");
            string        lastweek  = DateTime.UtcNow.AddHours(8).LastWeekLastDay().ToString("yyyy-MM-dd 23:59:59");
            string        lastMonth = DateTime.UtcNow.AddHours(8).LastMonthLastDay().ToString("yyyy-MM-dd 23:59:59");

            sb.AppendLine(string.Format("update MovieInfo set DayClick=0 where LastClickTime<='{0}'", yesterday));
            sb.AppendLine(string.Format("update MovieInfo set WeekClick=0 where LastClickTime<='{0}'", lastweek));
            sb.AppendLine(string.Format("update MovieInfo set MonthClick=0 where LastClickTime<='{0}'", lastMonth));
            sb.AppendLine(string.Format("update MovieInfo set LastClickTime='{0}'", now));
            sb.AppendLine(string.Format("update MovieInfo set ClickCount=ClickCount+1,MonthClick=MonthClick+1,WeekClick=WeekClick+1,DayClick=DayClick+1,LastClickTime='{0}' where id={1}",
                                        now,
                                        id
                                        ));
            DataBase.GetHelper().ExecuteNonQuery(CommandType.Text, sb.ToS());
        }
示例#29
0
        protected string GetUserGroupString()
        {
            DataEntities ent = new DataEntities();

            List <UserGroup> gs = (from l in ent.UserGroup select l).ToList();

            ent.Dispose();
            gs = gs.Where(p => p.EnableReg == true).ToList();

            StringBuilder sb = new StringBuilder();

            sb.Append("<tr>");
            foreach (var g in gs)
            {
                sb.AppendLine("<td style='color:#000;width:100px'><input type=\"radio\" name=\"group\" id=\"" + g.ID + "\" value=\"" + g.ID + "\" /><label for=\"" + g.ID + "\">" + g.GroupName + "</label></td>");
            }
            sb.Append("</tr>");
            return(sb.ToS());
        }
示例#30
0
        public static string GetPostEdu(this JobPost post)
        {
            StringBuilder sb = new StringBuilder();

            try
            {
                var list = (List <JobPostEduAndEmployeeCount>)Voodoo.IO.XML.DeSerialize(typeof(List <JobPostEduAndEmployeeCount>), post.Ext1);
                foreach (var j in list.Where(p => p.Checked == true))
                {
                    sb.AppendFormat("{0}/", j.Text);
                }
                sb = sb.TrimEnd('/');
            }
            catch
            {
                sb.Append("未知");
            }
            return(sb.ToS());
        }
示例#31
0
        /// <summary>
        /// 获取经验下拉列表
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        public string GetExpItems(int?value)
        {
            Dictionary <int, string> dic = new Dictionary <int, string>();

            dic.Add(0, "实习");
            dic.Add(1, "应届");
            StringBuilder sb = new StringBuilder();

            exp = null;
            newUrl();
            sb.AppendFormat("<option value=\"{0}\" {1}>{2}</option>", curUrl, WS.RequestNullInt32("ex") == null ? "selected='selected'" : "", "工作性质");
            foreach (var item in dic)
            {
                exp = item.Key;
                newUrl();
                sb.AppendFormat("<option value=\"{0}\" {1}>{2}</option>", curUrl, item.Key == value ? "selected='selected'" : "", item.Value);
            }
            return(sb.ToS());
        }
示例#32
0
        protected void CreateTxt(int Bookid)
        {
            Book  b   = BookView.GetModelByID(Bookid.ToS());
            Class cls = BookView.GetClass(b);
            var   cs  = BookChapterView.GetModelList(string.Format("bookid={0} order by ChapterIndex,id", b.ID));

            StringBuilder sb = new StringBuilder();

            foreach (var c in cs)
            {
                sb.AppendLine(c.Title);
                sb.AppendLine(Voodoo.IO.File.Read(Server.MapPath(BasePage.GetBookChapterTxtUrl(c, cls)), Voodoo.IO.File.EnCode.UTF8).TrimHTML());
            }

            HttpContext.Current.Response.ContentType = "application/text";
            HttpContext.Current.Response.AddHeader("Content-Disposition", string.Format("attachment;filename={0}.txt", b.Title));
            HttpContext.Current.Response.Clear();
            HttpContext.Current.Response.BinaryWrite(sb.ToS().ToByteArray(Encoding.UTF8));
            HttpContext.Current.Response.End();
        }
示例#33
0
        /// <summary>
        /// 绑定ENUM项
        /// </summary>
        /// <param name="val"></param>
        /// <param name="value"></param>
        /// <returns></returns>
        private string bindItems(Dictionary <int, string> val, int?value, string parName)
        {
            StringBuilder sb = new StringBuilder();

            page = 1;
            foreach (var item in val)
            {
                switch (parName)
                {
                case "s":
                    salary = item.Key;
                    break;

                case "t":
                    updatetime = item.Key;
                    break;

                case "e":
                    edu = item.Key;
                    break;

                case "i":
                    industry = item.Key;
                    break;

                case "p":
                    province = item.Key;
                    break;

                case "c":
                    city = item.Key;
                    break;
                }

                newUrl();
                sb.AppendFormat("<a href=\"{0}\" class={1}>{2}</a> ", curUrl, item.Key == value ? "select" : "", item.Value);
            }
            LoadSearchPars();
            return(sb.ToS());
        }
示例#34
0
        protected void CreateTxt(int Bookid)
        {
            DataEntities ent = new DataEntities();

            Book b = (from l in ent.Book where l.ID == Bookid select l).FirstOrDefault();
            Class cls = b.GetClass();
            var cs = (from l in ent.BookChapter where l.BookID == Bookid orderby l.ChapterIndex orderby l.ID select l).ToList();
            ent.Dispose();

            StringBuilder sb = new StringBuilder();
            sb.AppendLine(string.Format("《{0}》\n 作者:{1} \n 更多精彩小说,请访问{2}\n\n\n\n\n", b.Title, b.Author, BasePage.SystemSetting.SiteName));

            foreach (var c in cs)
            {
                sb.AppendLine(c.Title);
                sb.AppendLine(Voodoo.IO.File.Read(Server.MapPath(BasePage.GetBookChapterTxtUrl(c, cls)), Voodoo.IO.File.EnCode.UTF8).TrimHTML());
            }

            HttpContext.Current.Response.ContentType = "application/text";
            HttpContext.Current.Response.AddHeader("Content-Disposition", string.Format("attachment;filename={0}.txt", b.Title));
            HttpContext.Current.Response.Clear();
            HttpContext.Current.Response.BinaryWrite(sb.ToS().ToByteArray(Encoding.UTF8));
            HttpContext.Current.Response.End();
        }
示例#35
0
        /// <summary>
        /// 获取JOB系统 首页右侧的城市列表
        /// </summary>
        /// <param name="linkTemp"></param>
        /// <returns></returns>
        public static string GetIndexCitys(string linkTemp)
        {
            StringBuilder sb = new StringBuilder();
            using (DataEntities ent = new DataEntities())
            {
                var cts = (from l in ent.City orderby l.Hot descending select l).AsCache().Take(5);
                int i = 0;
                foreach (var ct in cts)
                {
                    if (i % 5 == 0)
                    {
                        sb.AppendLine("<tr><td><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" height=\"22\"><tr>");
                    }
                    i++;
                    string tmp = linkTemp.Replace("{city1}", ct.city1).Replace("市", "");
                    tmp = tmp.Replace("{id}", ct.id.ToS());

                    string item = string.Format("<td width=\"16%\" align=\"center\">{0}</td>", tmp);
                    sb.AppendLine(item);
                    if (i == cts.Count())
                    {
                        for (int j = 0; j < cts.Count() % 5; j++)
                        {
                            sb.AppendLine("<td width=\"16%\" align=\"center\">&nbsp;</td>");
                        }
                        sb.AppendLine("</tr></table></td></tr>");
                    }
                    if (i % 5 == 0)
                    {
                        sb.AppendLine("</tr></table></td></tr>");
                    }

                }
            }

            return sb.ToS();
        }
示例#36
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();
        }
示例#37
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();
            }
        }
示例#38
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();
        }
示例#39
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();
        }
示例#40
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();
        }
示例#41
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();
            }
        }
示例#42
0
        /// <summary>
        /// 获取最新更新的书籍
        /// </summary>
        /// <param name="top"></param>
        /// <returns></returns>
        public string getnoveltopupdate(string top)
        {
            DataEntities ent = new DataEntities();
            int i_top = top.ToInt32();
            List<Book> bs = (from l in ent.Book where l.Enable == true && l.LastChapterID>0 orderby l.UpdateTime descending select l).Take(i_top).ToList();
            StringBuilder sb = new StringBuilder();

            //foreach (Book b in bs)
            for (int i = 0; i < bs.Count; i++)
            {
                Book b = bs[i];
                Class c = b.GetClass();
                string str_style = "";
                if (i % 2 == 0)
                {
                    str_style = " style=\"background-color: #f5f5f5\"";
                }

                sb.AppendLine(string.Format("<tr" + str_style + "><td>[<a target=\"_blank\" href=\"{0}\" class=\"sort\">{1}</a>]</td><td><a class=\"name\" target=\"_blank\" href=\"{2}\">{3}</a> <a target=\"_blank\" href=\"{4}\" class=\"chapter\">{5}</a></td><td><a target=\"_blank\" href=\"/Search.aspx?m=4&key={6}\" class=\"author\">{6}</a></td><td style=\"color: #666666\">{7}</td></tr>",
                    BasePage.GetClassUrl(c),
                    b.ClassName,
                    BasePage.GetBookUrl(b, c),
                    b.Title,
                     BasePage.GetBookChapterUrl(ObjectExtents.Chapter(b.LastChapterID), c),
                    b.LastChapterTitle,
                    b.Author,
                    b.UpdateTime.ToDateTime().ToString("MM-dd HH:mm")
                    ));
            }
            ent.Dispose();
            return sb.ToS();
        }
示例#43
0
 /// <summary>
 /// 获取所有子栏目
 /// </summary>
 /// <param name="ClassID"></param>
 /// <returns></returns>
 protected string GetAllSubClass(int ClassID)
 {
     var cls = ClassAction.Classes.Where(p => p.ParentID == ClassID);
     StringBuilder sb = new StringBuilder();
     foreach (var c in cls)
     {
         sb.Append(c.ID + ",");
     }
     sb.Append(ClassID);
     return sb.ToS();
 }
示例#44
0
        /// <summary>
        /// 获取最新更新的书籍 Metro风格
        /// </summary>
        /// <param name="top"></param>
        /// <returns></returns>
        public string getnoveltopmetroupdate(string top)
        {
            DataEntities ent = new DataEntities();

            int i_top = top.ToInt32();
            List<Book> bs = //BookView.GetModelList("Enable=1 order by UpdateTime desc", i_top);
                (from l in ent.Book where l.Enable == true orderby l.UpdateTime descending select l).Take(i_top).ToList();
            StringBuilder sb = new StringBuilder();
            int i = 1;
            foreach (Book b in bs)
            {
                Class c = b.GetClass();
                sb.AppendLine(string.Format("<li style=\" background-color:{0};\"><div class=\"item\"><h1><a href=\"{1}\">" + i + ".{2}</a></h1><div><div class=\"lastchapter\"><a href=\"{5}\">{6}</a></div></div></div><div class=\"item\"><h1><a href=\"{1}\">阅读书籍</a></h1><div><div class=\"lastchapter\"><a href=\"{5}\" title=\"{6}\">阅读最新章节</a></div><div class=\"class\">分类:<a href=\"{3}\">{4}</a></div><div class=\"author\">作者:{8}</div><div class=\"time\">更新时间:{9}</div></div></div></li>",
                    BasePage.RandomBGColor(),
                    BasePage.GetBookUrl(b, c),
                    b.Title,
                    BasePage.GetClassUrl(c),
                    b.ClassName,
                    BasePage.GetBookChapterUrl(ObjectExtents.Chapter(b.LastChapterID), c),
                    b.LastChapterTitle,
                    b.LastChapterTitle.CutString(12),
                    b.Author,
                    b.UpdateTime.ToDateTime().ToString("MM-dd HH:mm")
                    ));
                i++;
            }
            ent.Dispose();

            return sb.ToS();
        }
示例#45
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();
        }
示例#46
0
 /// <summary>
 /// 获取小说栏目列表
 /// </summary>
 /// <param name="str"></param>
 /// <returns></returns>
 public string getallnovelclass(string str)
 {
     List<Class> cls = ClassAction.Classes.Where(p => p.ModelID == 4).ToList();
     StringBuilder sb = new StringBuilder();
     foreach (Class c in cls)
     {
         sb.Append(string.Format("<a href=\"{0}\">{1}</a> ", BasePage.GetClassUrl(c), c.ClassName));
     }
     return sb.ToS();
 }
示例#47
0
        /// <summary>
        /// 获取JOB系统 首页下面的行业列表
        /// </summary>
        /// <returns></returns>
        public static string GetIndexIndustrys(string nn)
        {
            StringBuilder sb = new StringBuilder();

            using (DataEntities ent = new DataEntities())
            {
                var qs = (from l in ent.JobIndustry where l.IsLeaf == false select l).AsCache();

                var parents = qs.Where(p => p.ParentID == 0);
                foreach (var p in parents)
                {
                    sb.Append("<li>");
                    sb.Append(string.Format("<b>{0}</b>:", p.Name));
                    var subs = qs.Where(o => o.ParentID == p.ID);
                    foreach (var s in subs)
                    {
                        sb.AppendFormat("<a target=\"_blank\" href=\"{0}\">{1}</a>", s.ID, s.Name);
                    }

                    sb.Append("</li>");
                }
            }

            return sb.ToS();
        }
示例#48
0
        /// <summary>
        /// 根据类别获取书籍排行
        /// </summary>
        /// <param name="top"></param>
        /// <param name="custitle"></param>
        /// <param name="cls"></param>
        /// <param name="htmlTemp"></param>
        /// <returns></returns>
        public static string gettopbookbyclass(string top,string custitle, string cls, string htmlTemp)
        {
            int i_top = top.ToInt32();
            int cid = cls.ToInt32();

             StringBuilder sb = new StringBuilder();
             using (DataEntities ent = new DataEntities())
             {
                 var list = (from l in ent.Book
                            from c in ent.Class
                            where
                            (l.ClassID == cid && c.ID == cid) ||
                            (l.ClassID == c.ID && c.ParentID == cid)
                            orderby l.ClickCount descending
                            select l).Take(i_top);
                 if (cid < 0)
                 {
                     list = (from l in ent.Book orderby l.ClickCount descending select l).Take(i_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();
             }
        }
示例#49
0
        /// <summary>
        /// 获取首页专业树
        /// </summary>
        /// <param name="s"></param>
        /// <returns></returns>
        public static string getindexSpelist(string s)
        {
            StringBuilder sb = new StringBuilder();
            DataEntities ent = new DataEntities();
            var list = (from l in ent.JobEduSpecialty select l).AsCache();

            var parents = from l in list
                          from t in list
                          where l.ParentID == t.ID
                          && t.ParentID == 0
                          select l;
            foreach (var p in parents)
            {
                sb.AppendFormat("<li><b>{0}</b>:", p.Name);
                var subs = from l in list where l.ParentID == p.ID select l;
                foreach (var sub in subs)
                {
                    sb.AppendFormat("<a target=\"_blank\" href=\"Search.aspx?sp={0}\">{1}</a>", sub.ID, sub.Name);
                }

                sb.Append("</li>");
            }

            return sb.ToS();

            ent.Dispose();
        }
示例#50
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();
        }
示例#51
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();
     }
 }
示例#52
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();
        }
示例#53
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();
        }
示例#54
0
        /// <summary>
        /// 获取小说分类新闻
        /// </summary>
        /// <param name="ClassID">分类ID</param>
        /// <param name="Top">所取条数</param>
        /// <returns></returns>
        public static string getclassnews(string ClassID, string Top)
        {
            DataEntities ent = new DataEntities();

            int int_cls = ClassID.ToInt32();
            List<Book> qs = (from l in ent.Book
                             from cp in ent.Class
                             from cl in ent.Class
                             where cp.ID == int_cls && cl.ParentID == cp.ID && (l.ClassID == cp.ID || l.ClassID == cl.ID)
                             select l
                ).Take(Top.ToInt32()).ToList();
            ent.Dispose();

            StringBuilder sb = new StringBuilder();
            for (int i = 0; i < qs.Count; i++)
            {
                if (i == 0)
                {
                    sb.AppendLine(string.Format("<ul class=\"picList\"><li><a href=\"{0}\" title=\"{1}\" class=\"ablum\"><img src=\"{3}\" alt=\"{1}\" width=\"120\" height=\"160\" /></a><div class=\"text\"><h2 class=\"h22\"><a href=\"{0}\" title=\"{1}\" target=\"_blank\">《{1}》</a></h2><p>{2}</p></div></li>",
                        BasePage.GetBookUrl(qs[i], qs[i].GetClass()),
                        qs[i].Title,
                        qs[i].Intro.TrimHTML().CutString(150),
                        qs[i].FaceImage.IsNull("/Book/Bookface/0.jpg")
                        ));
                }
                else if (i == 1)
                {
                    sb.AppendLine(string.Format("<li><a href=\"{0}\" title=\"{1}\" class=\"ablum\"><img src=\"{3}\" alt=\"{1}\" width=\"120\" height=\"160\" /></a><div class=\"text\"><h2 class=\"h22\"><a href=\"{0}\" title=\"{1}\" target=\"_blank\">《{1}》</a></h2><p>{2}</p></div></li></ul>",
                        BasePage.GetBookUrl(qs[i], qs[i].GetClass()),
                        qs[i].Title,
                        qs[i].Intro.TrimHTML().CutString(150),
                        qs[i].FaceImage.IsNull("/Book/Bookface/0.jpg")
                        ));
                }
                else if (i == 2)
                {
                    sb.AppendLine(string.Format("<ul class=\"newsList\"><li><a target=\"_blank\" title=\"{1}\" href=\"{0}\">{1}:{2}</a></li>",
                        BasePage.GetBookUrl(qs[i], qs[i].GetClass()),
                        qs[i].Title,
                        qs[i].Intro.TrimHTML().CutString(25)
                        ));
                }
                else
                {
                    sb.AppendLine(string.Format("<li><a target=\"_blank\" title=\"{1}\" href=\"{0}\">{1}:{2}</a></li>",
                        BasePage.GetBookUrl(qs[i], qs[i].GetClass()),
                        qs[i].Title,
                        qs[i].Intro.TrimHTML().CutString(25)
                        ));
                }

            }//end for
            sb.AppendLine("</ul>");
            return sb.ToS();
        }
示例#55
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();
        }
示例#56
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();
            }
        }
示例#57
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();
        }
示例#58
0
        /// <summary>
        /// 首页底部地区树
        /// </summary>
        /// <param name="ss"></param>
        /// <returns></returns>
        public static string getindexbottomareas(string ss)
        {
            StringBuilder sb = new StringBuilder();
            DataEntities ent = new DataEntities();
            var areas = (from l in ent.Area where l.ShowInIndex == true select l).ToList();
            var ps = (from l in ent.Province where l.ShowInIndex == true select l).ToList();
            var cs = (from l in ent.City where l.ShowInIndex == true select l).ToList();

            ent.Dispose();

            foreach (var area in areas)
            {
                sb.AppendLine("<li>");
                sb.AppendFormat("<span class=\"fl\"><b>{0}:</b></span>", area.Name);

                var subps = from l in ps where l.AreaID == area.ID select l;
                foreach (var subp in subps)
                {
                    sb.AppendFormat("<a href=\"Search.aspx?l={0}\" target=\"_blank\">{0}</a>", subp.province1);

                    var subcs = from l in cs where l.ProvinceID == subp.ID select l;
                    if (subcs.Count() > 0)
                    {
                        sb.Append("(");
                    }
                    foreach (var subc in subcs)
                    {
                        sb.AppendFormat("<a href=\"Search.aspx?l={0}\" target=\"_blank\">{0}</a>", subc.city1);
                    }
                    if (subcs.Count() > 0)
                    {
                        sb.Append(")");
                    }
                }

                sb.AppendLine("</li>");
            }
            return sb.ToS();
        }
示例#59
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();
        }
示例#60
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 "未知模型";
            }
        }