Example #1
0
        protected void btn_Save_Click(object sender, EventArgs e)
        {
            int id = WS.RequestInt("id");
            DataEntities ent = new DataEntities();
            TemplateList tl ;
            try
            {
                tl = (from l in ent.TemplateList where l.ID == id select l).First();
            }
            catch
            {
                tl = new TemplateList();
            }

            tl.TempName = txt_TempName.Text;
            tl.CutKeywords = txt_CutKeywords.Text.ToInt32();
            tl.CutTitle = txt_CutTitle.Text.ToInt32();
            tl.ShowRecordCount = txt_ShowRecordCount.Text.ToInt32();
            tl.TimeFormat = txt_TimeFormat.Text;
            tl.Content = txt_Content.Text.Replace("'", "''"); ;
            tl.ListVar = txt_Listvar.Text.Replace("'", "''"); ;
            tl.SysModel = ddl_SysModel.SelectedValue.ToInt32();
            if (tl.ID <= 0)
            {
                tl.GroupID = 1;
                tl.SysModel = 1;
                ent.AddToTemplateList(tl);
            }
            ent.SaveChanges();
            ent.Dispose();
            Js.AlertAndGoback("保存成功!");
        }
Example #2
0
 /// <summary>
 /// 替换影视
 /// </summary>
 /// <param name="temp"></param>
 /// <param name="TempString"></param>
 /// <param name="m"></param>
 /// <param name="c"></param>
 /// <returns></returns>
 public string ReplaceContent(TemplateList temp, string TempString, MovieInfo m, Class c)
 {
     string str_lst = temp.ListVar;
     str_lst = str_lst.Replace("[!--movie.url--]", BasePage.GetMovieUrl(m, m.GetClass()));
     str_lst = str_lst.Replace("[!--movie.actors--]", m.Actors);
     str_lst = str_lst.Replace("[!--movie.classid--]", m.ClassID.ToS());
     str_lst = str_lst.Replace("[!--movie.classname--]", m.ClassName);
     str_lst = str_lst.Replace("[!--movie.director--]", m.Director);
     str_lst = str_lst.Replace("[!--movie.enable--]", m.Enable.ToInt32().ToS());
     str_lst = str_lst.Replace("[!--movie.faceimage--]", m.FaceImage);
     str_lst = str_lst.Replace("[!--movie.id--]", m.id.ToS());
     str_lst = str_lst.Replace("[!--movie.inserttime--]", m.InsertTime.ToDateTime().ToString(temp.TimeFormat));
     str_lst = str_lst.Replace("[!--movie.intro--]", m.Intro.TrimHTML());
     str_lst = str_lst.Replace("[!--movie.ismove--]", m.IsMove.ToInt32().ToS());
     str_lst = str_lst.Replace("[!--movie.lastdramatitle--]", m.LastDramaTitle);
     str_lst = str_lst.Replace("[!--movie.location--]", m.Location);
     str_lst = str_lst.Replace("[!--movie.publicyear--]", m.PublicYear);
     str_lst = str_lst.Replace("[!--movie.status--]", m.Status.ToS());
     str_lst = str_lst.Replace("[!--movie.tags--]", m.Tags);
     str_lst = str_lst.Replace("[!--movie.title--]", m.Title);
     str_lst = str_lst.Replace("[!--movie.updatetimetime--]", m.UpdateTime.ToDateTime().ToString(temp.TimeFormat));
     return str_lst;
 }
