/// <summary> /// 新增促銷活動時使用 /// </summary> /// <param name="model"></param> /// <returns></returns> public string SaveProdProm(ProdPromo model) { model.Replace4MySQL(); StringBuilder sbSql = new StringBuilder(); sbSql.Append(@" insert into prod_promo ("); sbSql.Append(" product_id, event_id,event_type,event_desc,start,end,page_url,user_specified,kuser,kdate,muser,mdate,status) "); sbSql.AppendFormat(" values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}');", model.product_id, model.event_id, model.event_type, model.event_desc, CommonFunction.DateTimeToString(model.start), Common.CommonFunction.DateTimeToString(model.end), model.page_url, model.user_specified, model.kuser, Common.CommonFunction.DateTimeToString(model.kdate), model.muser, Common.CommonFunction.DateTimeToString(model.mdate), model.status); return sbSql.ToString(); }
public int Update(ProdPromo model) { model.Replace4MySQL(); StringBuilder sbSql = new StringBuilder(); sbSql.Append("set sql_safe_updates = 0; "); sbSql.Append("update prod_promo set "); sbSql.AppendFormat(" product_id='{0}', event_type='{1}',event_desc='{2}',start='{3}',end='{4}', ", model.product_id, model.event_type, model.event_desc, CommonFunction.DateTimeToString(model.start), Common.CommonFunction.DateTimeToString(model.end)); sbSql.AppendFormat(" page_url='{0}',user_specified='{1}',muser='******',mdate='{3}',status='{4}'", model.page_url, model.user_specified, model.muser, Common.CommonFunction.DateTimeToString(model.mdate), model.status); sbSql.AppendFormat(" where event_id='{0}';", model.event_id); sbSql.Append("set sql_safe_updates = 1;"); return _access.execCommand(sbSql.ToString()); }