protected void CustomerGridViewSelectedIndexChanged(object sender, EventArgs e)
 {
     if (CustomerGridView.SelectedDataKey == null) return;
     var selected = (int) CustomerGridView.SelectedDataKey.Value;
     //Archive the refund
     //After you did it manually through Paypal
     using (var context = new SidejobEntities())
     {
         var current = (from c in context.RefundCustomerSuccessfulPDTs
                        where c.PDTID == selected
                        select c).FirstOrDefault();
         if (current != null)
         {
             var archive = new ArchivedRefundCustomerSuccessfulPDT
                               {
                                   PDTID = current.PDTID,
                                   GrossTotal = current.GrossTotal,
                                   Invoice = current.Invoice,
                                   PaymentStatus = current.PaymentStatus,
                                   FirstName = current.FirstName,
                                   LastName = current.LastName,
                                   PaymentFee = current.PaymentFee,
                                   BusinessEmail = current.BusinessEmail,
                                   TxToken = current.TxToken,
                                   ReceiverEmail = current.ReceiverEmail,
                                   ItemName = current.ItemName,
                                   TransactionId = current.TransactionId,
                                   Custom = current.Custom,
                                   subscriberId = current.subscriberId,
                                   CustomerID = current.CustomerID,
                                   ProjectID = current.ProjectID
                               };
             context.AddToArchivedRefundCustomerSuccessfulPDTs(archive);
             context.SaveChanges();
         }
     }
 }
 protected void ArchiveRefund(int pdtid)
 {
     using (var context = new SidejobEntities())
     {
         var currentrefund = (from c in context.RefundCustomerSuccessfulPDTs
                              where c.PDTID == pdtid
                              select c).FirstOrDefault();
         if(currentrefund != null)
         {
             var archivedrefund = new ArchivedRefundCustomerSuccessfulPDT
                                      {
                                          PDTID = currentrefund.PDTID,
                                          GrossTotal = currentrefund.GrossTotal,
                                          Invoice = currentrefund.Invoice,
                                          PaymentStatus = currentrefund.PaymentStatus,
                                          FirstName = currentrefund.FirstName,
                                          LastName = currentrefund.LastName,
                                          PaymentFee = currentrefund.PaymentFee,
                                          BusinessEmail = currentrefund.BusinessEmail,
                                          TxToken = currentrefund.TxToken,
                                          ReceiverEmail = currentrefund.ReceiverEmail,
                                          ItemName = currentrefund.ItemName,
                                          CurrencyCode = currentrefund.CurrencyCode,
                                          TransactionId = currentrefund.TransactionId,
                                          Custom = currentrefund.Custom,
                                          subscriberId = currentrefund.subscriberId,
                                          CustomerID = currentrefund.CustomerID,
                                          ProjectID = currentrefund.ProjectID
                                      };
             context.AddToArchivedRefundCustomerSuccessfulPDTs(archivedrefund);
             context.DeleteObject(currentrefund);
             context.SaveChanges();
             Response.Redirect(Context.Request.Url.ToString());
         }
     }
 }