using System.ComponentModel; using System.ComponentModel.DataAnnotations; using System.Web.DynamicData; using System.Linq; using System; using Aspnet.Samples.DynamicData; namespace TicketCenter_Data { // Attach the DailySaleMetadata to the DailySale class [MetadataType(typeof(DailySaleMetadata))] [Security(Role = "Users", Action = "Details")] [Security(Role = "Users", Action = "Insert")] [Security(Role = "Users", Action = "List")] 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 { public object JK { get; set; } public object Event { get; set; } [DisplayName("Date Sold")] [DefaultValue("mm-dd-yyyy")] [DisplayFormat(DataFormatString = "{0:MM-dd-yyyy}")] public object DateSold { get; set; } [DisplayName("Tickets Sold")] public object TicketsSold { get; set; } // Columns I want hidden [ScaffoldColumn(false)] public object Modified { get; set; } } }