Beispiel #1
0
 private void SetForecastedResult(SqlCommand cm, ForecastedResult p)
 {
     DatabaseHelper.InsertDateTimeParam("@DurationDateTime", cm, p.DurationDateTime);
     DatabaseHelper.InsertInt32Param("@FacilityId", cm, p.FacilityId);
     DatabaseHelper.InsertMoneyParam("@ForecastId", cm, p.ForecastId);
     DatabaseHelper.InsertDoubleParam("@ForecastValue", cm, p.ForecastValue);
     DatabaseHelper.InsertInt32Param("@HistoricalValue", cm, p.HistoricalValue);
     DatabaseHelper.InsertBooleanParam("@IsHistorical", cm, p.IsHistorical);
     DatabaseHelper.InsertInt32Param("@TestId", cm, p.TestId);
     DatabaseHelper.InsertDoubleParam("@TotalForecastValue", cm, p.TotalForecastValue);
     DatabaseHelper.InsertStringNVarCharParam("@TestType", cm, p.TestType);
 }
Beispiel #2
0
        public void SaveForecastedResult(ForecastedResult fr, SqlTransaction tr)
        {
            string sql = "INSERT INTO ForecastedResult ([ForecastId],[FacilityId] ,[TestId], [TestType], [IsHistorical] ,[HistoricalValue], ";

            sql += "[ForecastValue] ,[DurationDateTime],[TotalForecastValue]) VALUES (@ForecastId, @FacilityId, @TestId, @TestType, @IsHistorical, ";
            sql += "@HistoricalValue, @ForecastValue, @DurationDateTime, @TotalForecastValue) SELECT @@identity";

            using (SqlCommand cm = new SqlCommand(sql, DefaultConnection, tr))
            {
                SetForecastedResult(cm, fr);
                fr.Id = int.Parse(cm.ExecuteScalar().ToString());
            }
        }
Beispiel #3
0
        private void FetchForecastedResult(SqlDataReader dr, ForecastInfo test)
        {
            while (dr.Read())
            {
                ForecastedResult p = new ForecastedResult()
                {
                    Id                 = DatabaseHelper.GetInt32("Id", dr),
                    TestId             = DatabaseHelper.GetInt32("TestId", dr),
                    DurationDateTime   = DatabaseHelper.GetDateTime("DurationDateTime", dr),
                    FacilityId         = DatabaseHelper.GetInt32("FacilityId", dr),
                    ForecastId         = DatabaseHelper.GetInt32("ForecastId", dr),
                    ForecastValue      = DatabaseHelper.GetDouble("ForecastValue", dr),
                    HistoricalValue    = DatabaseHelper.GetInt32("HistoricalValue", dr),
                    IsHistorical       = DatabaseHelper.GetBoolean("IsHistorical", dr),
                    TotalForecastValue = DatabaseHelper.GetDouble("TotalForecastValue", dr),
                    TestType           = DatabaseHelper.GetString("TestType", dr)
                };

                test.ForecastedResults.Add(p);
            }
        }