public WindowVM() { Connection = new Connection(); Variables = new MyVariableList(); TabScriptVm = new TabScriptVM(Connection, Variables); TabDeployReport = new TabDeployReportVM(Connection, Variables); TabPublishVM = new TabPublishVM(Connection, Variables); TabDriftVM = new TabDriftVM(Connection, Variables); }
private void Btn_DeployReport_Click(object sender, RoutedEventArgs e) { sqlPackage.ConsoleLocation = common.tbCmdPath.Text; Connection conn = new Connection(); MyVariableList var = new MyVariableList(common.v1.Text, common.v2.Text); if (common.CbConnectionString.IsChecked.HasValue && common.CbConnectionString.IsChecked.Value) { conn.ConnectionString = common.TbConnectionString.Text; } conn.TargetDatabaseName = common.TargetDatabaseName.Text; conn.TargetServerName = common.TargetServerName.Text; var model = new CommonParameters() { Action = "DeployReport", DacpacPath = common.TbDacPacPath.Text, }; sqlPackage.Execute(model, OutputPath.Text, conn, Proc_DataReceived, var); BtnOpenFile.IsEnabled = true; }
private void Btn_Publish_Click(object sender, RoutedEventArgs e) { sqlPackage.ConsoleLocation = common.tbCmdPath.Text; //proc = new Process(); Connection conn = new Connection(); MyVariableList var = new MyVariableList(common.v1.Text, common.v2.Text); if (common.CbConnectionString.IsChecked.HasValue && common.CbConnectionString.IsChecked.Value) { conn.ConnectionString = common.TbConnectionString.Text; } conn.TargetDatabaseName = common.TargetDatabaseName.Text; conn.TargetServerName = common.TargetServerName.Text; var model = new CommonParameters() { Action = "Publish", DacpacPath = common.TbDacPacPath.Text, }; sqlPackage.Execute(model, null, conn, Proc_ErrorDataReceived, var); }
public TabDeployReportVM(Connection connection, MyVariableList valuePairs) { this.Connection = connection; //Execute = new BasicCommand(this.Executee); this.Variables = valuePairs; }
public void Execute(CommonParameters parameters, string outputPath, Connection connection, DataReceivedEventHandler dataReceivedEventHandler, MyVariableList custParams) { string arg = "/action:" + parameters.Action + " " + "/p:GenerateSmartDefaults=True " + "/p:IgnoreColumnOrder=" + parameters.IgnoreColumnOrder + " " + "/SourceFile:\"" + parameters.DacpacPath + "\" "; //foreach (var item in custParams) //{ arg += "/v:" + custParams.Key + "=" + custParams.Value + " "; //} if (outputPath != null) { arg += "/OutputPath:\"" + outputPath + "\" "; } if (!string.IsNullOrEmpty(connection.ConnectionString)) { //if (CbConnectionString.IsChecked.HasValue && CbConnectionString.IsChecked.Value) arg += "/TargetConnectionString:" + connection.ConnectionString + " "; } else { arg += "/TargetDatabaseName:" + connection.TargetDatabaseName + " " + "/TargetServerName:" + connection.TargetServerName; } using (proc = new Process()) { this.proc.StartInfo = new ProcessStartInfo { FileName = ConsoleLocation, Arguments = arg, UseShellExecute = false, RedirectStandardOutput = true, RedirectStandardInput = true, RedirectStandardError = true, CreateNoWindow = true }; proc.OutputDataReceived += new DataReceivedEventHandler(dataReceivedEventHandler); proc.ErrorDataReceived += new DataReceivedEventHandler(dataReceivedEventHandler); proc.Start(); proc.BeginOutputReadLine(); proc.BeginErrorReadLine(); proc.WaitForExit(); } }
public TabScriptVM(Connection connection, MyVariableList valuePairs) { this.Connection = connection; Variables = valuePairs; //Execute = new BasicCommand(this.Executee); }