private void ReadUninstallScriptAndDLLFiles(XmlDocument doc, string paymentGatewayFolderPath, PaymentGatewayInstaller installerClass)
 {
     XmlElement root = doc.DocumentElement;
     if (!String.IsNullOrEmpty(root.ToString()))
     {
         ArrayList dllFiles = new ArrayList();
         string _unistallScriptFile = string.Empty;
         XmlNodeList xnFileList = doc.SelectNodes("sageframe/folders/folder/files/file");
         if (xnFileList.Count != 0)
         {
             foreach (XmlNode xn in xnFileList)
             {
                 string _fileName = xn["name"].InnerXml;
                 try
                 {
                     #region CheckAlldllFiles
                     if (!String.IsNullOrEmpty(_fileName) && _fileName.Contains(".dll"))
                     {
                         dllFiles.Add(_fileName);
                     }
                     #endregion
                     #region ReadUninstall SQL FileName
                     if (!String.IsNullOrEmpty(_fileName) && _fileName.Contains("Uninstall.SqlDataProvider"))
                     {
                         _unistallScriptFile = _fileName;
                     }
                     #endregion
                 }
                 catch (Exception ex)
                 {
                     Exceptions = ex.Message;
                 }
             }
             if (_unistallScriptFile != "")
             {
                 RunUninstallScript(_unistallScriptFile, paymentGatewayFolderPath, installerClass);
             }
             DeleteAllDllsFromBin(dllFiles, paymentGatewayFolderPath);
         }
     }
 }
 private void RunUninstallScript(string _unistallScriptFile, string paymentGatewayFolderPath, PaymentGatewayInstaller installerClass)
 {
     Exceptions = installerClass.ReadSQLFile(paymentGatewayFolderPath, _unistallScriptFile);
 }
    private void UninstallPaymentGateway(PaymentGateWayModuleInfo paymentGateWay, bool deleteModuleFolder, int gatewayID)
    {
        PaymentGatewayInstaller installerClass = new PaymentGatewayInstaller();
        string path = HttpContext.Current.Server.MapPath("~/");

        //checked if directory exist for current Payment Gateway foldername
        string paymentGatewayFolderPath = paymentGateWay.InstalledFolderPath;
        if (!string.IsNullOrEmpty(paymentGatewayFolderPath))
        {
            if (Directory.Exists(paymentGatewayFolderPath))
            {
                //check for valid .sfe file exist or not
                XmlDocument doc = new XmlDocument();
                doc.Load(paymentGatewayFolderPath + '\\' + paymentGateWay.ManifestFile);

                try
                {
                    if (paymentGateWay.PaymentGatewayTypeID > 0)
                    {
                        //Run script  
                        ReadUninstallScriptAndDLLFiles(doc, paymentGatewayFolderPath, installerClass);
                        //Rollback PaymentGatewayTypeID
                        //installerClass.PaymentGatewayRollBack(paymentGateWay.PaymentGatewayTypeID, GetPortalID, GetStoreID);
                        if (deleteModuleFolder == true)
                        {
                            //Delete Payment GateWay's Original Folder
                            installerClass.DeleteTempDirectory(paymentGateWay.InstalledFolderPath);
                        }
                        installhelp.InstallPackage(paymentModule, gatewayID);
                    }
                }
                catch (Exception ex)
                {
                    Exceptions = ex.Message;
                }
            }
            else
            {
                ShowMessage(SageMessageTitle.Exception.ToString(), SageMessage.GetSageModuleLocalMessageByVertualPath("Modules/ASPXCommerce/ASPXPaymentGateWayManagement/ModuleLocalText", "PaymentGatewayFolderDoesnotExist"), "", SageMessageType.Error);
            }
        }
    }