Example #1
0
        public void AddAnalysisInfo(AnalysisDto analysis)
        {
            string sqlInsert = "INSERT INTO fx." + AnalysisInfoTable +
                "(AnalysisName, Symbol, FirstAnalysedItemDate, LastAnalysedItemDate, AnalysedUnits, " +
                    "AnalysisStart, AnalysisEnd, AnalysisTotalTime) " +
                "VALUES ('" + analysis.Type + "'" +
                    ", '" + analysis.Symbol + "'" +
                    ", '" + analysis.FirstItemDate + "'" +
                    ", '" + analysis.LastItemDate + "'" +
                    ", " + analysis.AnalyzedItems +
                    ", '" + analysis.AnalysisStart + "'" +
                    ", '" + analysis.AnalysisEnd + "'" +
                    ", " + analysis.AnalysisTotalTime.ToDbString() + ");";

            using (var context = new EFDbContext())
            {
                context.Database.ExecuteSqlCommand(sqlInsert);
                context.SaveChanges();
            }
        }
Example #2
0
        public AnalysisDto ToDto()
        {
            var dto = new AnalysisDto
            {
                Type = Type.TableName(),
                Symbol = Symbol,
                FirstItemDate = FirstItemDate,
                LastItemDate = LastItemDate,
                AnalyzedItems = AnalyzedItems,
                AnalysisStart = AnalysisStart,
                AnalysisEnd = AnalysisEnd,
                AnalysisTotalTime = TotalTime()
            };

            return dto;
        }