コード例 #1
0
 /// <summary>
 /// 新增promotionsamountfare的sql語句,用於事物的調用
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public string SavePromoFare(PromotionsAmountFare model)
 {
     model.Replace4MySQL();
     StringBuilder sql = new StringBuilder();
     try
     {
         sql.AppendFormat("insert into  promotions_amount_fare (");
         sql.AppendFormat("name,display,delivery_store,group_id,class_id,brand_id,category_id,product_id,type,amount,quantity,start,end,");
         sql.AppendFormat("created,active,event_desc,event_type,condition_id,device,kuser,fare_percent,payment_code,off_times,url_by,site,modified,muser,status,vendor_coverage) values ");
         sql.AppendFormat("('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}',{14},'{15}','{16}','{17}','{18}','{19}','{20}','{21}','{22}','{23}','{24}','{25}','{26}','{27}','{28}');select @@identity;",
          model.name, model.display, model.delivery_store, model.group_id, model.class_id, model.brand_id,
          model.category_id, model.product_id, model.type, model.amount, model.quantity, CommonFunction.DateTimeToString(model.start),
          CommonFunction.DateTimeToString(model.end),
          CommonFunction.DateTimeToString(model.created),
          model.active ? 1 : 0, model.event_desc, model.event_type,
          model.condition_id, model.device, model.kuser,
          model.fare_percent, model.payment_code, model.off_times,
          model.url_by, model.site, CommonFunction.DateTimeToString(model.modified), model.muser, model.status, model.vendor_coverage);
         return sql.ToString();
     }
     catch (Exception ex)
     {
         throw new Exception("PromotionsAmountFareDao-->SavePromoFare-->" + ex.Message, ex);
     }
 }
コード例 #2
0
 /// <summary>
 /// 根據編號獲取數據
 /// </summary>
 /// <param name="model">滿額滿件免運對象</param>
 /// <returns>數據列表</returns>
 public DataTable Select(PromotionsAmountFare model)
 {
     model.Replace4MySQL();
     StringBuilder sb = new StringBuilder();
     sb.Append(@" select id, name,display,delivery_store,group_id,class_id,brand_id,category_id,product_id,type,amount,quantity,start,end,
    created,active,event_desc,event_type,condition_id,device,kuser,fare_percent,payment_code,off_times,url_by,
     site,modified,muser,status,vendor_coverage from promotions_amount_fare where 1=1");
     if (model.id != 0)
     {
         sb.AppendFormat(" and id='{0}';", model.id);
     }
     try
     {
         return _access.getDataTable(sb.ToString());
     }
     catch (Exception ex)
     {
         throw new Exception("PromotionsAmountFareDao-->Select-->" + ex.Message + sb.ToString(), ex);
     }
 }