当前位置: 首页>>代码示例>>C#>>正文


C# Application.LoadPackage方法代码示例

本文整理汇总了C#中Application.LoadPackage方法的典型用法代码示例。如果您正苦于以下问题:C# Application.LoadPackage方法的具体用法?C# Application.LoadPackage怎么用?C# Application.LoadPackage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Application的用法示例。


在下文中一共展示了Application.LoadPackage方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CallDTS

    public static bool CallDTS(string uploadId)
    {
        string dtsFtpPath = ConfigurationManager.AppSettings["DTSFtpPath"].ToString(); ;
        if (!dtsFtpPath.EndsWith("\\"))
        {
            dtsFtpPath = dtsFtpPath + "\\";
        }
        string dnDtsPath = dtsFtpPath + "IMES_PAK_POData_UploadDelivery.dtsx";
        string palletDtsPath = dtsFtpPath + "IMES_PAK_POData_UploadPallet.dtsx";
        Application uploadDTSApp = new Application();
        Package dnPackage = uploadDTSApp.LoadPackage(dnDtsPath, null, true);
        Package palletPackage = uploadDTSApp.LoadPackage(palletDtsPath, null, true);
        //set Variables


        IPOData currentPODataService = ServiceAgent.getInstance().GetObjectByName<IPOData>(WebConstant.PODataObject);
        string pakConnectStr = currentPODataService.GetPAKConnectionString() + ";Provider=SQLNCLI10.1;Auto Translate=False;";
        //set datasource Connections
        dnPackage.Variables["UploadId"].Value = uploadId;
        dnPackage.Connections["IMES_PAK"].ConnectionString = pakConnectStr;
        dnPackage.Connections["DNFile"].ConnectionString = dtsFtpPath + uploadId + "COMN.TXT";

        palletPackage.Variables["UploadId"].Value = uploadId;
        palletPackage.Connections["IMES_PAK"].ConnectionString = pakConnectStr;
        palletPackage.Connections["PalletFile"].ConnectionString = dtsFtpPath + uploadId + "PALTNO.TXT";

        //Execute
        DTSExecResult dnResult = dnPackage.Execute();
        if (dnResult.Equals(DTSExecResult.Success))
        {
            DTSExecResult palletResult = palletPackage.Execute();
            if (palletResult.Equals(DTSExecResult.Success))
            {
                System.IO.File.Delete(dtsFtpPath + uploadId + "COMN.TXT");
                System.IO.File.Delete(dtsFtpPath + uploadId + "PALTNO.TXT");
                return true;
            }
            else
            {
                System.IO.File.Delete(dtsFtpPath + uploadId + "COMN.TXT");
                System.IO.File.Delete(dtsFtpPath + uploadId + "PALTNO.TXT");
                throw new Exception(palletPackage.Errors[0].Description);
            }
        }
        else
        {
            System.IO.File.Delete(dtsFtpPath + uploadId + "COMN.TXT");
            System.IO.File.Delete(dtsFtpPath + uploadId + "PALTNO.TXT");
            throw new Exception(dnPackage.Errors[0].Description);
        }
        return false;
    }
开发者ID:wra222,项目名称:testgit,代码行数:52,代码来源:PODataUpload.cs

