using System;
using System.Collections.Generic;
using System.Data.Common;
using System.Linq;

public partial class ManageFavoritesWithUserProperty : System.Web.UI.Page
{
  protected void SqlDataSource1_Selecting(object sender, System.Web.UI.WebControls.SqlDataSourceSelectingEventArgs e)
  {
    AssignUserName(e.Command.Parameters);
  }

  protected void SqlDataSource1_Inserting(object sender, System.Web.UI.WebControls.SqlDataSourceCommandEventArgs e)
  {
    AssignUserName(e.Command.Parameters);
  }

  protected void SqlDataSource1_Updating(object sender, System.Web.UI.WebControls.SqlDataSourceCommandEventArgs e)
  {
    AssignUserName(e.Command.Parameters);
  }

  protected void SqlDataSource1_Deleting(object sender, System.Web.UI.WebControls.SqlDataSourceCommandEventArgs e)
  {
    AssignUserName(e.Command.Parameters);
  }

  private void AssignUserName(DbParameterCollection parameters)
  {
    parameters["@UserName"].Value = User.Identity.Name;
  }
}