Esempio n. 1
0
 public int Update(PromoTicket model)
 {
     model.Replace4MySQL();
     StringBuilder sb = new StringBuilder();
     try
     {
         sb.AppendFormat(" update promo_ticket set");
         sb.AppendFormat(" ticket_name='{0}',event_id='{1}',event_type='{2}',active_now='{3}',valid_interval='{4}',", model.ticket_name, model.event_id, model.event_type, model.active_now, model.valid_interval);
         sb.AppendFormat(" use_start='{0}',use_end='{1}',kuser='******',kdate='{3}',muser,mdate='{4}',status='{5}' where rid='{6}' ;", CommonFunction.DateTimeToString(model.use_start), CommonFunction.DateTimeToString(model.use_end), model.kuser, CommonFunction.DateTimeToString(model.kdate), model.muser, CommonFunction.DateTimeToString(model.mdate), model.status, model.rid);
         return _access.execCommand(sb.ToString());
     }
     catch (Exception ex)
     {
         throw new Exception("PromoTicketDao-->Update-->" + ex.Message + sb.ToString(), ex);
     }
 }
Esempio n. 2
0
 public int Save(PromoTicket model)
 {
     model.Replace4MySQL();
     StringBuilder sb = new StringBuilder();
     try
     {
         sb.AppendFormat(" insert into promo_ticket( ticket_name,event_id,event_type,active_now,valid_interval,");
         sb.AppendFormat(" use_start,use_end,kuser,kdate,muser,mdate,status)");
         sb.AppendFormat(" values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}');select @@identity;",
          model.ticket_name, model.event_id, model.event_type, model.active_now, model.valid_interval, CommonFunction.DateTimeToString(model.use_start), CommonFunction.DateTimeToString(model.use_end), model.kuser, CommonFunction.DateTimeToString(model.kdate), model.muser, CommonFunction.DateTimeToString(model.mdate), model.status);
         return Int32.Parse(_access.getDataTable(sb.ToString()).Rows[0][0].ToString());
     }
     catch (Exception ex)
     {
         throw new Exception("PromoTicketDao-->Save-->" + ex.Message + sb.ToString(), ex);
     }
 }