protected void btnRefund_Click( object sender , EventArgs e )
    {
        PayPalManager payPal = new PayPalManager();
        payPal.RefundTransaction( Request.QueryString[ "TransId" ] );

        Orders orders = new Orders();
        ProcessUpdateOrder updateOrder = new ProcessUpdateOrder();

        int refundedstatustype = 3;

        orders.OrderId = int.Parse( Request.QueryString["OrderId"] );
        orders.OrderStatusId = refundedstatustype;
        orders.ShipDate = ( DateTime ) SqlDateTime.Null;
        updateOrder.Orders = orders;

        try
        {
            updateOrder.Invoke();

            if (payPal.IsSubmissionSuccess)
            {
                EmailManager emailMngr = new EmailManager();
                EmailContents mailContents = new EmailContents();

                mailContents.To = Request.QueryString["Email"];
                mailContents.Bcc = EmailAddressConstants.Simon;
                mailContents.Subject = "Live Free Range Update - Order ID: " + Request.QueryString["OrderID"];
                mailContents.Body = "Your order has been refunded.  Please log into your account for details.";
                mailContents.FromEmailAddress = EmailAddressConstants.Contact;

                emailMngr.Send(mailContents);

                if (!emailMngr.IsSent)
                {
                    Response.Redirect("../ErrorPage.aspx");
                }
            }
        }
        catch(Exception ex)
        {
            Response.Redirect("../ErrorPage.aspx");
        }

        Response.Redirect("Orders.aspx");
    }
    protected void btnUpdate_Click( object sender , EventArgs e )
    {
        Orders orders = new Orders();
        ProcessUpdateOrder updateOrder = new ProcessUpdateOrder();

        orders.OrderId = int.Parse( Request.QueryString["OrderId"] );
        orders.OrderStatusId = int.Parse( ddlOrderStatus.SelectedItem.Value );
        orders.ShipDate = Convert.ToDateTime( txtShippedDate.Text );
        orders.TrackingNumber = txtTrackingNumber.Text;

        updateOrder.Orders = orders;

        try
        {
            updateOrder.Invoke();

            EmailManager emailMngr = new EmailManager();
            EmailContents mailContents = new EmailContents();

            mailContents.To = Request.QueryString[ "Email" ];
            mailContents.Subject = "Live Free Range Update - Order ID: " + Request.QueryString["OrderId"];
            mailContents.Body = "Your order has been updated.  Please log into your account for details.";
            mailContents.FromEmailAddress = "*****@*****.**";
            emailMngr.Send( mailContents );

            if ( !emailMngr.IsSent )
            {
                Response.Redirect("../ErrorPage.aspx");
            }
        }
        catch(Exception ex)
        {
            Response.Redirect( "../ErrorPage.aspx" );
        }

        Response.Redirect( "Orders.aspx" );
    }