public static List <BatchRunHistogram> GetBatchRunHistograms(int batchRunId)
        {
            string connStr = ConfigurationManager.AppSettings["connStr"];
            List <BatchRunHistogram> batchRunHistograms = new List <BatchRunHistogram>();
            string sCommand = "Select * from BatchRunHistogram a where a.BatchRunId = " + batchRunId;

            using (SqlConnection sConnect = new SqlConnection(connStr))
            {
                using (SqlCommand sqlCommand = new SqlCommand(sCommand, sConnect))
                {
                    sConnect.Open();
                    SqlDataReader sr = sqlCommand.ExecuteReader();

                    while (sr.Read())
                    {
                        BatchRunHistogram batchRunHistogram = new BatchRunHistogram();
                        batchRunHistogram.BatchRunId         = batchRunId;
                        batchRunHistogram.IntervalStartValue = double.Parse(sr["IntervalStartValue"].ToString());
                        batchRunHistogram.IntervalEndValue   = double.Parse(sr["IntervalEndValue"].ToString());
                        batchRunHistogram.TotalCount         = int.Parse(sr["TotalCount"].ToString());
                        batchRunHistograms.Add(batchRunHistogram);
                    }
                }
            }
            return(batchRunHistograms);
        }
        public static void InsertOneBatchRunHistogram(BatchRunHistogram batchRunHis)
        {
            string        connStr = ConfigurationManager.AppSettings["connStr"];
            StringBuilder sb      = new StringBuilder("Insert into BatchRunHistogram(BatchRunId,IntervalStartValue,IntervalEndValue,TotalCount) values(");

            sb.Append(batchRunHis.BatchRunId);
            sb.Append(",");
            sb.Append(batchRunHis.IntervalStartValue);
            sb.Append(",");
            sb.Append(batchRunHis.IntervalEndValue);
            sb.Append(",");
            sb.Append(batchRunHis.TotalCount);
            sb.Append(")");
            using (SqlConnection sConnect = new SqlConnection(connStr))
            {
                SqlCommand sCommand = new SqlCommand(sb.ToString(), sConnect);
                sConnect.Open();
                sCommand.ExecuteNonQuery();
            }
        }
Exemple #3
0
 public static void InsertOneBatchRunHistogram(BatchRunHistogram batchRunHistogram)
 {
     BatchRunHistogramDataAccess.InsertOneBatchRunHistogram(batchRunHistogram);
 }