示例#1
0
        /// <summary>
        /// Add new surface into database.
        /// </summary>
        /// <param name="name">A System.String that specifies
        /// name of surface.</param>
        /// <returns>A WebMech.Web.SurfaceData that specifies
        /// data object of surface.</returns>
        public SurfaceData AddSurface(string name)
        {
            LogIt.Info("AddSurface(Name = " + name + ")");
            WebMechDataContext db = new WebMechDataContext();

            Surface surface = new Surface();
            surface.name = name;
            surface.creation_date =
            surface.modification_date = DateTime.Now;

            db.Surfaces.InsertOnSubmit(surface);
            db.SubmitChanges();

            return SurfaceToData(surface);
        }
示例#2
0
 partial void DeleteSurface(Surface instance);
示例#3
0
 partial void UpdateSurface(Surface instance);
示例#4
0
 partial void InsertSurface(Surface instance);
示例#5
0
 /// <summary>
 /// Creates web service data object from database object.
 /// </summary>
 /// <param name="surface">A WebMech.Web.Surface that specifies
 /// row of Surface table.</param>
 /// <returns>A WebMech.Web.SurfaceData that specifies
 /// data object of surface.</returns>
 private SurfaceData SurfaceToData(Surface surface)
 {
     return new SurfaceData
     {
         Id = (int)surface.surface_id,
         Name = surface.name,
         CreationDate = surface.creation_date,
         ModificationDate = surface.modification_date,
         MeasurementCount = surface.Samples.Count()
     };
 }