Ejemplo n.º 1
0
 public void CreateDetainReason(DetainReason dr)
 {
     SqlParameter[] param=new SqlParameter[]{
         SqlUtilities.GenerateInputIntParameter("@order_id", dr.OrderId),
         SqlUtilities.GenerateInputNVarcharParameter("@order_encode", 50, dr.OrderEncode),
         SqlUtilities.GenerateInputNVarcharParameter("@reason", 500, dr.Reason),
         SqlUtilities.GenerateInputDateTimeParameter("@create_time", dr.CreateTime),
         SqlUtilities.GenerateInputIntParameter("@user_id", dr.UserId)
     };
     string sql = "INSERT INTO detain_reasons(order_id, order_encode, reason, create_time, user_id) VALUES(@order_id, @order_encode, @reason, @create_time, @user_id)";
     SqlHelper.ExecuteNonQuery(CommandType.Text, sql, param);
 }
Ejemplo n.º 2
0
 public DetainReason GetDetainReasonByOrderId(int orderId)
 {
     DetainReason detainReason = null;
     SqlParameter[] param = new SqlParameter[] {
         SqlUtilities.GenerateInputIntParameter("@order_id", orderId)
     };
     string sql = "SELECT id, order_id, order_encode, reason, create_time, user_id FROM detain_reasons WHERE order_id = @order_id";
     using (SqlDataReader dr = SqlHelper.ExecuteReader(CommandType.Text, sql, param))
     {
         while (dr.Read())
         {
             detainReason = new DetainReason();
             detainReason.Id = dr.GetInt32(0);
             detainReason.OrderId = dr.GetInt32(1);
             detainReason.OrderEncode = dr.GetString(2);
             detainReason.Reason = dr.GetString(3);
             detainReason.CreateTime = dr.GetDateTime(4);
             detainReason.UserId = dr.GetInt32(5);
         }
     }
     return detainReason;
 }
Ejemplo n.º 3
0
 public static void CreateDetainReason(DetainReason dr)
 {
     dal.CreateDetainReason(dr);
 }