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); } }
public TemplateCompiled(FileUrl url) { TemplateTypeDal dal = new TemplateTypeDal(); TemplateTypeInfo info = dal.view(TEMPLATEPATH.Substring(TEMPLATEPATH.LastIndexOf("/")+1)); TemplateInfo tinfo = new TemplateDal().read(info.id, "aspx/"+url.name); if(this.isEquals(tinfo.templatePath,tinfo.activePath)) init(tinfo); }
private void reset_template(int tempid) { TemplateDal tm = new TemplateDal(); ArrayList ids = tm.GetAllId(tempid); foreach (int kid in ids) { TemplateInfo info = tm.read(kid); TemplateAdmin ta = new TemplateAdmin(info); } }
protected void Page_Load(object sender, EventArgs e) { string app = gform("do"); if (ISPOST) { string sid = pform("id"); string[] id = sid.Split(','); if (app == "del") { TemplateDal tl = new TemplateDal(); for (int i = 0; i < id.Length; i++) { tl.del(int.Parse(id[i])); } showMessage("批量删除成功"); } if (app == "reset") { TemplateDal tm = new TemplateDal(); for (int i = 0; i < id.Length; i++) { TemplateInfo info = tm.read(int.Parse(id[i])); TemplateAdmin ta = new TemplateAdmin(info); } showMessage("批量更新成功"); } } if (app == "drop") { int id = 0; gnum(ref id, "id"); if (id != 0) { TemplateDal tl = new TemplateDal(); tl.del(id); showMessage("删除成功"); } else showMessage("参数错误"); } else { templateid = getId("templateid"); setBind(); } }
public TemplateAdmin(int id) { TemplateDal tm = new TemplateDal(); TemplateInfo info = tm.read(id); StreamReader sr = new StreamReader(Server.MapPath(WEBPATH + info.templatePath), Encoding.Default); info.content = sr.ReadToEnd(); sr.Dispose(); sr.Close(); //Ä£°å´æ»ØÊý¾Ý¿â TemplateDal t = new TemplateDal(); t.Update(info, info.id); new TemplateCompiled(info); }
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; } } }