private void UndeletableComments(LinqDataSourceUpdateEventArgs e)
{
//get a reference to the currently saved item ****NOTE (State) is the ClassName. It’s a table of states in this test database
var currentData = ((MyData)e.OriginalObject).Notes;
// make a copy of whatever is in the edit field and strip out the previous comments
var newData = ((MyData)e.NewObject).Notes.Replace(currentData, string.Empty);
//check both values for nulls
if (currentData != null && newData != null)
{
newData = ((MyData)e.NewObject).Notes.Replace(currentData, string.Empty);
}
// replace the data to be stored in the database with the currentdata + the newData
// I added a datestamp to see when the new comment was added.
((MyData)e.NewObject).Notes = string.Format("{0} Added:{1} at (2) --- {3}", currentData, DateTime.Now.ToShortDateString(), DateTime.Now.ToLongTimeString(), newData);
// I need to see the WINDOW USERNAME by capturing who added a new comments
see the Environment.UserName
Console.WriteLine("UserName: {0}", System.Environment.UserName);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With