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

            tl.VarName = txt_VarName.Text;
            tl.Content = txt_Content.Text.Replace("'", "''");

            if (tl.ID==null||tl.ID <= 0)
            {
                ent.AddToTemplateVar(tl);
            }
            ent.SaveChanges();

            var pages = (from l in ent.TemplatePage where l.CreateWith == 5 select l).ToList();
            TemplateHelper th = new TemplateHelper();
            foreach (var p in pages)
            {
                try
                {
                    string html = th.GetStatisPage(p.id);
                    Voodoo.IO.File.Write(Server.MapPath(p.FileName), html);
                }
                catch { }
            }

            ent.Dispose();
            Js.AlertAndChangUrl("保存成功!", "VarTemplateList.aspx");
        }
예제 #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     TemplateHelper th = new TemplateHelper();
     int page = WS.RequestInt("p", 1);
     string key = WS.RequestString("key");
     Response.Clear();
     Response.Write(th.GetSearchResult(4, page, key));
 }
예제 #3
0
파일: Book.aspx.cs 프로젝트: kuibono/KCMS2
        protected void Page_Load(object sender, EventArgs e)
        {
            DataEntities ent=new DataEntities();
            int id=WS.RequestInt("id");
            string title = WS.RequestString("title");
            string author = WS.RequestString("author");

            var b=(from l in ent.Book where l.ID==id || (l.Title==title && l.Author==author) select l).FirstOrDefault();

            Response.Clear();
            TemplateHelper th = new TemplateHelper();
            Response.Write(th.CreateContentPage(b,b.GetClass()));
        }
예제 #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            using (DataEntities ent = new DataEntities())
            {
                int id = WS.RequestInt("id");

                Voodoo.Basement.Product p = (from l in ent.Product where l.ID == id select l).FirstOrDefault();

                TemplateHelper Helper = new TemplateHelper();
                Response.Clear();
                Response.Write(
                Helper.CreateContentPage(p, p.GetClass()));
            }
        }
예제 #5
0
파일: Class.aspx.cs 프로젝트: kuibono/KCMS2
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                int id = WS.RequestInt("id");
                string name = WS.RequestString("name");
                int page = WS.RequestInt("page", 1);
                var cls = ClassAction.Classes.Where(p => p.ID == id||p.ClassName==name).First();

                TemplateHelper th = new TemplateHelper();
                Response.Clear();
                Response.Write(th.CreateListPage(cls, page));
            }
            catch
            {
                throw new Exception("没有找到这个分类");
            }
        }
예제 #6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     Response.Clear();
     TemplateHelper th = new TemplateHelper();
     Response.Write(th.GetIndex(TemplateHelper.TempType.新闻首页));
 }
예제 #7
0
        /// <summary>
        /// 获取列表页面的页数
        /// </summary>
        /// <param name="id"></param>
        protected void GetClassPageCount(int id)
        {
            DataEntities ent = new DataEntities();

            Class c = ClassAction.Classes.Where(p => p.ID == id).FirstOrDefault();

            TemplateHelper h = new TemplateHelper();

            TemplateList t = h.GetListTemplate(c);

            int pagecount = 0;
            switch (c.ModelID)
            {
                case 1:
                    //新闻
                    pagecount = //NewsView.Count(string.Format("classid in(select {0} union select id from Class where parentID={0})", id)).GetPageCount(t.ShowRecordCount);
                       (from p in ent.Class
                        from cls in ent.Class
                        from l in ent.News
                        where p.ID == id && cls.ParentID == id &&
                        (l.ClassID == p.ID || l.ClassID == cls.ID)
                        select l).Count().GetPageCount(t.ShowRecordCount.ToInt32());
                    break;
                case 2:
                    //图片
                    pagecount =
                        (from p in ent.Class
                         from cls in ent.Class
                         from l in ent.ImageAlbum
                         where p.ID == id && cls.ParentID == id &&
                         (l.ClassID == p.ID || l.ClassID == cls.ID)
                         select l).Count().GetPageCount(t.ShowRecordCount.ToInt32());
                    break;
                case 3:
                    //问答
                    pagecount =
                        (from p in ent.Class
                         from cls in ent.Class
                         from l in ent.Question
                         where p.ID == id && cls.ParentID == id &&
                         (l.ClassID == p.ID || l.ClassID == cls.ID)
                         select l).Count().GetPageCount(t.ShowRecordCount.ToInt32());
                    break;
                case 4:
                    //小说
                    pagecount =
                        (from p in ent.Class
                         from cls in ent.Class
                         from l in ent.Book
                         where p.ID == id && cls.ParentID == id &&
                         (l.ClassID == p.ID || l.ClassID == cls.ID)
                         select l).Count().GetPageCount(t.ShowRecordCount.ToInt32());
                    break;
                case 5:
                    //分类
                    pagecount =
                        (from p in ent.Class
                         from cls in ent.Class
                         from l in ent.Info
                         where p.ID == id && cls.ParentID == id &&
                         (l.ClassID == p.ID || l.ClassID == cls.ID)
                         select l).Count().GetPageCount(t.ShowRecordCount.ToInt32());
                    break;
                case 6:
                    //影视
                    pagecount =
                        (from p in ent.Class
                         from cls in ent.Class
                         from l in ent.MovieInfo
                         where p.ID == id && cls.ParentID == id &&
                         (l.ClassID == p.ID || l.ClassID == cls.ID)
                         select l).Count().GetPageCount(t.ShowRecordCount.ToInt32());
                    break;
                default:
                    pagecount = 0;
                    break;
            }
            ent.Dispose();
            Response.Clear();
            Response.Write(pagecount);
        }
예제 #8
0
 protected void Index()
 {
     TemplateHelper Helper = new TemplateHelper();
     Response.Clear();
     Response.Write(Helper.GetIndex());
 }