/// <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); }
partial void DeleteSurface(Surface instance);
partial void UpdateSurface(Surface instance);
partial void InsertSurface(Surface instance);
/// <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() }; }