using System.ComponentModel; using System.ComponentModel.DataAnnotations; using System.Web.DynamicData; using System.Linq; using System; namespace TicketCenter_Data { // Attach the DailySaleMetadata to the DailySale class [MetadataType(typeof(DailySaleMetadata))] public partial class DailySale { partial void OnValidate(System.Data.Linq.ChangeAction action) { if (action == System.Data.Linq.ChangeAction.Insert || action == System.Data.Linq.ChangeAction.Update) { Modified = DateTime.Now; //Update the Timestamp in Table TransferLog } } } [TableName("Daily Sales")] public class DailySaleMetadata { [Display(Order = 1)] public object JK { get; set; } [Display(Order = 2)] public object Event { get; set; } [Display(Order = 3)] [DefaultValue("mm-dd-yyyy")] [DisplayName("Date Sold")] [DisplayFormat(DataFormatString = "{0:MM-dd-yyyy}")] [UIHint("CalendarDateTime")] public object DateSold { get; set; } [Display(Order = 4)] [DisplayName("Tickets Sold")] public object TicketsSold { get; set; } // Columns I want hidden [ScaffoldColumn(false)] public object Modified { get; set; } } }