示例2: ImportDataFile

        public void ImportDataFile(ClassDataFile file)
        {
            try
            {
                string newFileLoc = this.UpdateTemplate(file);
                Application app = new Application();
                Package package = null;
                //Load the SSIS Package which will be executed
                package = app.LoadPackage(newFileLoc, null);
                //Pass the varibles into SSIS Package

                //Execute the SSIS Package and store the Execution Result
                Microsoft.SqlServer.Dts.Runtime.DTSExecResult results = package.Execute();
                //Check the results for Failure and Success
                if (results == Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure)
                {
                    string err = "";
                    foreach (Microsoft.SqlServer.Dts.Runtime.DtsError local_DtsError in package.Errors)
                    {
                        string error = local_DtsError.Description.ToString();
                        err = err + error;
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
开发者ID:RvdMerweJHB,项目名称:Shampoo-Meter,代码行数:29,代码来源:ClassSSISPackage.cs

示例3: SetupMethods

        public void SetupMethods()
        {
            isIntegrationServiceStarted = CheckIfIntegrationServiceStarted();

            if (!isIntegrationServiceStarted)
                return;

            //Build the fullpath for the file to read
            Directory.CreateDirectory("ETL");
            var pkg = DiskOnFile.CreatePhysicalFile(@"Etl\Sample.dtsx", "NBi.Testing.Integration.SqlServer.IntegrationService.Resources.Sample.dtsx");

            try
            {
                //Move the Etl to SQL Server Integration Services
                Application app = new Application();
                Package p = app.LoadPackage(pkg, null);

                // Save the package to the SQL Server msdb folder, which is
                // also the MSDB folder in the Integration Services service, or as a row in the
                //sysssispackages table.
                app.SaveToSqlServerAs(p, null, "nbi\\nbi-sample", ConnectionStringReader.GetIntegrationServerDatabase(), null, null);
            }
            catch (Exception ex)
            {
                isIntegrationServiceStarted = false;
                IgnoreMessage=string.Format("Test fixture 'EtlDtsWindowsRunnerTest' is skipped: {0}", ex.Message);
            }
        }
开发者ID:Waltervondehans,项目名称:NBi,代码行数:28,代码来源:EtlDtsWindowsRunnerTest.cs

示例4: TestBasicFeature

 public void TestBasicFeature()
 {
     var application = new Application();
     var protectionLevelProcessor = new ProtectionLevelProcessor();
     foreach (var dtsFile in FileUtils.GetDTSFileList("d:\\dev\\projects\\ssis-dev"))
     {
         Package package = application.LoadPackage(dtsFile, null);
         Trace.WriteLine(protectionLevelProcessor.GetProtectionLevel(package));
     }
 }
开发者ID:guoliang-dev,项目名称:SSISHelper,代码行数:10,代码来源:FeatureTest.cs

示例5: Load

        protected override Package Load(IEtl etl, Application app)
        {
            var packageName = etl.Path + etl.Name;
            if (!packageName.ToLower().EndsWith(".dtsx"))
                packageName += ".dtsx";

            var events = new PackageEvents();
            var package = app.LoadPackage(packageName, events);
            return package;
        }
开发者ID:zyh329,项目名称:nbi,代码行数:10,代码来源:EtlFileRunner.cs

示例6: Ekstrak

        public void Ekstrak()
        {
            string pkgLocation;
            Package pkg;
            Application app;
            DTSExecResult pkgResults;

            pkgLocation = @"D:\github\DW_BAP_DANNU\BAPPEDADW\BAPPEDADW\ETL\Package.dtsx";
            app = new Application();
            pkg = app.LoadPackage(pkgLocation, null);
            pkgResults = pkg.Execute();
           
        }
开发者ID:handydannu,项目名称:DW_FINAL,代码行数:13,代码来源:ProsesETL.cs

示例7: Test1A

        public static void Test1A()
        {
            //lokasi file dtsx nya
            string pkg = @"D:\12023227\Data\DORA\Patch\Patch\DORA_SSIS\DORA_BankWide\00_BankWide_MasterPackage.dtsx";

            Application app = new Application();
            Package p = app.LoadPackage(pkg, null);

            // Now that the package is loaded, we can query on
            // its properties.
            int n = p.Configurations.Count;
            DtsProperty p2 = p.Properties["VersionGUID"];
            DTSProtectionLevel pl = p.ProtectionLevel;

            Console.WriteLine("Number of configurations = " + n.ToString());
            Console.WriteLine("VersionGUID = " + (string)p2.GetValue(p));
            Console.WriteLine("ProtectionLevel = " + pl.ToString());
            Console.Read();
        }
开发者ID:ismailmu,项目名称:SSISGen,代码行数:19,代码来源:Test1.cs

示例8: Learn

        public void Learn()
        {
            string packageLocation = Path.Combine(Path.Combine(location, packageFolder), errorPackageName);

            try
            {
                ssisApplication = new Application();
                package = ssisApplication.LoadPackage(packageLocation, null);

                DTSExecResult result = package.Validate(null, null, null, null);

                //errors = package.Errors;
                //foreach (DtsError dtsError in errors)
                //{
                //    Console.WriteLine(dtsError.Description);
                //    Console.WriteLine(dtsError.Source);
                //    Console.WriteLine(dtsError.ErrorCode);
                //}
                package.Execute();
                errors = package.Errors;
                foreach (DtsError dtsError in errors)
                {
                    Console.WriteLine(dtsError.Description);
                    Console.WriteLine(dtsError.Source);
                    Console.WriteLine(dtsError.ErrorCode);
                }

            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
            finally
            {
                package.Dispose();
            }
        }
开发者ID:dmgactive,项目名称:cslearn,代码行数:37,代码来源:SsisValidation.cs

示例9: Execute

        public IBaseMessage Execute(IPipelineContext pContext, IBaseMessage pInMsg)
        {
            if (string.IsNullOrEmpty(this.PackagePath))
            {
                throw new ApplicationException("PackagePath property is not specified");
            }

            //Instantiate an instance of the specified package
            Application app = new Application();
            Package pkg = app.LoadPackage(this.PackagePath, null);
            if (pkg == null)
            {
                throw new ApplicationException(String.Format("Failed to load package instance from {0}", this.PackagePath));
            }

            //Set variable to store XML data if specified
            Variable var = null;
            if (string.IsNullOrEmpty(this.DataVariable) == false)
            {
                var = pkg.Variables[this.DataVariable];
                if (var == null)
                {
                    throw new ApplicationException(String.Format("Package {0} does not contain variable {1}", this.PackagePath, this.DataVariable));
                }

                //Read the steam data into string
                Stream originalMessageStream = pInMsg.BodyPart.GetOriginalDataStream();
                byte[] bufferOriginalMessage = new byte[originalMessageStream.Length];
                originalMessageStream.Read(bufferOriginalMessage, 0, Convert.ToInt32(originalMessageStream.Length));
                var.Value = System.Text.ASCIIEncoding.ASCII.GetString(bufferOriginalMessage);
            }

            //Execute the package
            pkg.Execute();
            
            return null;
        }
开发者ID:japj,项目名称:sqlsrvintegrationsrv,代码行数:37,代码来源:ISPipelineComponent.cs


注:本文中的Application.LoadPackage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。