Example #3
0
        /// <summary>
        /// 替换小说
        /// </summary>
        /// <param name="TempString"></param>
        /// <param name="q"></param>
        /// <param name="c"></param>
        /// <returns></returns>
        public string ReplaceContent(TemplateList temp, string TempString, Book b, Class c)
        {
            string str_lst = TempString;

            str_lst = str_lst.Replace("[!--class.name--]", c.ClassName);
            str_lst = str_lst.Replace("[!--class.id--]", c.ID.ToS());
            str_lst = str_lst.Replace("[!--class.url--]", BasePage.GetClassUrl(c));

            str_lst = str_lst.Replace("[!--book.url--]", BasePage.GetBookUrl(b, b.GetClass()));//书籍
            str_lst = str_lst.Replace("[!--book.lastchapterurl--]", BasePage.GetBookChapterUrl(ObjectExtents.Chapter(b.LastChapterID), b.GetClass()));//书籍
            str_lst = str_lst.Replace("[!--book.id--]", b.ID.ToString());
            str_lst = str_lst.Replace("[!--book.classid--]", b.ClassID.ToS());
            str_lst = str_lst.Replace("[!--book.classname--]", b.ClassName);
            str_lst = str_lst.Replace("[!--book.ztid--]", b.ZtID.ToS());
            str_lst = str_lst.Replace("[!--book.ztname--]", b.ZtName);
            str_lst = str_lst.Replace("[!--book.title--]", temp.CutTitle > 0 ? b.Title.CutString(temp.CutTitle.ToInt32()) : b.Title);
            str_lst = str_lst.Replace("[!--book.oldtitle--]", b.Title);
            str_lst = str_lst.Replace("[!--book.author--]", b.Author);
            str_lst = str_lst.Replace("[!--book.intro--]", b.Intro.HtmlDeCode());
            str_lst = str_lst.Replace("[!--book.length--]", b.Length.ToS());
            str_lst = str_lst.Replace("[!--book.replycount--]", b.ReplyCount.ToS());
            str_lst = str_lst.Replace("[!--book.addtime--]", b.Addtime.ToDateTime().ToString(temp.TimeFormat));
            str_lst = str_lst.Replace("[!--book.status--]", b.Status.ToS());
            str_lst = str_lst.Replace("[!--book.isvip--]", b.IsVip.ToBoolean().ToChinese());
            str_lst = str_lst.Replace("[!--book.faceimage--]", b.FaceImage);
            str_lst = str_lst.Replace("[!--book.savecount--]", b.SaveCount.ToS());
            str_lst = str_lst.Replace("[!--book.enable--]", b.Enable.ToBoolean().ToChinese());
            str_lst = str_lst.Replace("[!--book.isfirstpost--]", b.IsFirstPost.ToBoolean().ToChinese());
            str_lst = str_lst.Replace("[!--book.lastchapterid--]", b.LastChapterID.ToS());
            str_lst = str_lst.Replace("[!--book.lastchaptertitle--]", b.LastChapterTitle);
            str_lst = str_lst.Replace("[!--book.updatetime--]", b.UpdateTime.ToDateTime().ToString(temp.TimeFormat));
            str_lst = str_lst.Replace("[!--book.lastvipchapterid--]", b.LastVipChapterID.ToS());
            str_lst = str_lst.Replace("[!--book.lastvipchaptertitle--]", b.LastVipChapterTitle);
            str_lst = str_lst.Replace("[!--book.vipupdatetime--]", b.VipUpdateTime.ToDateTime().ToString(temp.TimeFormat));
            str_lst = str_lst.Replace("[!--book.corpusid--]", b.CorpusID.ToS());
            str_lst = str_lst.Replace("[!--book.corpustitle--]", b.CorpusTitle);
            str_lst = str_lst.Replace("[!--book.clickcount--]", b.ClickCount.ToS());
            str_lst = str_lst.Replace("[!--book.tjcount--]", b.TjCount.ToS());
            return str_lst;
        }
