public string Save(PromotionsAmountReduce model) { model.Replace4MySQL(); StringBuilder sql = new StringBuilder(); try { sql.Append(" insert into promotions_amount_reduce(id,name,delivery_store,group_id,type,amount,quantity,start,end,created,active,status)"); sql.AppendFormat(" values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}');", model.id, model.name, model.delivery_store, model.group_id, model.type, model.amount, model.quantity, CommonFunction.DateTimeToString(model.start), CommonFunction.DateTimeToString(model.end), CommonFunction.DateTimeToString(model.created), model.active, model.status); return sql.ToString(); } catch (Exception ex) { throw new Exception("PromotionsAmountReduceDao-->Save-->" + ex.Message + sql.ToString(), ex); } }
public string Update(PromotionsAmountReduce model) { model.Replace4MySQL(); StringBuilder sql = new StringBuilder(); try { sql.Append(" update promotions_amount_reduce set "); sql.AppendFormat(" name='{0}',delivery_store='{1}',group_id='{2}',type='{3}',amount='{4}',quantity='{5}',", model.name, model.delivery_store, model.group_id, model.type, model.amount, model.quantity); sql.AppendFormat(" start='{0}',end='{1}',updatetime='{2}',active='{3}',status='{4}'", CommonFunction.DateTimeToString(model.start), CommonFunction.DateTimeToString(model.end), CommonFunction.DateTimeToString(model.updatetime), model.active, model.status); sql.AppendFormat(" where id='{0}';", model.id); return sql.ToString(); } catch (Exception ex) { throw new Exception("PromotionsAmountReduceDao-->Update-->" + ex.Message + sql.ToString(), ex); } }