コード例 #1
0
 public void GetFomDatabase()
 {
     if (BatchJobGroups.Count > 0)
     {
         OraSession oraSession      = new OraSession();
         var        masterConString = oraSession.Load("Master");
         var        testConString   = oraSession.Load("Test");
         string     errorMessage    = "";
         errorMessage = oraSession.OpenConnection(masterConString);
         if (errorMessage != "")
         {
             ErrorConnection?.Invoke(null, null);
             return;
         }
         errorMessage = oraSession.OpenConnection(testConString);
         if (errorMessage != "")
         {
             ErrorConnection?.Invoke(null, null);
             return;
         }
         else
         {
             foreach (var bjg in BatchJobGroups)
             {
                 ExtractLogs(bjg);
                 bjg.CompareLogs();
             }
             LogsExtracted?.Invoke(BatchJobGroups.Where(item => item.Name != "").ToList(), null);
         }
     }
 }
コード例 #2
0
 public void EndSession()
 {
     if (OraSession != null)
     {
         OraSession.CloseConnection();
     }
 }
コード例 #3
0
        private OraSession OpenConnection(string name)
        {
            var oraSession = new OraSession();
            var conString  = oraSession.Load(name);

            oraSession.OpenConnection(conString);
            return(oraSession);
        }
コード例 #4
0
 public string StartSession(string conString)
 {
     OraSession = new OraSession();
     try {
         OraSession.OpenConnection(conString);
         return("");
     } catch (Exception ex) {
         return(ex.Message);
     }
 }
コード例 #5
0
        public string StartSession(string host, string port, string user, string password, string dbName, string sid)
        {
            DbConnection dbConnection = new DbConnection(Name, host, port, user, password, dbName, sid);

            OraSession = new OraSession();
            try {
                OraSession.OpenConnection(dbConnection.CreateConnectionString());
                return("");
            }catch (Exception ex) {
                return(ex.Message);
            }
        }
コード例 #6
0
        public DateTime GetProjectStartDate()
        {
            string query         = "select max(laststartts) from BATCHSTATS";
            var    masterSession = new OraSession();
            var    conString     = masterSession.Load("Master");

            masterSession.OpenConnection(conString);
            OracleCommand masterCmd = new OracleCommand(query, masterSession.OracleConnection);
            var           result    = masterSession.AsyncGetLastExecuted(masterCmd);

            masterSession.CloseConnection();
            return(result);
        }
コード例 #7
0
        private void OnTestConnection(object sender, EventArgs e)
        {
            string connectionName = "";

            if (DbConnectionView.IsMasterActive)
            {
                connectionName = "Master";
            }
            else if (DbConnectionView.IsTestActive)
            {
                connectionName = "Test";
            }
            try {
                DbConnection = new DbConnection(
                    connectionName,
                    DbConnectionView.Host,
                    DbConnectionView.Port,
                    DbConnectionView.Schema,
                    DbConnectionView.Password,
                    DbConnectionView.Sid,
                    DbConnectionView.ServiceName
                    );
                ValidationContext       context = new ValidationContext(DbConnection, null, null);
                List <ValidationResult> results = new List <ValidationResult>();
                bool valid = Validator.TryValidateObject(DbConnection, context, results, true);

                if (!valid)
                {
                    foreach (var item in results)
                    {
                        DbConnectionView.WriteError(item.ErrorMessage);
                    }
                }
                else
                {
                    OraSession = new OraSession(DbConnection.CreateConnectionString());
                    DbConnectionView.WriteSuccessful("Connected to " + connectionName + " database");
                }
            } catch (Exception ex) {
                DbConnectionView.WriteError(ex.Message);
            }
        }
コード例 #8
0
 public void Save()
 {
     OraSession.Save(Name);
 }