Example #4
0
        public string ReplaceContent(TemplateList temp, string TempString, Product p, Class c)
        {
            using (DataEntities ent = new DataEntities())
            {
                string str_lst = TempString;
                str_lst = str_lst.Replace("[!--productaddtime.--]", p.AddTime.ToDateTime().ToString(temp.TimeFormat));
                str_lst = str_lst.Replace("[!--product.classid--]", p.ClassID.ToS());
                str_lst = str_lst.Replace("[!--product.classname--]", p.ClassName);
                str_lst = str_lst.Replace("[!--product.clickcount--]", p.ClickCount.ToS());
                str_lst = str_lst.Replace("[!--product.contact--]", p.Contact);
                str_lst = str_lst.Replace("[!--product.enable--]", p.Enable.ToBoolean().ToChinese());
                str_lst = str_lst.Replace("[!--product.faceimage--]", p.FaceImage);
                str_lst = str_lst.Replace("[!--product.id--]", p.ID.ToS());
                str_lst = str_lst.Replace("[!--product.intro--]", p.Intro);
                str_lst = str_lst.Replace("[!--product.name--]", p.Name);
                str_lst = str_lst.Replace("[!--product.orderindex--]", p.OrderIndex.ToS());
                str_lst = str_lst.Replace("[!--product.price-]", p.Price.ToDecimal().ToString("#.##"));
                str_lst = str_lst.Replace("[!--product.producelocation--]", p.ProduceLocation);
                str_lst = str_lst.Replace("[!--product.settop--]", p.SetTop.ToBoolean().ToChinese());
                str_lst = str_lst.Replace("[!--product.specification--]", p.Specification);
                str_lst = str_lst.Replace("[!--product.tel--]", p.Tel);
                str_lst = str_lst.Replace("[!--product.units--]", p.Units);
                str_lst = str_lst.Replace("[!--product.url--]", BasePage.GetProductUrl(p, c));

                var files = from l in ent.File where l.ItemID == p.ID select l;
                StringBuilder fileHtml=new StringBuilder();;
                foreach (var file in files)
                {
                    string fTemp = string.Format("<a class=upfile href={0} target=_blank>{1}</a> <br/> ",file.FilePath,file.FileName);
                    fileHtml.Append(fTemp);
                }
                str_lst = str_lst.Replace("[!--product.files--]", fileHtml.ToS());

                return str_lst;
            }
        }
Example #5
0
        /// <summary>
        /// 替换问答
        /// </summary>
        /// <param name="TempString"></param>
        /// <param name="n"></param>
        /// <returns></returns>
        public string ReplaceContent(TemplateList temp, string TempString, Question q, Class c)
        {
            using (DataEntities ent = new DataEntities())
            {
                string str_lst = TempString;

                str_lst = str_lst.Replace("[!--question.url--]", BasePage.GetQuestionUrl(q, c));//问题地址
                str_lst = str_lst.Replace("[!--question.asktime--]", q.AskTime.ToDateTime().ToString(temp.TimeFormat));
                str_lst = str_lst.Replace("[!--question.classid--]", q.ClassID.ToS());
                str_lst = str_lst.Replace("[!--question.clickcount--]", q.ClickCount.ToS());
                str_lst = str_lst.Replace("[!--question.content--]", q.Content);
                str_lst = str_lst.Replace("[!--question.id--]", q.ID.ToS());
                str_lst = str_lst.Replace("[!--question.title--]", q.Title);
                str_lst = str_lst.Replace("[!--question.ftitle--]", temp.CutTitle > 0 ? q.Title.CutString(temp.CutTitle.ToInt32()) : q.Title);
                str_lst = str_lst.Replace("[!--question.userid--]", q.UserID.ToS());
                str_lst = str_lst.Replace("[!--question.username--]", q.UserName);
                str_lst = str_lst.Replace("[!--question.ztid--]", q.ZtID.ToS());
                str_lst = str_lst.Replace("[!--question.answercount--]", (from l in ent.Answer where l.QuestionID == q.ID select l).Count().ToS());
                return str_lst;
            }
        }
Example #6
0
        /// <summary>
        /// 替换图片
        /// </summary>
        /// <param name="TempString"></param>
        /// <param name="n"></param>
        /// <param name="c"></param>
        /// <returns></returns>
        public string ReplaceContent(TemplateList temp, string TempString, ImageAlbum n, Class c)
        {
            string r = TempString;

            r = r.Replace("[!--image.author--]", n.Author);
            r = r.Replace("[!--image.authorid--]", n.AuthorID.ToS());
            r = r.Replace("[!--image.classid--]", n.ClassID.ToS());
            r = r.Replace("[!--image.clickcount--]", n.ClickCount.ToS());
            r = r.Replace("[!--image.createtime--]", n.CreateTime.ToDateTime().ToString(temp.TimeFormat));
            r = r.Replace("[!--image.folder--]", n.Folder);
            r = r.Replace("[!--image.id--]", n.ID.ToS());
            r = r.Replace("[!--image.intro--]", n.Intro);
            r = r.Replace("[!--image.replycount--]", n.ReplyCount.ToS());
            r = r.Replace("[!--image.size--]", n.Size.ToS());
            r = r.Replace("[!--image.title--]", n.Title);
            r = r.Replace("[!--image.updatetime--]", n.UpdateTime.ToDateTime().ToString(temp.TimeFormat));
            r = r.Replace("[!--image.ztid--]", n.ZtID.ToS());
            r = r.Replace("[!--image.url--]", BasePage.GetImageUrl(n, c));

            return r;
        }
