using System.ComponentModel; using System.ComponentModel.DataAnnotations; using System.Web.DynamicData; using System.Linq; using System; // Attach the DailySaleMetadata to the DailySale class [MetadataType(typeof(DailySaleMetadata))] public partial class DailySale { // Default Timestamp partial void OnTicketsSoldChanged() { Modified = DateTime.Now; } //partial void OnValidate(System.Data.Linq.ChangeAction action) //{ // var dc = new ITCDataContext(); // dc.JKs.SingleOrDefault(c => c.JKID == 104); // var q = from jk in dc.JKs // select jk; // foreach (var s in q) // System.Diagnostics.Debug.WriteLine(s.Name); //} } [TableName("Daily Sales")] public class DailySaleMetadata { [DefaultValue("mm-dd-yyyy")] [DisplayName("Date Sold")] [DisplayFormat(DataFormatString = "{0:MM-dd-yyyy}")] [UIHint("CalendarDateTime")] public object DateSold { get; set; } [DisplayName("Tickets Sold")] public object TicketsSold { get; set; } // Columns I want hidden [ScaffoldColumn(false)] public object Modified { get; set; } }