public void CreateSeasonForcast(StockSeasonReport forcast)
        {
            var sql = @"insert into stock_season_report(code, reportday, reportforcastdate, profittrend, forcastcontent, changereason, updatetime)
                                    values(@code, @reportday, @reportforcastdate, @profittrend, @forcastcontent, @changereason, @updatetime);";

            var parameters = new IDataParameter[]
            {
                new MySqlParameter("@code", forcast.Code),
                new MySqlParameter("@reportday", DateTime.Parse(forcast.ReportDay.ToString("yyyy-MM-dd"))),
                new MySqlParameter("@reportforcastdate", forcast.ReportForcastDate),
                new MySqlParameter("@profittrend", forcast.ProfitTrend),
                new MySqlParameter("@forcastcontent", forcast.ForcastContent),
                new MySqlParameter("@changereason", forcast.ChangeReason),
                new MySqlParameter("@updatetime", DateTime.Now),
            };

            var returnCode = this.DbRequest.ExecuteNonQuery(this.ConnectionString, sql, parameters, CommandType.Text);
        }
        public void UpdateSeasonForcast(StockSeasonReport forcast)
        {
            var sql = @"update stock_season_report set
                                profittrend = @profittrend, forcastcontent = @forcastcontent, changereason = @changereason, updatetime = @updatetime
                                where code = @code and reportday = @reportday;";

            var parameters = new IDataParameter[]
            {
                new MySqlParameter("@code", forcast.Code),
                new MySqlParameter("@reportday", DateTime.Parse(forcast.ReportDay.ToString("yyyy-MM-dd"))),
                new MySqlParameter("@reportforcastdate", forcast.ReportForcastDate),
                new MySqlParameter("@profittrend", forcast.ProfitTrend),
                new MySqlParameter("@forcastcontent", forcast.ForcastContent),
                new MySqlParameter("@changereason", forcast.ChangeReason),
                new MySqlParameter("@updatetime", DateTime.Now),
            };

            var returnCode = this.DbRequest.ExecuteNonQuery(this.ConnectionString, sql, parameters, CommandType.Text);
        }
Example #3
0
        public void UpdateStockMatrix_Season_Profit_Report(string stockCode, List<CompanyPerformanceForcast> crawledForcastList)
        {
            if (crawledForcastList == null || crawledForcastList.Count == 0)
            {
                return;
            }
            foreach (var fc in crawledForcastList)
            {
                var forcast = new StockSeasonReport()
                {
                    Code = stockCode,
                    ReportDay = fc.ReportDay,
                    ReportForcastDate = fc.ReportForcastDate,
                    ProfitTrend = fc.ProfitTrend,
                    ForcastContent = fc.ForcastContent,
                    ChangeReason = fc.ChangeReason,
                    UpdateTime = DateTime.Now,
                };

                var records = _ssrRepository.RetrieveByStockAndSeasonReportDay(forcast.Code, forcast.ReportDay);

                if (records == null)
                {
                    _ssrRepository.CreateSeasonForcast(forcast);
                }
                else
                {
                    _ssrRepository.UpdateSeasonForcast(forcast);
                }
            }
        }