Example #1
0
 protected void ProfessionalGridViewSelectedIndexChanged(object sender, EventArgs e)
 {
     if (ProfessionalGridView.SelectedDataKey == null) return;
     var selected = (int) ProfessionalGridView.SelectedDataKey.Value;
     //Archive the refund
     //After you did it manually through Paypal
     using (var context = new SidejobEntities())
     {
         var current = (from c in context.RefundProfessionalSuccessfulPDTs
                        where c.PDTID == selected
                        select c).FirstOrDefault();
         if (current != null)
         {
             var archive = new ArchivedRefundProfessionalSuccessfulPDT
                               {
                                   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,
                                   ProID = current.ProID,
                                   ProjectID = current.ProjectID
                               };
             context.AddToArchivedRefundProfessionalSuccessfulPDTs(archive);
             context.SaveChanges();
         }
     }
 }
 protected void ArchiveRefund(int pdtid)
 {
     using (var context = new SidejobEntities())
     {
         var currentrefund = (from c in context.RefundProfessionalSuccessfulPDTs
                              where c.PDTID == pdtid
                              select c).FirstOrDefault();
         if (currentrefund != null)
         {
             var archivedrefund = new ArchivedRefundProfessionalSuccessfulPDT
             {
                 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,
                 ProID = currentrefund.ProID,
                 ProjectID = currentrefund.ProjectID
             };
             context.AddToArchivedRefundProfessionalSuccessfulPDTs(archivedrefund);
             context.DeleteObject(currentrefund);
             context.SaveChanges();
             Response.Redirect(Context.Request.Url.ToString());
         }
     }
 }