当前位置: 首页>>代码示例>>C#>>正文


C# StringBuilder.ToS方法代码示例

本文整理汇总了C#中StringBuilder.ToS方法的典型用法代码示例。如果您正苦于以下问题:C# StringBuilder.ToS方法的具体用法?C# StringBuilder.ToS怎么用?C# StringBuilder.ToS使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在StringBuilder的用法示例。


在下文中一共展示了StringBuilder.ToS方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ToMD5

 /// <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();
 }
开发者ID:taccisum,项目名称:ExerciseSpace,代码行数:18,代码来源:String.cs

示例2: booklist

        /// <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();
        }
开发者ID:svn2github,项目名称:KCMS2,代码行数:58,代码来源:Functions.cs

示例3: GetUserGroupString

        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();
        }
开发者ID:kuibono,项目名称:KCMS2,代码行数:17,代码来源:ChangeRegister.aspx.cs

示例4: CreateTxt

        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();
        }
开发者ID:kuibono,项目名称:KCMS2,代码行数:24,代码来源:BookDown.aspx.cs

示例5: getmovielist

        /// <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();
        }
开发者ID:svn2github,项目名称:KCMS2,代码行数:48,代码来源:Functions.cs

示例6: getjobapplicationlist

 /// <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();
     }
 }
开发者ID:svn2github,项目名称:KCMS2,代码行数:58,代码来源:Functions.cs

示例7: getindexSpelist

        /// <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();
        }
开发者ID:svn2github,项目名称:KCMS2,代码行数:32,代码来源:Functions.cs

示例8: GetIndexCitys

        /// <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();
        }
开发者ID:svn2github,项目名称:KCMS2,代码行数:42,代码来源:Functions.cs

示例9: getcompanylist

        /// <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();
            }
        }
开发者ID:svn2github,项目名称:KCMS2,代码行数:38,代码来源:Functions.cs

示例10: getclasslist

        /// <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();
        }
开发者ID:svn2github,项目名称:KCMS2,代码行数:32,代码来源:Functions.cs

示例11: cmsnewslist

        /// <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 "未知模型";
            }
        }
开发者ID:svn2github,项目名称:KCMS2,代码行数:81,代码来源:Functions.cs

示例12: gettopbookbyclass

        /// <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();
             }
        }
开发者ID:svn2github,项目名称:KCMS2,代码行数:69,代码来源:Functions.cs

示例13: Getsearchkey

        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();
        }
开发者ID:svn2github,项目名称:KCMS2,代码行数:17,代码来源:Functions.cs

示例14: getsearchkey

        /// <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();
        }
开发者ID:svn2github,项目名称:KCMS2,代码行数:20,代码来源:Functions.cs

示例15: getpostlistkip

        /// <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();
            }
        }
开发者ID:svn2github,项目名称:KCMS2,代码行数:48,代码来源:Functions.cs


注:本文中的StringBuilder.ToS方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。