//joannah ..10/7/2015
        public void notifyKCCA(string prn)
        {
            DataTable MyDataTable;

            string KCCAVendorCode     = ConfigurationManager.AppSettings["KCCAVendorCode"];
            string KCCAVendorPassword = ConfigurationManager.AppSettings["KCCAVendorPassword"];
            string KCCASession_key    = ConfigurationManager.AppSettings["KCCASession_Key"];
            string KCCAHash           = ConfigurationManager.AppSettings["KCCAHash"];

            System.Net.ServicePointManager.CertificatePolicy = new MyPolicy();
            string HashKey = MD5Hash(KCCASession_key + KCCAVendorCode + KCCAVendorPassword + KCCAHash);

            KCCAGateway.BankPaymentService x = new KCCAGateway.BankPaymentService();
            //WebRequest.DefaultWebProxy = new WebProxy("http://" + ProxyIP + ":" + ProxyPort + "/", true);


            // ----------------------- Get Session Key --------------------------
            var Sessionkey = new object();

            try
            {
                Sessionkey = x.authenticate(KCCASession_key, KCCAVendorCode, KCCAVendorPassword, HashKey, "");
            }
            catch (Exception ex)
            {
            }

            string       KCCATransaction = "";
            string       skey            = "";
            string       BankStatus      = "C";
            DataTable    MyRst           = new DataTable();
            DataSet      ds     = new DataSet();
            DataTable    dt     = new DataTable();
            StringReader strRdr = new StringReader(Sessionkey.ToString());

            try
            {
                ds.ReadXml(strRdr);
            }
            catch (Exception ex)
            {
            }

            dt          = ds.Tables [0];
            skey        = dt.Rows[0][1].ToString();
            MyDataTable = Datamanagement.getKCCA(prn);
            DataRow dr = MyDataTable.Rows[0];


            string   MyRef       = dr["CustomerRefNumber"].ToString();
            string   coin        = dr["COIN"].ToString();
            string   DRAMOUNT    = dr["AmountPaid"].ToString();
            string   DRACCBRANCH = dr["UtilityBranch"].ToString();
            DateTime dt1         = Convert.ToDateTime(dr["ValueDate"]);
            string   TXNDATE     = String.Format("{0:MM/dd/yy}", dt1); //dr["ValueDate"].ToString(); //String.Format("{0:d}", dt);
            string   TnxId       = dr["ReferenceNumber"].ToString();
            int      Id          = Convert.ToInt32(dr["PaymentId"].ToString());


            //Create the Xml string
            var XmlMs     = new MemoryStream();
            var XmlTxtWtr = new XmlTextWriter(XmlMs, System.Text.Encoding.UTF8);

            XmlTxtWtr.Formatting  = Formatting.Indented;
            XmlTxtWtr.Indentation = 4;
            XmlTxtWtr.WriteStartDocument();
            XmlTxtWtr.WriteStartElement("transactionRecord");
            XmlTxtWtr.WriteElementString("PRN", MyRef);
            XmlTxtWtr.WriteElementString("COIN", coin);
            XmlTxtWtr.WriteElementString("amountPaid", DRAMOUNT);
            XmlTxtWtr.WriteElementString("paymentDate", TXNDATE);
            XmlTxtWtr.WriteElementString("valueDate", TXNDATE);
            XmlTxtWtr.WriteElementString("status", BankStatus);
            XmlTxtWtr.WriteElementString("bankBranchCode", DRACCBRANCH);
            XmlTxtWtr.WriteElementString("transactionID", TnxId);
            XmlTxtWtr.WriteEndElement();
            XmlTxtWtr.WriteEndDocument();
            XmlTxtWtr.Flush();

            var strmrdr = new StreamReader(XmlMs);

            XmlMs.Seek(0, SeekOrigin.Begin);



            KCCATransaction = strmrdr.ReadToEnd();
            // KCCATransaction = KCCATransaction.Replace("encoding=""utf-8""", "");   // .Replace("encoding=""utf-8""", "");


            HashKey = MD5Hash(skey + MyRef + KCCAHash);
            var KCCANotification = new KCCAGateway.BankPaymentService();
            var validateresponse = KCCANotification.transact(skey, MyRef, KCCATransaction, HashKey, TnxId);

            //DataTable MyRst1 = new DataTable();
            //MyRst1 = ds.Tables(0)
            //DataSet dts = new DataSet();
            strRdr = new StringReader(validateresponse);
            ds.ReadXml(strRdr);

            if (dt.Rows[0][1].ToString() != "0")
            {
                //var stat = validateresponse.
                var    strUpdate = "UPDATE KCCAPayments SET  KCCAStatus='Posted'  where PaymentId = Id";
                string query1    = "Insert into KCCAPaymentsArchive Select * from KCCAPayments where CustmerRefNumber = " + prn;

                string query2 = "Delete from KCCAPayments where CustmerRefNumber =" + prn;

                try
                {
                    using (
                        var conn =
                            new System.Data.SqlClient.SqlConnection(WebConfigurationManager.ConnectionStrings["Bridge"].ConnectionString))
                    {
                        conn.Open();
                        using (var cmd = new System.Data.SqlClient.SqlCommand(strUpdate, conn))
                        {
                            var df = cmd.ExecuteReader();
                        }
                    }
                }

                catch (Exception ex)
                {
                }

                //dat.DBAction("UPDATE KCCAPayments SET  Authorized=1,Status = 'Posted' ,KCCAStatus='Posted',AuthorizedBy = '" & Session("userName") & "' where PaymentID = " & MyPayID & "", DataManagement.DBActionType.Update)
            }
        }