//------------------------------------------------------------- // Write - write record to repository //------------------------------------------------------------- public void Write() { // Open connection to repository and save reports record. logX.loggerX.Info("Update Reports Record"); try { using (SqlConnection connection = new SqlConnection(Program.gController.Repository.ConnectionString)) { // Open the connection. connection.Open(); // setup parameters SqlParameter paramReportServer = new SqlParameter(ParamReportServer, SqlHelper.CreateSafeString(ReportServer.Trim(), false)); SqlParameter paramServerDir = new SqlParameter(ParamServerDir, SqlHelper.CreateSafeString(ReportServerDirectory.Trim(), false)); SqlParameter paramManagerDir = new SqlParameter(ParamcManagerDir, SqlHelper.CreateSafeString(ReportManagerDirectory.Trim(), false)); SqlParameter paramPort = new SqlParameter(ParamPort, Port); SqlParameter paramSsl = new SqlParameter(ParamSsl, UseSsl); SqlParameter paramUserName = new SqlParameter(ParamUserName, SqlHelper.CreateSafeString(UserName.Trim(), false)); SqlParameter paramRepository = new SqlParameter(ParamRepository, SqlHelper.CreateSafeString(Repository.Trim(), false)); SqlParameter paramTargetDir = new SqlParameter(ParamTargetDir, SqlHelper.CreateSafeString(TargetDirectory.Trim(), false)); // Execute stored procedure and get the users. using (SqlCommand cmd = new SqlCommand(QueryUpdateReport, connection)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(paramReportServer); cmd.Parameters.Add(paramServerDir); cmd.Parameters.Add(paramManagerDir); cmd.Parameters.Add(paramPort); cmd.Parameters.Add(paramSsl); cmd.Parameters.Add(paramUserName); cmd.Parameters.Add(paramRepository); cmd.Parameters.Add(paramTargetDir); cmd.ExecuteNonQuery(); } } } catch (Exception ex) { logX.loggerX.Error("Unable to save Reports Record", ex); Utility.MsgBox.ShowError(Utility.ErrorMsgs.ReportsCaption, Utility.ErrorMsgs.CantSaveReportsRecord, ex); } }