Example #7
0
        /// <summary>
        /// 替换新闻
        /// </summary>
        /// <param name="TempString"></param>
        /// <param name="n"></param>
        /// <returns></returns>
        public string ReplaceContent(TemplateList temp, string TempString, News n, Class c)
        {
            string _title = "<font color='#" + n.TitleColor + "'>" + n.Title + "</font>";
            if (n.TitleB.ToBoolean() == true)
            {
                _title = "<strong>" + _title + "</strong>";
            }
            if (n.TitleI.ToBoolean() == true)
            {
                _title = "<I>" + _title + "</I>";
            }
            if (n.TitleS.ToBoolean() == true)
            {
                _title = "<STRIKE>" + _title + "</STRIKE>";
            }

            string r = TempString;
            r = r.Replace("[!--news.author--]", n.Author);
            r = r.Replace("[!--news.authorid--]", n.AutorID.ToS());
            r = r.Replace("[!--news.classname--]", c.ClassName);
            r = r.Replace("[!--news.classid--]", n.ClassID.ToS());
            r = r.Replace("[!--news.content--]", n.Content);
            r = r.Replace("[!--news.contenten--]", n.ContentEn);
            r = r.Replace("[!--news.description--]", n.Description);
            r = r.Replace("[!--news.downcount--]", n.DownCount.ToS());
            r = r.Replace("[!--news.filefolder--]", n.FileForder);
            r = r.Replace("[!--news.filename--]", n.FileName);
            r = r.Replace("[!--news.ftile--]", n.FTitle);
            r = r.Replace("[!--news.id--]", n.ID.ToS());
            r = r.Replace("[!--news.keywords--]", n.KeyWords);
            r = r.Replace("[!--news.navurl--]", n.NavUrl);
            r = r.Replace("[!--news.newstime--]", n.NewsTime.ToDateTime().ToString(temp.TimeFormat));
            r = r.Replace("[!--news.source--]", n.Source);
            r = r.Replace("[!--news.title--]", n.Title);
            r = r.Replace("[!--news.oldtitle--]", n.Title);
            r = r.Replace("[!--news.ftitle--]", _title);
            r = r.Replace("[!--news.titlecolor--]", n.TitleColor);
            r = r.Replace("[!--news.titleimage--]", n.TitleImage);
            r = r.Replace("[!--news.ztid--]", n.ZtID.ToS());
            r = r.Replace("[!--news.url--]", BasePage.GetNewsUrl(n, c));

            return r;
        }
Example #8
0
        public string BuidPagerOption(string key, int page)
        {
            DataEntities ent = new DataEntities();

            int recordCount = //BookView.Count(string.Format("Title like '%{0}%' or Author like '%{0}%' or Intro like '%{0}%'", key));
                (from l in ent.Book where l.Title.Contains(key) || l.Author.Contains(key) || l.Intro.Contains(key) select l).Count();
            int tmpid = 0;
            TemplateList temp = new TemplateList();

            temp = GetListTemplate(new Class() { ModelID = 4 });

            int pagecount = (Convert.ToDouble(recordCount) / Convert.ToDouble(20)).YueShu();

            StringBuilder sb = new StringBuilder();
            sb.AppendLine("<select onchange='location.href=this.value'>");
            for (int i = 1; i <= pagecount; i++)
            {
                if (page == i)
                {
                    sb.AppendLine(string.Format("<option value='{0}' selected>{1}</option>", "/Search.aspx?m=4&key=" + key, i));
                }
                else
                {
                    sb.AppendLine(string.Format("<option value='{0}'>{1}</option>", "/Search.aspx?m=4&key=" + key + "&p=" + i, i));
                }
            }
            sb.AppendLine("</select>");
            return sb.ToS();
        }