/// <summary>
        /// Updates the trace set.
        /// </summary>
        /// <param name="traceSet">The trace set.</param>
        /// <param name="traceItems">The trace items.</param>
        public void updateTraceSet(ATRACESET traceSet, List <ATRACEITEM> traceItems)
        {
            DBConnection_EF conn = null;

            try
            {
                conn = DBConnection_EF.GetContext();
                conn.BeginTransaction();
                ATRACESET sv_traceSet = null;
                sv_traceSet = traceSetDao.getTraceSet(conn, true, traceSet.TRACE_ID);
                if (sv_traceSet != null)
                {
                    sv_traceSet.SMP_PERIOD    = traceSet.SMP_PERIOD;
                    sv_traceSet.TOTAL_SMP_CNT = traceSet.TOTAL_SMP_CNT;
                    sv_traceSet.SMP_CNT       = 0;      //重新開始
                    sv_traceSet.calcNextSmpTime();
                    traceSetDao.updateTraceSet(conn, sv_traceSet);
                }
                else
                {
                    sv_traceSet             = traceSet;
                    sv_traceSet.NX_SMP_TIME = DateTime.Now;
                    sv_traceSet.SMP_TIME    = DateTime.Now;
                    traceSetDao.insertTraceSet(conn, traceSet);
                }

                deleteTraceItem(traceSet.TRACE_ID);
                foreach (ATRACEITEM item in traceItems)
                {
                    traceSetDao.insertTraceItem(conn, item);
                }
                conn.Commit();
            }
            catch (Exception ex)
            {
                if (conn != null)
                {
                    try { conn.Rollback(); } catch (Exception ex_rollback) { logger.Error(ex_rollback, "Exception"); }
                }
                logger.Error(ex, "Exception:");
            }
            finally
            {
                if (conn != null)
                {
                    try { conn.Close(); } catch (Exception ex_close) { logger.Error(ex_close, "Exception:"); }
                }
            }
        }
        /// <summary>
        /// Updates the trace set.
        /// </summary>
        /// <param name="trace_id">The trace_id.</param>
        /// <param name="smp_period">The smp_period.</param>
        /// <param name="total_smp_cnt">The total_smp_cnt.</param>
        /// <param name="svidList">The svid list.</param>
        public void updateTraceSet(string trace_id, string smp_period, int total_smp_cnt, List <string> svidList)
        {
            ATRACESET traceSet = new ATRACESET()
            {
                TRACE_ID      = trace_id,
                SMP_PERIOD    = smp_period,
                TOTAL_SMP_CNT = total_smp_cnt,
                TraceItemList = new List <ATRACEITEM>()
            };

            traceSet.calcNextSmpTime();
            List <ATRACEITEM> traceItems = new List <ATRACEITEM>();

            foreach (string svid in svidList)
            {
                ATRACEITEM tItem = new ATRACEITEM();
                tItem.TRACE_ID = trace_id;
                tItem.SVID     = svid;
                traceItems.Add(tItem);
            }
            updateTraceSet(traceSet, traceItems);
        }