コード例 #1
0
ファイル: template_edit.aspx.cs プロジェクト: joleye/1.6
        protected void Button1_Click(object sender, EventArgs e)
        {

            
            TemplateInfo info = new TemplateInfo();
            info.title = title.Text.ToString();
            info.filePath = filePath.Text.ToString();
            info.activePath = activePath.Text.ToString();
            info.templatePath = templatePath.Text.ToString();
            info.content = contentDetail.Text.ToString();
            info.typeId = templateid;

            TemplateDal te = new TemplateDal();
            if (app == "edit")
            {
                te.Update(info, getId("id"));
                te.saveFile(info.templatePath, info.content);
                showMessage("修改成功", "templatefile_list.aspx?templateid="+templateid);
            }
            else
            {
                te.add(info);
                te.saveFile(info.templatePath, info.content);
                showMessage("添加成功","templatefile_list.aspx?templateid="+templateid);
            }
            
            
        }
コード例 #2
0
ファイル: TemplateDal.cs プロジェクト: joleye/1.6
 //读取模板内容
 public TemplateInfo read(int id)
 {
     DataSet ds = getData("select * from "+tableName+" where id=" + id);
     DataRow dr = ds.Tables[0].Rows[0];
     TemplateInfo info = new TemplateInfo();
     info.id = id;
     info.title = dr["title"].ToString();
     info.content = dr["content"].ToString();
     
     info.filePath = dr["filePath"].ToString();
     info.activePath = dr["activePath"].ToString();
     info.templatePath = dr["templatePath"].ToString();
     return info;
 }
コード例 #3
0
ファイル: TemplateDal.cs プロジェクト: joleye/1.6
        //修改模板文件
        public void Update(TemplateInfo info,int id)
        {
            string sql = "update " + tableName + " set title = @title,filePath = @filePath,activePath=@activePath,templatePath = @templatePath,content=@content where id = @id";
            ExecuteDataSet(sql,
                "@title",2,50,info.title,
                "@filePath", 2, 50, info.filePath,
                "@activePath",2,50,info.activePath,
                "@templatePath", 2, 50, info.templatePath,
                "@content", 2, info.content.Length, info.content,
                "@id",1,8,id
                );

            //saveFile(info.templatePath, info.content);
            //同时保存
            //saveFile(info.filePath, info.content);
        }
コード例 #4
0
ファイル: TemplateDal.cs プロジェクト: joleye/1.6
        /// <summary>
        /// 添加新页面
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        public int add(TemplateInfo info)
        {
            int tid = add(tableName,
                "title", 2, 50, info.title,
                "filePath", 2, 50, info.filePath,
                "activePath", 2, 50, info.activePath,
                "templatePath", 2, 50, info.templatePath,
                "content", 2, info.content.Length, info.content,
                "typeId",1,8,info.typeId
                );

            //保存模板文件
            //saveFile(info.templatePath, info.content);
            //保存静态文件
            //saveFile(info.filePath, info.content);

            return tid;
        }
コード例 #5
0
ファイル: template_edit.aspx.cs プロジェクト: joleye/1.6
 protected void Page_Load(object sender, EventArgs e)
 {
     templateid = getId("templateid");
     app = gform("do");
     if (!IsPostBack)
     {
         if (app == "edit")
         {
             TemplateDal te = new TemplateDal();
             TemplateInfo info = new TemplateInfo();
             info = te.read(getId("id"));
             contentDetail.Text = info.content;
             title.Text = info.title;
             filePath.Text = info.filePath;
             activePath.Text = info.activePath;
             templatePath.Text = info.templatePath;
         }
     }
 }
コード例 #6
0
ファイル: TemplateCompiled.cs プロジェクト: joleye/1.6
        private void init(TemplateInfo info)
        { 
            templatestr = open(info.templatePath);
            info.content = templatestr;
            string filename = subfilename(info.activePath);
            Template tl = new Template(info);
            tl.do_include();
            tl.do_var();
            tl.do_if();
            tl.do_loop();
            tl.do_foreach();
            tl.do_write();
            tl.do_assign();

            //...
            
            tl.do_display(filename);
            TemplateInfo value = tl.getvalue();
            templatestr = value.content;

            fwrite(info.activePath, templatestr);
        }
コード例 #7
0
ファイル: do_template.cs プロジェクト: joleye/1.6
 //private TemplateInfo j_info;
 public do_template(TemplateInfo info):base(new TemplateInfo())
 {
     j_info = info;
 }
コード例 #8
0
ファイル: Template.cs プロジェクト: joleye/1.6
 public Template(TemplateInfo info)
 {
     j_info = info;
 }
コード例 #9
0
ファイル: TemplateAdmin.cs プロジェクト: joleye/1.6
 public TemplateAdmin(TemplateInfo info)
 {
     new TemplateCompiled(info);
 }
コード例 #10
0
ファイル: TemplateCompiled.cs プロジェクト: joleye/1.6
        public TemplateCompiled(TemplateInfo info)
        { 

            init(info);
        }