protected void Page_Load(object sender, EventArgs e) { BrandIdea po = new BrandIdea(); po.biType = "type"; po.biContent = "content"; BrandIdeaDAO dao = new BrandIdeaDAO(); dao.insert(po); }
public int insert(BrandIdea po) { StringBuilder sql = new StringBuilder(); sql.Append("insert into BrandIdea values(newid(), "); sql.Append(String.Format("{0},", DbAccess.parse(po.biType))); sql.Append(String.Format("{0},", DbAccess.parse(po.biContent))); sql.Append("getdate(), getdate())"); return DbAccess.executeUpdate(sql.ToString()); }
public int insert(BrandIdea po) { StringBuilder sql = new StringBuilder(); sql.Append("insert into BrandIdea values(newid(), "); sql.Append(String.Format("{0},", DbAccess.parse(po.biType))); sql.Append(String.Format("{0},", DbAccess.parse(po.biContent))); sql.Append("getdate(), getdate())"); return(DbAccess.executeUpdate(sql.ToString())); }
public int update(BrandIdea po) { StringBuilder sql = new StringBuilder(); sql.Append("update BrandIdea set "); sql.Append(String.Format("bi_type={0},", DbAccess.parse(po.biType))); sql.Append(String.Format("bi_content={0},", DbAccess.parse(po.biContent))); sql.Append("bi_update_time=getdate()"); sql.Append(String.Format(" where bi_id='{0}'", po.biId)); return DbAccess.executeUpdate(sql.ToString()); }
public int update(BrandIdea po) { StringBuilder sql = new StringBuilder(); sql.Append("update BrandIdea set "); sql.Append(String.Format("bi_type={0},", DbAccess.parse(po.biType))); sql.Append(String.Format("bi_content={0},", DbAccess.parse(po.biContent))); sql.Append("bi_update_time=getdate()"); sql.Append(String.Format(" where bi_id='{0}'", po.biId)); return(DbAccess.executeUpdate(sql.ToString())); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; string method = context.Request.Params["method"]; if ("list".Equals(method)) { string ajax = context.Request.Params["ajax"]; BrandIdeaDAO dao = new BrandIdeaDAO(); BrandIdea bi = new BrandIdea(); bi.biType = context.Request.Params["biType"]; DataSet ds = dao.select(bi); string result = ""; if (String.IsNullOrEmpty(ajax)) { result = "_list = " + JsonCommon.ds2json(ds); } else { result = JsonCommon.ds2json(ds); } context.Response.Write(result); } else if ("detail".Equals(method)) { BrandIdeaDAO dao = new BrandIdeaDAO(); BrandIdea bi = new BrandIdea(); bi.biId = context.Request.Params["biId"]; DataSet ds = dao.select(bi); string json = JsonCommon.ds2json(ds); context.Response.Write(json); } else if ("save".Equals(method)) { string biContent = HttpUtility.UrlDecode((context.Request.Params["biContent"]).Replace("@", "%")); string biType = context.Request.Params["biType"]; string biId = context.Request.Params["biId"]; BrandIdeaDAO dao = new BrandIdeaDAO(); BrandIdea bi = new BrandIdea(); bi.biId = biId; bi.biContent = biContent; bi.biType = biType; dao.update(bi); } }
public DataSet select(BrandIdea po) { StringBuilder sql = new StringBuilder(); sql.Append("select * from BrandIdea where 1=1"); if (!String.IsNullOrEmpty(po.biType)) { sql.Append(String.Format(" and bi_type={0}", DbAccess.parse(po.biType))); } if (!String.IsNullOrEmpty(po.biContent)) { sql.Append(String.Format(" and bi_content={0}", DbAccess.parse(po.biContent))); } if (!String.IsNullOrEmpty(po.biId)) { sql.Append(String.Format(" and bi_id='{0}'", po.biId)); } sql.Append(" order by bi_update_time desc"); return DbAccess.executeQuery(sql.ToString()); }
public DataSet select(BrandIdea po) { StringBuilder sql = new StringBuilder(); sql.Append("select * from BrandIdea where 1=1"); if (!String.IsNullOrEmpty(po.biType)) { sql.Append(String.Format(" and bi_type={0}", DbAccess.parse(po.biType))); } if (!String.IsNullOrEmpty(po.biContent)) { sql.Append(String.Format(" and bi_content={0}", DbAccess.parse(po.biContent))); } if (!String.IsNullOrEmpty(po.biId)) { sql.Append(String.Format(" and bi_id='{0}'", po.biId)); } sql.Append(" order by bi_update_time desc"); return(DbAccess.executeQuery(sql.ToString())); }
public int delete(BrandIdea po) { string sql = String.Format("delete from BrandIdea where bi_id='{0}'", po.biId); return(DbAccess.executeUpdate(sql)); }
public int delete(BrandIdea po) { string sql = String.Format("delete from BrandIdea where bi_id='{0}'", po.biId); return DbAccess.executeUpdate(sql); }