/// <summary> /// 获得单页内容的单条记录实体 /// </summary> /// <param name="_id"></param> public DataTable GetDT(string where) { using (DbOperHandler _doh = new Common().Doh()) { SiteGroupCms.Entity.Normal_Template template = new SiteGroupCms.Entity.Normal_Template(); _doh.Reset(); _doh.SqlCmd = "SELECT * FROM [yy_templateinfo] WHERE " + where; DataTable dt = _doh.GetDataTable(); return(dt); } }
public bool Addtemplate(SiteGroupCms.Entity.Normal_Template obj) { using (DbOperHandler _doh = new Common().Doh()) { _doh.Reset(); _doh.AddFieldItem("title", obj.Title); _doh.AddFieldItem("siteid", obj.Siteid); _doh.AddFieldItem("type", obj.Type); _doh.AddFieldItem("source", obj.Source); //_doh.AddFieldItem("imagedirname", obj.Imagedirname); _doh.AddFieldItem("filename", obj.FileName); int _insert = _doh.Insert("yy_templateinfo"); return(_insert > 0); } }
public bool updatetemplate(SiteGroupCms.Entity.Normal_Template obj) { using (DbOperHandler _doh = new Common().Doh()) { _doh.Reset(); _doh.ConditionExpress = "id=@id"; _doh.AddConditionParameter("@id", obj.Id); _doh.AddFieldItem("title", obj.Title); _doh.AddFieldItem("siteid", obj.Siteid); _doh.AddFieldItem("type", obj.Type); _doh.AddFieldItem("source", obj.Source); // _doh.AddFieldItem("imagedirname", obj.Imagedirname); _doh.AddFieldItem("filename", obj.FileName); int _insert = _doh.Update("yy_templateinfo"); return(_insert > 0); } }
public void gettemplateinfo() { SiteGroupCms.Dal.Normal_TemplateDAL templatedal = new SiteGroupCms.Dal.Normal_TemplateDAL(); SiteGroupCms.Entity.Normal_Template template = new SiteGroupCms.Entity.Normal_Template(); if (id != "0") { template = templatedal.GetEntity(id); } if (template != null) { _response += "{\"IsError\":false,\"Message\":\"加载成功\",\"Data\":{\"id\":" + template.Id + ","; _response += "\"title\":" + SiteGroupCms.Utils.fastJSON.JSON.WriteString(template.Title) + ",\"type_val\":\"" + template.Type + "\","; _response += "\"source\":\"" + template.Source + "\",\"filename\":\"" + template.FileName + "\""; _response += "}}"; } Response.Write(_response); }
/// <summary> /// 获得单页内容的单条记录实体 /// </summary> /// <param name="_id"></param> public SiteGroupCms.Entity.Normal_Template GetEntity(string _id) { using (DbOperHandler _doh = new Common().Doh()) { SiteGroupCms.Entity.Normal_Template template = new SiteGroupCms.Entity.Normal_Template(); _doh.Reset(); _doh.SqlCmd = "SELECT * FROM [yy_templateinfo] WHERE [Id]=" + _id; DataTable dt = _doh.GetDataTable(); if (dt.Rows.Count > 0) { template.Id = Str2Int(_id); template.Title = dt.Rows[0]["title"].ToString(); template.Siteid = Str2Int(dt.Rows[0]["siteid"].ToString()); template.Type = Str2Int(dt.Rows[0]["type"].ToString()); template.Source = dt.Rows[0]["source"].ToString(); template.Imagedirname = dt.Rows[0]["imagedirname"].ToString(); template.Addtime = SiteGroupCms.Utils.Validator.StrToDate(dt.Rows[0]["addtime"].ToString(), DateTime.Now); } return(template); } }
public void deltemplate() { SiteGroupCms.Dal.Normal_TemplateDAL templatedal = new SiteGroupCms.Dal.Normal_TemplateDAL(); SiteGroupCms.Entity.Normal_Template template = new SiteGroupCms.Entity.Normal_Template(); string[] idd = ids.Split(','); for (int i = 0; i < idd.Length; i++) { template = templatedal.GetEntity(idd[i]); if (SiteGroupCms.Utils.DirFile.FileExists(template.Source)) { SiteGroupCms.Utils.DirFile.DeleteFile(template.Source); } } if (templatedal.DeleteByIDs(ids)) { new SiteGroupCms.Dal.LogDal().SaveLog(12); _response += "{\"IsError\":false,\"Message\":\"删除成功\",\"Data\":{\"art\":0}}"; } else { _response += "{\"IsError\":true,\"Message\":\"删除失败\",\"Data\":{\"art\":0}}"; } Response.Write(_response); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Admin_Load("1", "json"); if (Request.QueryString["id"] != null && Request.QueryString["id"] != "") { id = Request.QueryString["id"]; SiteGroupCms.Dal.Normal_TemplateDAL templatedal = new SiteGroupCms.Dal.Normal_TemplateDAL(); SiteGroupCms.Entity.Normal_Template template = templatedal.GetEntity(id); if (template != null) { try { content2.Value = SiteGroupCms.Utils.DirFile.ReadFile(template.Source); } catch (Exception) { content2.Value = ""; } } } } }