private bool SaveEntity(DBTStkMinuteEntity entity, string code)
        {
            if (entity == null)
            {
                return(false);
            }

            entity.Code = code;
            entity.CalculateAverage();
            if (entity.IsDataValid && CheckTable <DBTStkMinuteEntity>())
            {
                var stk_minute = new DBTStkMinuteEntity(entity.Code, entity.Time, accessor);
                if (stk_minute.Fresh() > 0 && entity.Equals(stk_minute))
                {
                    return(false);
                }
                stk_minute.Copy(entity, "ID");
                stk_minute.GenerateID();
                if (stk_minute.Save() > 0)
                {
                    //logger.Write(TYPE.INFO, string.Format("import data([CD:{0}][TDDT:{1}]) in (STK_DAILY_TD)", stk_daily.Code, stk_daily.Date.ToString("yyyy-MM-dd")));
                    return(true);
                }
            }
            return(false);
        }
        private void SaveEntity(TimeLine <ItemInfoEntity> line)
        {
            if (CheckTable <DBTStkMinuteEntity>())
            {
                var entity = new DBTStkMinuteEntity(accessor);
                entity.Code = line.Value.Code;

                if (line is TengxunMinuteLine)
                {
                    var tengxunline = line as TengxunMinuteLine;
                    entity.Time      = new DateTime(tengxunline.CloseTime.Year, tengxunline.CloseTime.Month, tengxunline.CloseTime.Day, tengxunline.CloseTime.Hour, tengxunline.CloseTime.Minute, 0);
                    entity.Open      = tengxunline.Open;
                    entity.Close     = tengxunline.Close;
                    entity.High      = tengxunline.High;
                    entity.Low       = tengxunline.Low;
                    entity.Average   = tengxunline.Average;
                    entity.VolAmount = tengxunline.VolAmount;
                    entity.VolMoney  = tengxunline.VolMoney;
                }

                entity.GenerateID();
                entity.Save();
            }
        }