Beispiel #1
0
        /// <summary>
        /// Delete sample from database.
        /// </summary>
        /// <param name="sampleData">A WebMech.Web.SampleData that specifies
        /// data object of sample.</param>
        public void DeleteSample(SampleData sampleData)
        {
            LogIt.Info("DeleteSample(Id = " + sampleData.Id.ToString() + ")");
            WebMechDataContext db = new WebMechDataContext();

            var points = (from p in db.Points
                          where p.sample_id == sampleData.Id
                          select p);
            db.Points.DeleteAllOnSubmit(points);
            db.SubmitChanges();

            var parameters = (from p in db.Parameters
                              where p.sample_id == sampleData.Id
                              select p);
            db.Parameters.DeleteAllOnSubmit(parameters);
            db.SubmitChanges();

            var statistics = (from s in db.Statistics
                              where s.sample_id == sampleData.Id
                              select s);
            db.Statistics.DeleteAllOnSubmit(statistics);
            db.SubmitChanges();

            Sample sample = db.Samples.Single(s => s.sample_id == sampleData.Id);
            db.Samples.DeleteOnSubmit(sample);
            db.SubmitChanges();
        }
Beispiel #2
0
        /// <summary>
        /// Gets 3D model of sample.
        /// </summary>
        /// <param name="sampleData">A WebMech.Web.SampleData that specifies
        /// data object of sample.</param>
        /// <returns>A WebMech.Web.Model3DData that specifies
        /// data object of 3D model.</returns>
        public Model3DData GetSample(SampleData sampleData)
        {
            LogIt.Info("GetSample(Id = " + sampleData.Id.ToString() + ")");
            WebMechDataContext db = new WebMechDataContext();

            Statistic statistic = db.Statistics.Single(s => s.sample_id == sampleData.Id);
            Model3DData model3D = StatisticToData(statistic);

            var points = (from p in db.Points
                           where p.sample_id == sampleData.Id
                           orderby p.order ascending
                           select p);

            foreach (Point point in points)
                model3D.PointList.Add(PointToData(point));
            return model3D;
        }
Beispiel #3
0
 /// <summary>
 /// Modifies sample.
 /// </summary>
 /// <param name="surfaceData">A WebMech.Web.SampleData that specifies
 /// data object of sample.</param>
 /// <param name="imageName">A System.String that specifies
 /// the file name of sample image.</param>
 /// <param name="imageArray">A System.Byte[] that specifies
 /// byte array of image file</param>
 /// <param name="pointsName">A System.String that specifies
 /// the file name of text file with 3D points.</param>
 /// <param name="pointsArray">A System.String that specifies
 /// byte array of text file with 3D points.</param>
 public void ModifySample(SampleData sampleData, string imageName, byte[] imageArray, string pointsName, byte[] pointsArray)
 {
     LogIt.Info("ModifySample(Id = " + sampleData.Id.ToString() + ", ImageName = " + imageName + ", PointsName = " + pointsName + ")");
 }