1

Closed

UI: copy/paste the content of a selected Entry

description

In the case there is several people who are part of a case, e.g. 100 people who have been part of a human traffic, to allow :
 
the user:
  • goes to the right entry
  • clicks the copy button
     
    the system:
    -copy the row into a new one
    -opens a popup window showing the new ID created
Closed May 20, 2009 at 1:04 AM by Abdelkrim
I have added this inside controls/wucDVANewEntry.ascx.cs

protected void copyPasteARow(object sender, GridViewCommandEventArgs e)
{
  GridView gv = (GridView)sender;
  int index = int.Parse(e.CommandArgument.ToString());

  String id = (gv.DataKeys[index]["ID"]).ToString();

  MONTRASEC_test.Classes.A_NEWENTRY_DataContext dataContext = new MONTRASEC_test.Classes.A_NEWENTRY_DataContext();
  var newEntryToCopy =
  from b in dataContext.GetTable()
  where b.ID == long.Parse(id)
  select b;

  foreach (A_NEWENTRY_ c in newEntryToCopy)
  {
    A_NEWENTRY_ a_newentry = new A_NEWENTRY_();

    a_newentry.A_NEWENTRY_NEWENTRY_SOURCETYPE = c.A_NEWENTRY_NEWENTRY_SOURCETYPE;
...........
    dataContext.A_NEWENTRY_s.InsertOnSubmit(a_newentry);
    dataContext.SubmitChanges();

    System.Web.HttpContext.Current.Response.Write("");
    System.Web.HttpContext.Current.Response.Write("alert('New Entry created is " + a_newentry.ID.ToString() + "')");
    System.Web.HttpContext.Current.Response.Write("");
  }

comments