Friday, September 27, 2013

Jquery to check password stength

--------------------jQuery Kentico----------------
 // Register jQuery and registration of script which shows password strength       
            ScriptHelper.RegisterJQuery(Page);
            ScriptHelper.RegisterScriptFile(Page, "~/CMSScripts/membership.js");

            sb.Append(";", GetString("passwordstrength.acceptable"), ";", GetString("passwordstrength.average"), ";", GetString("passwordstrength.strong"), ";", GetString("passwordstrength.excellent"));

            string regex = "''";
            if (!string.IsNullOrEmpty(RegularExpression))
            {
                regex = "/" + RegularExpression + "/";
            }

            // Javascript for calling js function on keyup of textbox
            string txtVar = "txtSearch_" + txtPassword.ClientID;
            string script =
                txtVar + " = $j('#" + txtPassword.ClientID + @"');
        if (" + txtVar + @" ) {                   
           " + txtVar + @".keyup(function(event){
                ShowStrength('" + txtPassword.ClientID + "', '" + MinLength + "', '" + PreferedLength + "', '" + MinNonAlphaNumChars + "', '"
                + PreferedNonAlphaNumChars + "', " + regex + ", '" + lblEvaluation.ClientID + "', '" + sb.ToString() + "', '" + ClassPrefix + "', '" + UsePasswordPolicy + "', '" + pnlPasswIndicator.ClientID + "', '" + UseStylesForStrenghtIndicator + @"');                              
            });                  
        }";

            ScriptHelper.RegisterStartupScript(this, typeof(string), "PasswordStrength_" + txtPassword.ClientID, ScriptHelper.GetScript(script));

Friday, September 6, 2013

Implementing EDI format to sent order info in ASP.NET

using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Text;
using System.Configuration;
using System.IO;
using System.Net;
using System.Net.Mail;
using ThisSite.Common;
using System.Web.Routing;
using ThisSite.BSLayer;


public partial class Admin_GenerateEdi : AdminPageBase
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void btnGenrateEdi_Click(object sender, EventArgs e)
    {
        Int64 lOrderId = Convert.ToInt64(txtEdi.Text.Trim());
        int BTcount = 0;
        Order pOrder = new Order(lOrderId);
        for (int i = 0; i < pOrder.pOBooks.Count; i++)
        {

            if ((pOrder.pOBooks[i].vcSource.ToString().ToUpper() == "BT") && BTcount == 0)
            {
                GnrtOrdForBakerEDI(pOrder);              
                BTcount = BTcount + 1;
            }
        }      
    }

    public  void GnrtOrdForBakerEDI(Order pOrder)
    {
        try
        {
            StringBuilder strBuilder = new StringBuilder();
            int startLine = 0;      
            string DlvryCountry = string.Empty;
            if (pOrder.lDlvryCoutry.HasValue)
            {
                Country pCountry = new Country(Convert.ToInt64(pOrder.lDlvryCoutry.Value));              
                DlvryCountry = pCountry.sISOAlpha2;
            }
            if (pOrder.lDlvryCoutry.HasValue)
            {
                Country pCountry = new Country(Convert.ToInt64(pOrder.lDlvryCoutry.Value));
                //DlvryCountry = pCountry.sCountryNm.Substring(0, 2).ToUpper(); ;
                DlvryCountry = pCountry.sISOAlpha2;
            }
            if (pOrder.lDlvryCoutry.HasValue)
            {
                Country pCountry = new Country(Convert.ToInt64(pOrder.lDlvryCoutry.Value));
                //DlvryCountry = pCountry.sCountryNm.Substring(0, 2).ToUpper(); ;
                DlvryCountry = pCountry.sISOAlpha2;
            }
            string sDlvryStateCode = string.Empty;
            if (!string.IsNullOrEmpty(pOrder.sDlvryStateCode))
            {
                sDlvryStateCode = pOrder.sDlvryStateCode.Substring(0, 2).ToUpper();
            }
            else
            {
                //if (DlvryCountry != "US")
                //{
                //    sDlvryStateCode = "ZZ";
                //}
                int Adrr4lng = 0, Adrr3lng = 0;
                if (!string.IsNullOrEmpty(Convert.ToString(pOrder.sDlvryAdress4)))
                {
                    Adrr4lng = pOrder.sDlvryAdress4.Length;
                }
                if (!string.IsNullOrEmpty(Convert.ToString(pOrder.sDlvryAdress3)))
                    Adrr3lng = pOrder.sDlvryAdress3.Length;

                if (Adrr3lng >= Adrr4lng)
                    sDlvryStateCode = pOrder.sDlvryAdress4;
                else
                    sDlvryStateCode = pOrder.sDlvryAdress3;
             
                if (DlvryCountry != "US")
                {
                    sDlvryStateCode = "ZZ";
                }
            }

            String Packingslip = "";

            if (DlvryCountry == "US")
            {
                Packingslip = "01130892";
            }
            else if (DlvryCountry == "AU")
            {
                Packingslip = "01130893";
            }
            else if (DlvryCountry == "CA")
            {
                Packingslip = "01130892";
            }
            else
            {
                Packingslip = "01130893";
            }
            //start of  Envelope Header
            // ISA*00*          *00*          *ZZ*01130893       *ZZ*7608772        *130822*0950*U*00401*348940000*1*T*>~
            strBuilder.Append("ISA");
            strBuilder.Append("*");
            strBuilder.Append("00");
            strBuilder.Append("*");
            strBuilder.Append("          ");
            strBuilder.Append("*");
            strBuilder.Append("00");
            strBuilder.Append("*");
            strBuilder.Append("          ");
            strBuilder.Append("*");
            strBuilder.Append("ZZ");
            strBuilder.Append("*");
            //strBuilder.Append("01130893");
            strBuilder.Append(Packingslip);          
            strBuilder.Append("       ");
            strBuilder.Append("*");
            strBuilder.Append("ZZ");
            strBuilder.Append("*");
            strBuilder.Append("7608772");
            strBuilder.Append("        ");
            strBuilder.Append("*");
            string orderdate = pOrder.dtOrderDate.ToString("yy'/'MM'/'dd");
            strBuilder.Append(orderdate.Replace("/", ""));
            strBuilder.Append("*");
            string ordertime = pOrder.dtOrderDate.ToString("hh:mm");
            strBuilder.Append(ordertime.Replace(":", ""));
            strBuilder.Append("*");
            strBuilder.Append("U");
            strBuilder.Append("*");
            strBuilder.Append("00401");
            strBuilder.Append("*");
            string Orderid = Convert.ToString(pOrder.lPOrderId);
            if (Orderid.Length >= 9)
            {
                strBuilder.Append(Orderid);
            }
            else
            {
                int count1, len = 0;
                len = Orderid.Length;
                count1 = 9 - len;
                strBuilder.Append(Orderid);
                for (int i = 1; i <= count1;i++ )                
                {
                    strBuilder.Append("0");
                }

            }            
            strBuilder.Append("*");
            strBuilder.Append("1");
            strBuilder.Append("*");
            strBuilder.Append("T");
            strBuilder.Append("*");
            strBuilder.Append(">");
            strBuilder.Append("~");
            strBuilder.Append("\r\n");

            //GS*PO*01130893*7608772*20130822*0950*348940001*X*004010~
            strBuilder.Append("GS");
            strBuilder.Append("*");
            strBuilder.Append("PO");
            strBuilder.Append("*");
           // strBuilder.Append("01130893");
            strBuilder.Append(Packingslip);          
            strBuilder.Append("*");
            strBuilder.Append("7608772");
            strBuilder.Append("*");
            string orderdate1 = pOrder.dtOrderDate.ToString("yyyy'/'MM'/'dd");
            strBuilder.Append(orderdate1.Replace("/", ""));
            strBuilder.Append("*");
            string ordertime1 = pOrder.dtOrderDate.ToString("hh:mm");
            strBuilder.Append(ordertime1.Replace(":", ""));
            strBuilder.Append("*");
            if (Orderid.Length >= 9)
            {
                strBuilder.Append(Orderid);
            }
            else
            {
                int count1, len = 0;
                len = Orderid.Length;
                count1 = 9 - len;
                strBuilder.Append(Orderid);
                for (int i = 1; i <= count1-1; i++)
                {
                    strBuilder.Append("0");
                }
                strBuilder.Append("1");
            }            
            strBuilder.Append("*");
            strBuilder.Append("X");
            strBuilder.Append("*");
            strBuilder.Append("004010");
            strBuilder.Append("~");
            strBuilder.Append("\r\n");
            //ST*850*348940002~
            strBuilder.Append("ST");
            strBuilder.Append("*");
            strBuilder.Append("850");
            strBuilder.Append("*");
            if (Orderid.Length >= 9)
            {
                strBuilder.Append(Orderid);
            }
            else
            {
                int count1, len = 0;
                len = Orderid.Length;
                count1 = 9 - len;
                strBuilder.Append(Orderid);
                for (int i = 1; i <= count1 - 1; i++)
                {
                    strBuilder.Append("0");
                }
                strBuilder.Append("2");
            }  
            strBuilder.Append("~");
            strBuilder.Append("\r\n");
            //the order info
            //BEG*00*DS*34894**20130822~
            strBuilder.Append("BEG");
            strBuilder.Append("*");
            strBuilder.Append("00");
            strBuilder.Append("*");
            strBuilder.Append("DS");
            strBuilder.Append("*");
            strBuilder.Append(pOrder.lPOrderId);
            strBuilder.Append("**");
            string orderdate2 = pOrder.dtOrderDate.ToString("yyyy'/'MM'/'dd");
            strBuilder.Append(orderdate2.Replace("/", ""));
            strBuilder.Append("~");
            strBuilder.Append("\r\n");

            //// carrier details
            //// TD5***ULS~
            //strBuilder.Append("TD5");
            //strBuilder.Append("*");
            //strBuilder.Append("*");
            //strBuilder.Append("*");
            //strBuilder.Append("ULS");
            //strBuilder.Append("~");
            //strBuilder.Append("\r\n");
         
            //Address
          // N1*ST*Jamie Thomas~
          // N3*335 Bourke Street Mall~
          // N4*Melbourne*Vic*3000*AU~

            strBuilder.Append("N1");
            strBuilder.Append("*");
            strBuilder.Append("ST");
            strBuilder.Append("*");
            strBuilder.Append(!string.IsNullOrEmpty(pOrder.sDlvryName) ? pOrder.sDlvryName : "");
            strBuilder.Append("~");
            strBuilder.Append("\r\n");
            strBuilder.Append("N3");
            strBuilder.Append("*");
            strBuilder.Append(!string.IsNullOrEmpty(pOrder.sDlvryAdress1) ? pOrder.sDlvryAdress1.Replace("/", "-").TrimEnd() : "");
            strBuilder.Append(!string.IsNullOrEmpty(pOrder.sDlvryAdress2) ? pOrder.sDlvryAdress2.Replace("/", "-").TrimEnd() : "");                      
            strBuilder.Append("~");
            strBuilder.Append("\r\n");
            strBuilder.Append("N4");
            strBuilder.Append("*");
            strBuilder.Append(!string.IsNullOrEmpty(pOrder.sDlvryAdress3) ? pOrder.sDlvryAdress3.TrimEnd() : "");
            strBuilder.Append("*");
            strBuilder.Append(!string.IsNullOrEmpty(pOrder.sDlvryAdress4) ? pOrder.sDlvryAdress4.TrimEnd() : "");
            strBuilder.Append("*");
            strBuilder.Append(!string.IsNullOrEmpty(pOrder.sDlvryPostalCode) ? pOrder.sDlvryPostalCode : "");
            strBuilder.Append("*");
            strBuilder.Append(!string.IsNullOrEmpty(DlvryCountry) ? DlvryCountry : "");
            strBuilder.Append("~");
            strBuilder.Append("\r\n");

            // ISBN No
            pOrder.ordSuppliervcSource = "BT";
            int count = 0, totalqty = 0;
            foreach (Order.POBooks pBook in pOrder.pOBooksOrder)
            {
                if (pBook.vcSource.ToString().ToUpper() == "BT")
                {
                    string sAmount = string.Empty;
                    sAmount = string.Format("{0:0.00}", Math.Round(pBook.decTotalPrice, 4));
                    startLine += 1;
                    strBuilder.Append("PO1");
                    strBuilder.Append("*");
                    strBuilder.Append(startLine.ToString("d2"));
                    strBuilder.Append("*");
                    strBuilder.Append(pBook.iBookQty.ToString());
                    strBuilder.Append("*");
                    strBuilder.Append("EA");
                    strBuilder.Append("*");
                    strBuilder.Append(sAmount.Trim());
                    strBuilder.Append("*");
                    strBuilder.Append("PE");
                    strBuilder.Append("*");
                    strBuilder.Append("IB");
                    strBuilder.Append("*");
                    strBuilder.Append(pBook.sIsbn);
                    strBuilder.Append("~");
                    strBuilder.Append("\r\n");
                    count++;
                    totalqty = totalqty + pBook.iBookQty;
                }

            }
            strBuilder.Append("CTT");
            strBuilder.Append("*");
            strBuilder.Append(count);
            strBuilder.Append("*");
            strBuilder.Append(totalqty);
            strBuilder.Append("~");
            strBuilder.Append("\r\n");
            strBuilder.Append("SE");
            strBuilder.Append("*");
          //  strBuilder.Append("8");
            int segment = 7 + count;
            strBuilder.Append(segment);
            strBuilder.Append("*");
            if (Orderid.Length >= 9)
            {
                strBuilder.Append(Orderid);
            }
            else
            {
                int count1, len = 0;
                len = Orderid.Length;
                count1 = 9 - len;
                strBuilder.Append(Orderid);
                for (int i = 1; i <= count1 - 1; i++)
                {
                    strBuilder.Append("0");
                }
                strBuilder.Append("2");
            }  
            strBuilder.Append("~");
            strBuilder.Append("\r\n");
            strBuilder.Append("GE");
            strBuilder.Append("*");
            strBuilder.Append(count);
            strBuilder.Append("*");
            if (Orderid.Length >= 9)
            {
                strBuilder.Append(Orderid);
            }
            else
            {
                int count1, len = 0;
                len = Orderid.Length;
                count1 = 9 - len;
                strBuilder.Append(Orderid);
                for (int i = 1; i <= count1 - 1; i++)
                {
                    strBuilder.Append("0");
                }
                strBuilder.Append("1");
            }    
            strBuilder.Append("~");
            strBuilder.Append("\r\n");
            //         IEA*1*000000118~
            strBuilder.Append("IEA");
            strBuilder.Append("*");
            strBuilder.Append(count);
            strBuilder.Append("*");
            if (Orderid.Length >= 9)
            {
                strBuilder.Append(Orderid);
            }
            else
            {
                int count1, len = 0;
                len = Orderid.Length;
                count1 = 9 - len;
                strBuilder.Append(Orderid);
                for (int i = 1; i <= count1 ; i++)
                {
                    strBuilder.Append("0");
                }
             
            }    
            strBuilder.Append("~");



            SaveOrderBakerFile(strBuilder.ToString(), pOrder.lPOrderId.ToString(), ".DONE");
            txtEdi.Text = "";
            string strPath = HttpContext.Current.Server.MapPath(Resources.Paths.BTOrderFilePath + pOrder.lPOrderId.ToString() + ".DONE");
            strPath = strPath.ToLower();
            strPath = strPath.Replace("\\admin", "");
            strPath = strPath.Replace("done", "DONE");
            strPath = strPath.Replace("ord", "ORD");          
            //redirect to your physical location
            FileStream fs = new FileStream(strPath, FileMode.Open);
            byte[] bytes = new byte[(int)fs.Length];
            fs.Read(bytes, 0, bytes.Length);
            fs.Close();
            //HttpResponse Response = HttpContext.Current.Response;
            Response.ContentType = "application/octet-stream";
            Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(strPath.Split('\\')[strPath.Split('\\').Length - 1], System.Text.Encoding.UTF8));
            Response.BinaryWrite(bytes);
            Response.Flush();
            Response.End();
         
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }

    #region Save Baker File in BTOrder file
    public  void SaveOrderBakerFile(string pOrder, string pFileName, string FileSource)
    {
        try
        {
            string strPath = HttpContext.Current.Server.MapPath(Resources.Paths.BTOrderFilePath + pFileName + FileSource);
            strPath = strPath.ToLower();
            strPath = strPath.Replace("\\admin", "");
            strPath = strPath.Replace("done", "DONE");
            strPath = strPath.Replace("ord", "ORD");
            using (System.IO.StreamWriter SW = new System.IO.StreamWriter(strPath))
            {
                SW.WriteLine(pOrder);
                SW.Close();
               
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
    #endregion
}

Tuesday, September 3, 2013

Implementing PayPal on ASP.net website

JUST  FOLLOW THESE THREE STEPS :
set : assign all credential , qty price
get  :get token id , paypalid

do capture :with the hep of paypalid do final payment

Step 1:  In Checkout Page :call PayPal method

   protected void lnkPaypal_Click(object sender, EventArgs e)
    {
            //PaymentThrougPaypal();
            try
            {
                //UpdatePackageOrder();
                PaymentThrougPaypal();
            }
            catch (Exception ex)
            {
                ErrorLog error = new ErrorLog();
                error.lUsrId = Test.BusinessLayer.BusinessAccessLayer.User.Current.lUsrId;
                error.sClientIP = Request.UserHostAddress;
                error.sAbsoluteUri = Request.Url.AbsoluteUri;
                error.sErrMsg = ex.Message;
                error.sStackTrace = ex.Message;
                error.Create();
                //if (ex.Message != "Thread was being aborted.")
                //RollBackUpdatePackageOrder();
            }
    }
    #region Paypal integration
    private void PaymentThrougPaypal()
    {
      //  Session["payment_amt"] = 1000;
        //NVPAPICaller test = new NVPAPICaller();
        string retMsg = "";
        string token = "";
        string sLogo = "http://www.test.com/App_Themes/Default/images/logo1.jpg";
        Test.Paypal.PaypalIntegration.PaypalIntegration paypalRequest = new Test.Paypal.PaypalIntegration.PaypalIntegration();
        paypalRequest.OrderID = OrderId;
        //paypalRequest.ReqConfirmShipping = "1";
        paypalRequest.logo = sLogo;

        Order pOrder = new Order(OrderId);
            if (pOrder.decNetAmount != null)
            {
               // Math.Round((decimal)order.decNetAmount, 2).ToString();
               string host = "www.paypal.com";//"www.paypal.com";//
               // string host = "www.sandbox.paypal.com";
                //string amt = pOrder.decNetAmount.ToString();
               decimal amt1 =Convert.ToDecimal(pOrder.decNetAmount);
               string amt = Math.Round((decimal)amt1, 2).ToString();
              // string amt = Math.Round((decimal)amt1, 2).ToString() + ((pOrder.decPackagePrice.HasValue) ? pOrder.decPackagePrice.Value : 0);
                Test.Paypal.Paypal.Paypal eSet = new Test.Paypal.Paypal.Paypal();
                Test.Paypal.PaypalIntegration.PaypalIntegration _paypalRequest = new Test.Paypal.PaypalIntegration.PaypalIntegration();
               token = eSet.ECSetExpressCheckoutCode(amt, "http://www.test.com/paydetails.aspx", "http://www.test.com/Checkout.aspx", com.paypal.soap.api.PaymentActionCodeType.Order, com.paypal.soap.api.CurrencyCodeType.AUD, paypalRequest, Convert.ToInt64(pOrder.lPOrderId));
 Response.Redirect("https://" + host + "/cgi-bin/webscr?cmd=_express-checkout" + "&token=" + token);
            }
       
    }
    #endregion


Step 2: In Separate Page do all coding to make transactions, this page will run in background
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using com.paypal.sdk.services;
using com.paypal.soap.api;
using com.paypal.sdk.profiles;
using System.Data;
using System.Data.SqlClient;
using System.Text;
using System.Web.Routing;
using GenerateCodeSOAP;
using System.IO;
using System.Collections;
using System.Net;
using System.Net.Mail;
using System.Xml;
using Test.Common;
using Test.Paypal.Paypal;
using Test.BusinessLayer.BusinessAccessLayer;
using Test.BusinessLayer.DataAccessLayer;


public partial class paydetails : FrontPageBase
{
    string token = "";
    string payerId = "";
    string amt = "";
    string InvoiceId = "";
    string cardHolderNm = "";
    string bilAdd = "";
    string traId = "";
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.QueryString["token"] != null)
        {
            GetExpressCheckoutDetailsResponseType resp = new GetExpressCheckoutDetailsResponseType();
            Test.Paypal.ECGetExpressCheckout ecGet = new Test.Paypal.ECGetExpressCheckout();
            resp = ecGet.ECGetExpressCheckoutCode(Request.QueryString["token"].ToString());
            //Response.Write(resp);
            payerId = resp.GetExpressCheckoutDetailsResponseDetails.PayerInfo.PayerID.ToString();
            amt = resp.GetExpressCheckoutDetailsResponseDetails.PaymentDetails.OrderTotal.Value;
            token = resp.GetExpressCheckoutDetailsResponseDetails.Token.ToString();
            InvoiceId = resp.GetExpressCheckoutDetailsResponseDetails.InvoiceID.ToString();
            cardHolderNm = (!string.IsNullOrEmpty(resp.GetExpressCheckoutDetailsResponseDetails.PayerInfo.PayerName.FirstName) ? resp.GetExpressCheckoutDetailsResponseDetails.PayerInfo.PayerName.FirstName : string.Empty)
                + "  " + (!string.IsNullOrEmpty(resp.GetExpressCheckoutDetailsResponseDetails.PayerInfo.PayerName.LastName) ? resp.GetExpressCheckoutDetailsResponseDetails.PayerInfo.PayerName.LastName : string.Empty);
            bilAdd = (!string.IsNullOrEmpty(resp.GetExpressCheckoutDetailsResponseDetails.PayerInfo.Address.CityName.ToString()) ? resp.GetExpressCheckoutDetailsResponseDetails.PayerInfo.Address.CityName.ToString() : string.Empty)
            + "<br/>" + (!string.IsNullOrEmpty(resp.GetExpressCheckoutDetailsResponseDetails.PayerInfo.Address.Street1.ToString()) ? resp.GetExpressCheckoutDetailsResponseDetails.PayerInfo.Address.Street1.ToString() : string.Empty)
            + "<br/>" + (!string.IsNullOrEmpty(resp.GetExpressCheckoutDetailsResponseDetails.PayerInfo.Address.Street2.ToString()) ? resp.GetExpressCheckoutDetailsResponseDetails.PayerInfo.Address.Street2.ToString() : string.Empty)
            + "<br/>" + (!string.IsNullOrEmpty(resp.GetExpressCheckoutDetailsResponseDetails.PayerInfo.Address.CountryName.ToString()) ? resp.GetExpressCheckoutDetailsResponseDetails.PayerInfo.Address.CountryName.ToString() : string.Empty);

        }

        if (token != "" && payerId != "")
        {
            DoExpressCheckoutPaymentResponseType ecDoPayment = new DoExpressCheckoutPaymentResponseType();
            Test.Paypal.ECDoExpressCheckout doPayment = new Test.Paypal.ECDoExpressCheckout();
            ecDoPayment = doPayment.ECDoExpressCheckoutCode(token, payerId, amt, com.paypal.soap.api.PaymentActionCodeType.Order, com.paypal.soap.api.CurrencyCodeType.AUD);
            string ack = ecDoPayment.Ack.ToString();
            string authorizationId = ecDoPayment.DoExpressCheckoutPaymentResponseDetails.PaymentInfo.TransactionID;
            string amtValue = ecDoPayment.DoExpressCheckoutPaymentResponseDetails.PaymentInfo.GrossAmount.Value;

            com.paypal.soap.api.CurrencyCodeType amtCurrencyCodeType = com.paypal.soap.api.CurrencyCodeType.AUD;
            Test.Paypal.DoCapture doCapt = new Test.Paypal.DoCapture();
            //Response.Write(ack);
            DoCaptureResponseType doCaptrDetails = new DoCaptureResponseType();
            //  doCaptrDetails = doCapt.DoCaptureCode(authorizationId, note, amtValue, amtCurrencyCodeType, InvoiceId);
            doCaptrDetails = doCapt.DoCaptureCode(authorizationId, amtValue, amtCurrencyCodeType, InvoiceId);
            string captrAck = doCaptrDetails.Ack.ToString();
            //Response.Write(captrAck);
            // Response.Write(ack + "//" + InvoiceId + "//" + captrAck);
            // Response.End();
            if ((ack.ToLower() == "success") && (!String.IsNullOrEmpty(InvoiceId)) && (captrAck.ToLower() == "success"))
            {
                try
                {

                    Order pOrder = new Order(Convert.ToInt64(InvoiceId));
                    Outlet outlet = new Outlet(pOrder.lOutletId);
                    pOrder.orderStatus = Order.OrderStatus.Placed;
                    pOrder.pymtStatus = Order.PaymentStatus.Made;
                    pOrder.sTransactionId = doCaptrDetails.DoCaptureResponseDetails.PaymentInfo.TransactionID.ToString();
                    Response.Write(pOrder.sTransactionId);
                    traId = doCaptrDetails.DoCaptureResponseDetails.PaymentInfo.TransactionID.ToString();
                    pOrder.sPaymentType = "Paypal";
                    pOrder.sGatewaynm = "Paypal";
                    string paypal="paypal";
                    Invoice.GenerateInvoice_New(pOrder,paypal);
                    Invoice.GenerateInvoice_Customer(pOrder,paypal);
                    pOrder.Update();

                    #region Email to Customer with invoice attachment

                    DataTable dtOutletChainColContTemplVal;
                    CMS cms;
                    ContentTemplate conTemp;

                    dtOutletChainColContTemplVal = Test.BusinessLayer.DataAccessLayer.DBChain.PopulateOutletChainsColumnValue(outlet.lOutletId, "TaxInvEmlCustId");

                    if (dtOutletChainColContTemplVal != null)
                    {
                        conTemp = new ContentTemplate(Int16.Parse(dtOutletChainColContTemplVal.Rows[0][0].ToString()));
                        cms = new CMS(Test.BusinessLayer.BusinessAccessLayer.Site.Current.lSiteId, conTemp.shContentTempId);
                    }
                    else
                    {
                        conTemp = new ContentTemplate(Resources.ContentName.mailorderandtaxinvoice);
                        cms = new CMS(Test.BusinessLayer.BusinessAccessLayer.Site.Current.lSiteId, conTemp.shContentTempId);
                    }

  InsertPapalInfo();

Response.Redirect("http://test.com/thank-you-for-your-order.aspx");
}

catch (Exception ex)
                {
                   
                    Response.Write("catch");
                    throw;

                }

            }
            else
            {
                Response.Redirect("http://test.com/Checkout.aspx");
            }

else
        {
            Response.Redirect("http://test.com/Checkout.aspx");
        }



#region method to update Paypal user info
    public void InsertPapalInfo()
    {

        test.BusinessLayer.DataAccessLayer.DBPaypalInfo.InsertPaypalInfo(Convert.ToInt64(InvoiceId), cardHolderNm, bilAdd, traId);

    }
    #endregion

Step 3 :Configure all .cs files

a)      DoCapture.cs
b)      ECDoExpressCheckout.cs
c)       ECGetExpressCheckout.cs
d)      ECSetExpressCheckout.cs
e)      Paypal.cs
f)       PaypalIntegration.cs
And Payflow_dotNET.dll to bin now paypal will work for you thanks !!!!