예제 #1
0
    public static bool OpenAdoMysql(ADODB.Connection conn)
    {
        bool opened;

        // close the connection if it already exists
        CloseAdo(conn);

        try {
            //  gwwd - nont here at start ... conn.DefaultDatabase = "";
            //conn.ConnectionString = "Provider=MySQLProv;Data Source=webmpx; Persist Security Info = False";
            //conn.ConnectionString = "Provider=MySQLProv;" + GetUserDatabaseConnection().ToString();

            /* using (OdbcConnection connection = new OdbcConnection(ConfigurationManager.ConnectionStrings["MySQLConnStr"].ConnectionString)) {
             *  connection.Open();
             * */
            conn.ConnectionString = ConfigurationManager.ConnectionStrings["MySQLConnStr"].ConnectionString;
            conn.Mode             = (ADODB.ConnectModeEnum)ADODB.CursorLocationEnum.adUseServer;
            conn.Open();
            opened = true;
        } catch (Exception e) {
            // MyUtilities.MsgBox("Error in opening database connection: " + conn.ConnectionString + " (" + e.Message + ")");
            opened = false;
            LogFiles logFiles = new LogFiles();
            logFiles.ErrorLog(e);
            //throw new Exception(e.Message);
        }
        return(opened);
    }
예제 #2
0
        public void OnException(ExceptionContext filterContext)
        {
            var exception = filterContext.Exception;

            //var request = filterContext.HttpContext.Request;
            LogFiles.WriteLog(LogFiles.LogLevel.ERROR, exception, filterContext);
        }
예제 #3
0
 public string Put(string CompetitionDate, [FromBody]Competition cmpt)
 {
     string userName = string.Empty;
     if (System.Web.HttpContext.Current != null && System.Web.HttpContext.Current.User.Identity.IsAuthenticated)
     {
         if (User.Identity.IsAuthenticated)
             userName = User.Identity.Name;
     }
     DBservices dbs = new DBservices();
     int return_val = 0;
     LogFiles lf = new LogFiles();
     List<Object> mlist = new List<Object>();
     mlist.Add(cmpt);
     try
     {
         return_val = dbs.updateCompetitionInDatabase(cmpt, CompetitionDate);
     }
     catch (Exception ex)
     {
         string Response = ("Error updating the Competition database " + ex.Message);
         lf.Main("Competition", Response);
         return "Error";
     }
     if (return_val == 0) { return "Error"; }
     return "Success";
 }
        //-----------------------------------------------------------------------
        private List <CategoryStatus> Init(string LogFilePath, string LogFileName, SqlCommand cmd)
        {
            SqlConnection con = db.getConnection();

            cmd.Connection = con;
            List <CategoryStatus> l_CategoryStatus = new List <CategoryStatus>();

            try
            {
                con.Open();
                SqlDataReader   reader      = cmd.ExecuteReader();
                SmartDataReader smartReader = new SmartDataReader(reader);
                while (smartReader.Read())
                {
                    CategoryStatus m_CategoryStatus = new CategoryStatus(db.ConnectionString);
                    m_CategoryStatus.CategoryStatusId   = smartReader.GetByte("CategoryStatusId");
                    m_CategoryStatus.CategoryStatusName = smartReader.GetString("CategoryStatusName");
                    m_CategoryStatus.CategoryStatusDesc = smartReader.GetString("CategoryStatusDesc");
                    l_CategoryStatus.Add(m_CategoryStatus);
                }
                smartReader.disposeReader(reader);
                db.closeConnection(con);
            }
            catch (SqlException ex)
            {
                LogFiles.WriteLog(ex.Message, LogFilePath + "\\Exception", LogFileName + "." + this.GetType().Name + "." + MethodBase.GetCurrentMethod().Name);
            }
            return(l_CategoryStatus);
        }
예제 #5
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void appendNullTransactionLogEntryToSetRaftIndexToMinusOne() throws java.io.IOException
        private void AppendNullTransactionLogEntryToSetRaftIndexToMinusOne()
        {
            ReadOnlyTransactionIdStore readOnlyTransactionIdStore = new ReadOnlyTransactionIdStore(_pageCache, _databaseLayout);
            LogFiles logFiles = LogFilesBuilder.activeFilesBuilder(_databaseLayout, _fs, _pageCache).withConfig(_config).withLastCommittedTransactionIdSupplier(() => readOnlyTransactionIdStore.LastClosedTransactionId - 1).build();

            long dummyTransactionId;

            using (Lifespan lifespan = new Lifespan(logFiles))
            {
                FlushableChannel     channel = logFiles.LogFile.Writer;
                TransactionLogWriter writer  = new TransactionLogWriter(new LogEntryWriter(channel));

                long lastCommittedTransactionId      = readOnlyTransactionIdStore.LastCommittedTransactionId;
                PhysicalTransactionRepresentation tx = new PhysicalTransactionRepresentation(Collections.emptyList());
                sbyte[] txHeaderBytes = LogIndexTxHeaderEncoding.encodeLogIndexAsTxHeader(-1);
                tx.SetHeader(txHeaderBytes, -1, -1, -1, lastCommittedTransactionId, -1, -1);

                dummyTransactionId = lastCommittedTransactionId + 1;
                writer.Append(tx, dummyTransactionId);
                channel.PrepareForFlush().flush();
            }

            File neoStoreFile = _databaseLayout.metadataStore();

            MetaDataStore.setRecord(_pageCache, neoStoreFile, LAST_TRANSACTION_ID, dummyTransactionId);
        }
예제 #6
0
        public void WithBookmarkedLogAtTheEndOfFirstFile_ThenAllNextFilesAreRead()
        {
            GivenLogFilesInDirectory(files: 2);
            var initialFile     = LogFiles[0];
            var otherFile       = LogFiles[1];
            var batchCount      = Fixture.Create <int>();
            var otherFileLength = BatchPostingLimit * batchCount;

            GivenFileDeleteSucceeds(initialFile);
            GivenPersistedBookmark(initialFile, Fixture.Create <long>());

            GivenLockedFileLength(initialFile, length: CurrentLogFilePosition);
            GivenLockedFileLength(otherFile, length: otherFileLength);

            GivenLogReader(initialFile, length: CurrentLogFilePosition, maxStreams: int.MaxValue);
            GivenLogReader(otherFile, length: otherFileLength, maxStreams: int.MaxValue);

            GivenSendIsSuccessful();

            WhenLogShipperIsCalled();

            this.ShouldSatisfyAllConditions(
                () => LogFiles.ShouldBe(new[] { otherFile }, "Only one shall remain!"),
                () => CurrentLogFileName.ShouldBe(otherFile),
                () => CurrentLogFilePosition.ShouldBe(otherFileLength),
                () => SentBatches.ShouldBe(batchCount),
                () => SentRecords.ShouldBe(otherFileLength)
                );
        }
예제 #7
0
        //This solution uses the IComparable<T> interface to sort the input. In the best case, when all the words after the identifers contain digits, it will still take O(nlogn) time.
        public string[] ReorderLogFiles(string[] logs)
        {
            LogFiles[] logFiles = new LogFiles[logs.Length];

            for (int i = 0; i < logs.Length; i++)
            {
                int firstSpaceIndex = logs[i].IndexOf(' ');

                string identifier = logs[i].Substring(0, firstSpaceIndex);

                string contents = logs[i].Substring(firstSpaceIndex + 1);

                logFiles[i] = new LogFiles(i, identifier, contents);
            }

            Array.Sort(logFiles);

            string[] sortedLogs = new string[logs.Length];

            for (int i = 0; i < logFiles.Length; i++)
            {
                sortedLogs[i] = logFiles[i].Identifier + " " + logFiles[i].Contents;
            }

            return(sortedLogs);
        }
예제 #8
0
		//-----------------------------------------------------------------------
		public List<ImageTypes> Init(string LogFilePath, string LogFileName, SqlCommand cmd)
		{
			SqlConnection con = db.getConnection();
			cmd.Connection = con;
			con.Open();
			SqlDataReader dr = cmd.ExecuteReader();
			SmartDataReader rd = new SmartDataReader(dr);
			List<ImageTypes> l_ImageTypes = new List<ImageTypes>();
			try
			{
				while (rd.Read())
				{
					ImageTypes m_ImageTypes = new ImageTypes(db.ConnectionString);
					m_ImageTypes.ImageTypeId = rd.GetByte("ImageTypeId");
					m_ImageTypes.ImageTypeDesc = rd.GetString("ImageTypeDesc");
					m_ImageTypes.ImageTypeName = rd.GetString("ImageTypeName");
					l_ImageTypes.Add(m_ImageTypes);
				}
			}
			catch (SqlException ex)
			{
				LogFiles.WriteLog(ex.Message, LogFilePath + "\\Exception", LogFileName + "." + this.GetType().Name + "." + MethodBase.GetCurrentMethod().Name);
			}
			finally
			{
				rd.disposeReader(dr);
				cmd.Dispose();
				db.closeConnection(con);
			}
			return l_ImageTypes;
		}
예제 #9
0
        /// <summary>
        /// Gets the log files from the server (using webclient).
        /// </summary>
        /// <param name="server">The server.</param>
        /// <param name="directory">The directory.</param>
        /// <returns></returns>
        /// <author>Jurie.smit</author>
        /// <date>2013/05/24</date>
        public IEnumerable <FilePath> GetLogFiles(IEnvironmentModel server, DirectoryPath directory)
        {
            LogFiles.Clear();

            if (server == null || directory == null)
            {
                return(new List <FilePath>());
            }

            var address = String.Format(server.Connection.WebServerUri + "{0}/{1}?DirectoryPath={2}",
                                        "Services", "FindDirectoryService", directory.PathToSerialize);
            var datalistJson = WebClient.UploadString(address, string.Empty);

            if (datalistJson.Contains("Error"))
            {
                var error = "Error: Log directory not found." + Environment.NewLine +
                            datalistJson.GetManagementPayload();
                ShowErrorPopup(error);
            }
            else
            {
                var filePaths = JsonConvert.DeserializeObject <List <FilePath> >(datalistJson);
                filePaths.ForEach(fp =>
                {
                    if (fp.Title.EndsWith(".wwlfl"))
                    {
                        LogFiles.Add(fp);
                    }
                });
                return(filePaths);
            }
            return(new List <FilePath>());
        }
예제 #10
0
        private bool Recover(File storeDir, LogFiles logFiles)
        {
            LifeSupport     life    = new LifeSupport();
            RecoveryMonitor monitor = mock(typeof(RecoveryMonitor));
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final java.util.concurrent.atomic.AtomicBoolean recoveryRequired = new java.util.concurrent.atomic.AtomicBoolean();
            AtomicBoolean recoveryRequired = new AtomicBoolean();

            try
            {
                StorageEngine storageEngine = mock(typeof(StorageEngine));
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.kernel.impl.transaction.log.entry.LogEntryReader<org.neo4j.kernel.impl.transaction.log.ReadableClosablePositionAwareChannel> reader = new org.neo4j.kernel.impl.transaction.log.entry.VersionAwareLogEntryReader<>();
                LogEntryReader <ReadableClosablePositionAwareChannel> reader = new VersionAwareLogEntryReader <ReadableClosablePositionAwareChannel>();
                LogTailScanner tailScanner = GetTailScanner(logFiles, reader);

                TransactionMetadataCache metadataCache = new TransactionMetadataCache();
                LogicalTransactionStore  txStore       = new PhysicalLogicalTransactionStore(logFiles, metadataCache, reader, _monitors, false);
                CorruptedLogsTruncator   logPruner     = new CorruptedLogsTruncator(storeDir, logFiles, FileSystemRule.get());
                life.add(new Recovery(new DefaultRecoveryServiceAnonymousInnerClass3(this, storageEngine, tailScanner, _transactionIdStore, txStore, _versionRepository, NO_MONITOR, recoveryRequired)
                                      , logPruner, _schemaLife, monitor, SilentProgressReporter.INSTANCE, false));

                life.Start();
            }
            finally
            {
                life.Shutdown();
            }
            return(recoveryRequired.get());
        }
        //-----------------------------------------------------------------------
        public List <CategoryStatus> GetList(string LogFilePath, string LogFileName, string Conditions, string OrderBy)
        {
            List <CategoryStatus> RetVal = new List <CategoryStatus>();

            try
            {
                string Sql = "SELECT * FROM V$CategoryStatus";
                if (!string.IsNullOrEmpty(Conditions))
                {
                    Sql += " WHERE " + Conditions;
                }
                if (!string.IsNullOrEmpty(OrderBy))
                {
                    Sql += " ORDER BY " + OrderBy;
                }
                SqlCommand cmd = new SqlCommand(Sql);
                cmd.CommandType = CommandType.Text;
                RetVal          = Init(LogFilePath, LogFileName, cmd);
            }
            catch (Exception ex)
            {
                LogFiles.WriteLog(ex.Message, LogFilePath + "\\Exception", LogFileName + "." + this.GetType().Name + "." + MethodBase.GetCurrentMethod().Name);
            }
            return(RetVal);
        }
예제 #12
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void delete(java.io.File storeDir, org.neo4j.kernel.impl.transaction.log.files.LogFiles logFiles) throws java.io.IOException
        public virtual void Delete(File storeDir, LogFiles logFiles)
        {
            // 'files' can be null if the directory doesn't exist. This is fine, we just ignore it then.
            File[] files = _fs.listFiles(storeDir, _fileFilter);
            if (files != null)
            {
                foreach (File file in files)
                {
                    _fs.deleteRecursively(file);
                }
            }

            File[] txLogs = _fs.listFiles(logFiles.LogFilesDirectory());
            if (txLogs != null)
            {
                foreach (File txLog in txLogs)
                {
                    _fs.deleteFile(txLog);
                }
            }

            IEnumerable <FileHandle> iterator = AcceptedPageCachedFiles(storeDir).iterator;

            foreach (FileHandle fh in iterator)
            {
                fh.Delete();
            }
        }
예제 #13
0
    public static bool RunSql(string commandString, string connectionString)
    {
        bool updated;

        try {
            using (OleDbConnection oleConn = new OleDbConnection(connectionString)) {
                oleConn.Open();
                using (OleDbCommand comm = new OleDbCommand(commandString, oleConn)) {
                    try {
                        comm.ExecuteNonQuery();
                    } catch (Exception ex) {
                        Exception excep = new Exception("Error in executing oledb command. Command string: " + comm.CommandText + ". Exception message: " + ex.Message, ex);
                        throw excep;
                    }
                    oleConn.Close();
                    updated = true;
                }
            }
        } catch (Exception ex) {
            LogFiles logFiles = new LogFiles();
            logFiles.ErrorLog(ex);
            updated = false;
        }
        return(updated);
    }
예제 #14
0
        //-------------------------------------------------------------------------------------------------------------------
        private List <ImageMediaItems> Init(string LogFilePath, string LogFileName, SqlCommand cmd)
        {
            SqlConnection con = db.getConnection();

            cmd.Connection = con;
            List <ImageMediaItems> l_ImageMediaItems = new List <ImageMediaItems>();

            try
            {
                con.Open();
                SqlDataReader   reader      = cmd.ExecuteReader();
                SmartDataReader smartReader = new SmartDataReader(reader);
                while (smartReader.Read())
                {
                    ImageMediaItems m_ImageMediaItems = new ImageMediaItems(db.ConnectionString);
                    m_ImageMediaItems.ImageMediaItemId = smartReader.GetInt32("ImageMediaItemId");
                    m_ImageMediaItems.ImageId          = smartReader.GetInt32("ImageId");
                    m_ImageMediaItems.MediaItemId      = smartReader.GetInt32("MediaItemId");
                    m_ImageMediaItems.CrUserId         = smartReader.GetInt32("CrUserId");
                    m_ImageMediaItems.CrDateTime       = smartReader.GetDateTime("CrDateTime");
                    l_ImageMediaItems.Add(m_ImageMediaItems);
                }
                smartReader.disposeReader(reader);
                db.closeConnection(con);
            }
            catch (SqlException ex)
            {
                LogFiles.WriteLog(ex.Message, LogFilePath + "\\Exception", LogFileName + "." + this.GetType().Name + "." + MethodBase.GetCurrentMethod().Name);
            }
            return(l_ImageMediaItems);
        }
예제 #15
0
    public static bool RunMysql(string commandString)
    {
        bool   updated     = false;
        string conn_string = GetConnectionString();

        using (MySqlConnection conn = new MySqlConnection(conn_string))
            using (MySqlCommand cmd = conn.CreateCommand()) { //watch out for this SQL injection vulnerability below
                cmd.CommandText = commandString;
                try {
                    conn.Open();
                    try {
                        cmd.ExecuteNonQuery();
                    } catch (Exception exp) {
                        throw new Exception("Error in executing MySql command. Command string: " + commandString + ". Exception message: " + exp.Message, exp);
                    }
                    updated = true;
                } catch (Exception ex) {
                    LogFiles logFiles = new LogFiles();
                    logFiles.ErrorLog(ex);
                } finally {
                    conn.Close();
                }
            }
        return(updated);
    }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void correctLastAppliedToPreviousLogTransactionInHeaderOnLogFileRotation() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void CorrectLastAppliedToPreviousLogTransactionInHeaderOnLogFileRotation()
        {
            LogFiles logFiles = GetLogFiles(_logVersionRepository, _transactionIdStore);

            Life.add(logFiles);
            DatabaseHealth databaseHealth = DatabaseHealth;

            LogRotationImpl                  logRotation = new LogRotationImpl(_monitors.newMonitor(typeof(Org.Neo4j.Kernel.impl.transaction.log.rotation.LogRotation_Monitor)), logFiles, databaseHealth);
            TransactionMetadataCache         transactionMetadataCache = new TransactionMetadataCache();
            SynchronizedArrayIdOrderingQueue idOrderingQueue          = new SynchronizedArrayIdOrderingQueue();

            BatchingTransactionAppender transactionAppender = new BatchingTransactionAppender(logFiles, logRotation, transactionMetadataCache, _transactionIdStore, idOrderingQueue, databaseHealth);

            Life.add(transactionAppender);

            LogAppendEvent     logAppendEvent     = new RotationLogAppendEvent(logRotation);
            TransactionToApply transactionToApply = PrepareTransaction();

            transactionAppender.Append(transactionToApply, logAppendEvent);

            assertEquals(1, logFiles.HighestLogVersion);
            File      highestLogFile = logFiles.HighestLogFile;
            LogHeader logHeader      = LogHeaderReader.readLogHeader(FileSystem, highestLogFile);

            assertEquals(2, logHeader.LastCommittedTxId);
        }
        //-------------------------------------------------------------------------------------
        public bool InsertNoInform(string LogFilePath, string LogFileName, byte DistributedProcess, string IpAddress, int ActUserId)
        {
            bool RetVal = false;

            try
            {
                SqlCommand cmd = new SqlCommand("ArticleContentMediaItems_InsertNoInform");
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add(new SqlParameter("@DistributedProcess", DistributedProcess));
                cmd.Parameters.Add(new SqlParameter("@IpAddress", IpAddress));
                cmd.Parameters.Add(new SqlParameter("@ArticleContentId", this.ArticleContentId));
                cmd.Parameters.Add(new SqlParameter("@MediaItemId", this.MediaItemId));
                cmd.Parameters.Add(new SqlParameter("@CrUserId", ActUserId));
                cmd.Parameters.Add(new SqlParameter("@CrDateTime", this.CrDateTime));
                cmd.Parameters.Add("@ArticleContentMediaItemId", SqlDbType.Int).Direction = ParameterDirection.Output;
                db.ExecuteSQL(cmd);
                this.ArticleContentMediaItemId = Convert.ToInt32((cmd.Parameters["@ArticleContentMediaItemId"].Value == null) ? "0" : cmd.Parameters["@ArticleContentMediaItemId"].Value.ToString().Trim());
                RetVal = (this.ArticleContentMediaItemId > 0);
            }
            catch (Exception ex)
            {
                LogFiles.WriteLog(ex.Message, LogFilePath + "\\Exception", LogFileName + "." + this.GetType().Name + "." + MethodBase.GetCurrentMethod().Name);
            }
            return(RetVal);
        }
예제 #18
0
    public static bool RunMySqlParams(string commandString, string[] paramNames, object[] parameters)
    {
        bool   updated;
        string conn_string = GetConnectionString();

        try {
            using (MySqlConnection oleConn = new MySqlConnection(conn_string)) {
                oleConn.Open();
                using (MySqlCommand comm = new MySqlCommand(commandString, oleConn)) {
                    try {
                        for (int i = 0; i < parameters.Length; i++)
                        {
                            comm.Parameters.AddWithValue(paramNames[i], parameters[i]);
                        }
                        comm.ExecuteNonQuery();
                    } catch (Exception ex) {
                        Exception excep = new Exception("Error in executing mysql command. Command string: " + comm.CommandText + ". Exception message: " + ex.Message, ex);
                        throw excep;
                    }
                    oleConn.Close();
                    updated = true;
                }
            }
        } catch (Exception ex) {
            LogFiles logFiles = new LogFiles();
            logFiles.ErrorLog(ex);
            updated = false;
        }
        return(updated);
    }
예제 #19
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void pruningStrategyShouldBeDynamic() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void PruningStrategyShouldBeDynamic()
        {
            CheckPointer          checkPointer = GetInstanceFromDb(typeof(CheckPointer));
            Config                config       = GetInstanceFromDb(typeof(Config));
            FileSystemAbstraction fs           = GetInstanceFromDb(typeof(FileSystemAbstraction));

            LogFiles logFiles = LogFilesBuilder.builder(Db.databaseLayout(), fs).withLogVersionRepository(new SimpleLogVersionRepository()).withLastCommittedTransactionIdSupplier(() => 1).withTransactionIdStore(new SimpleTransactionIdStore()).build();

            // Force transaction log rotation
            WriteTransactionsAndRotateTwice();

            // Checkpoint to make sure strategy is evaluated
            checkPointer.ForceCheckPoint(_triggerInfo);

            // Make sure file is still there since we have disable pruning
            assertThat(CountTransactionLogs(logFiles), @is(3));

            // Change pruning to true
            config.UpdateDynamicSetting(keep_logical_logs.name(), "false", "test");

            // Checkpoint to make sure strategy is evaluated
            checkPointer.ForceCheckPoint(_triggerInfo);

            // Make sure file is removed
            assertThat(CountTransactionLogs(logFiles), @is(2));
        }
        public void Test_Ctor_Initializes_Log_Paths_If_Relative_Path_Provided()
        {
            LogFiles logFiles = new LogFiles("logs");

            const string consoleLog = @"logs\output.txt";

            Assert.Equal(consoleLog, logFiles.ConsoleLog);

            const string removedFilesLog = @"logs\removedFiles.txt";

            Assert.Equal(removedFilesLog, logFiles.RemovedFilesLog);

            const string normalFilesLog = @"logs\normalFiles.txt";

            Assert.Equal(normalFilesLog, logFiles.NormalFilesLog);

            const string notExistentFilesLog = @"logs\notExistentFiles.txt";

            Assert.Equal(notExistentFilesLog, logFiles.NotExistentFilesLog);

            const string copiedFilesLog = @"logs\copiedFiles.txt";

            Assert.Equal(copiedFilesLog, logFiles.CopiedFilesLog);

            const string replacedLinksLog = @"logs\replacedLinks.csv";

            Assert.Equal(replacedLinksLog, logFiles.ReplacedLinksLog);

            const string replacedLanguageLinksLog = @"logs\replacedLanguageLinks.csv";

            Assert.Equal(replacedLanguageLinksLog, logFiles.ReplacedLanguageLinksLog);
        }
예제 #21
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void restoreTransactionLogsInCustomDirectoryForTargetDatabaseWhenConfigured() throws java.io.IOException, org.neo4j.commandline.admin.CommandFailed
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void RestoreTransactionLogsInCustomDirectoryForTargetDatabaseWhenConfigured()
        {
            string databaseName                  = "to";
            Config config                        = ConfigWith(databaseName, Directory.absolutePath().AbsolutePath);
            File   customTxLogDirectory          = Directory.directory("customLogicalLog");
            string customTransactionLogDirectory = customTxLogDirectory.AbsolutePath;

            config.AugmentDefaults(GraphDatabaseSettings.logical_logs_location, customTransactionLogDirectory);

            File fromPath      = new File(Directory.absolutePath(), "from");
            File toPath        = config.Get(GraphDatabaseSettings.database_path);
            int  fromNodeCount = 10;
            int  toNodeCount   = 20;

            CreateDbAt(fromPath, fromNodeCount);

            GraphDatabaseService db = CreateDatabase(toPath, customTransactionLogDirectory);

            CreateTestData(toNodeCount, db);
            Db.shutdown();

            // when
            (new RestoreDatabaseCommand(FileSystemRule.get(), fromPath, config, databaseName, true)).execute();

            LogFiles fromStoreLogFiles         = LogFilesBuilder.logFilesBasedOnlyBuilder(fromPath, FileSystemRule.get()).build();
            LogFiles toStoreLogFiles           = LogFilesBuilder.logFilesBasedOnlyBuilder(toPath, FileSystemRule.get()).build();
            LogFiles customLogLocationLogFiles = LogFilesBuilder.logFilesBasedOnlyBuilder(customTxLogDirectory, FileSystemRule.get()).build();

            assertThat(toStoreLogFiles.LogFilesConflict(), emptyArray());
            assertThat(customLogLocationLogFiles.LogFilesConflict(), arrayWithSize(1));
            assertEquals(fromStoreLogFiles.GetLogFileForVersion(0).length(), customLogLocationLogFiles.GetLogFileForVersion(0).length());
        }
예제 #22
0
        //-------------------------------------------------------------------------------------
        public bool InsertNoInform(string LogFilePath, string LogFileName, byte DistributedProcess, string IpAddress, int ActUserId)
        {
            bool RetVal = false;

            try
            {
                SqlCommand cmd = new SqlCommand("Categories_InsertNoInform");
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add(new SqlParameter("@DistributedProcess", DistributedProcess));
                cmd.Parameters.Add(new SqlParameter("@IpAddress", IpAddress));
                cmd.Parameters.Add(new SqlParameter("@DisplayOrder", this.DisplayOrder));
                cmd.Parameters.Add(new SqlParameter("@ParentCategoryId", this.ParentCategoryId));
                cmd.Parameters.Add(new SqlParameter("@CategoryName", this.CategoryName));
                cmd.Parameters.Add(new SqlParameter("@CategoryDesc", this.CategoryDesc));
                cmd.Parameters.Add(new SqlParameter("@Url", this.Url));
                cmd.Parameters.Add(new SqlParameter("@CategoryStatusId", this.CategoryStatusId));
                cmd.Parameters.Add(new SqlParameter("@ImageIcon", this.ImageIcon));
                cmd.Parameters.Add(new SqlParameter("@CrUserId", ActUserId));
                cmd.Parameters.Add(new SqlParameter("@CrDateTime", this.CrDateTime));
                cmd.Parameters.Add("@CategoryId", SqlDbType.SmallInt).Direction = ParameterDirection.Output;
                db.ExecuteSQL(cmd);
                this.CategoryId = Convert.ToInt16((cmd.Parameters["@CategoryId"].Value == null) ? "0" : cmd.Parameters["@CategoryId"].Value.ToString().Trim());
                RetVal          = (this.CategoryId > 0);
            }
            catch (Exception ex)
            {
                LogFiles.WriteLog(ex.Message, LogFilePath + "\\Exception", LogFileName + "." + this.GetType().Name + "." + MethodBase.GetCurrentMethod().Name);
            }
            return(RetVal);
        }
예제 #23
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void pullRotatesWhenThresholdCrossedAndExplicitlySet() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void PullRotatesWhenThresholdCrossedAndExplicitlySet()
        {
            // given
            Config config = Config.defaults();

            config.Augment(GraphDatabaseSettings.logical_log_rotation_threshold, "1M");                 // 1 mebibyte

            // and
            Org.Neo4j.Storageengine.Api.StoreId storeId = SimulateStoreCopy();

            // and
            long fromTxId = BASE_TX_ID;
            TransactionLogCatchUpWriter subject = new TransactionLogCatchUpWriter(_databaseLayout, _fs, _pageCache, config, NullLogProvider.Instance, fromTxId, PartOfStoreCopyConflict, false, true);

            // when a bunch of transactions received
            LongStream.range(fromTxId, _manyTransactions).mapToObj(TransactionLogCatchUpWriterTest.tx).map(tx => new TxPullResponse(ToCasualStoreId(storeId), tx)).forEach(subject.onTxReceived);
            subject.Close();

            // then there was a rotation
            LogFilesBuilder logFilesBuilder = LogFilesBuilder.activeFilesBuilder(_databaseLayout, _fs, _pageCache);
            LogFiles        logFiles        = logFilesBuilder.Build();

            assertNotEquals(logFiles.LowestLogVersion, logFiles.HighestLogVersion);
            VerifyTransactionsInLog(logFiles, fromTxId, _manyTransactions);
            VerifyCheckpointInLog(logFiles, PartOfStoreCopyConflict);
        }
예제 #24
0
        public string Delete(string username)
        {
            int return_val = 0;
            LogFiles lf = new LogFiles();
            DBservices dbs = new DBservices();
            string Response= "";
            username = username.Replace("'", "''");
            try
            {
                return_val = dbs.DeleteDatabase("Rider",username);
            }
            catch (Exception ex)
            {
                 Response = ("Error in the Delete process the Rider(user) database " + ex.Message);
                 lf.Main("Users", Response);
                return "Error";
            }

             lf.Main("Users", Response);
             if (return_val <= 0)
             {
                 Response = "The Rider " + username + " was not Deleted from the Database";
                 lf.Main("Users", Response);
                 return "Error";
             }
             else
             {
                 Response = "The Rider " + username + " was Deleted from the Database";
                 lf.Main("Users", Response);
                 return "Success";
             }
        }
예제 #25
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string redirect = "";

        try
        {
            m_Categories     = new Categories(WEB_CONSTR);
            m_CategoryStatus = new CategoryStatus(WEB_CONSTR);
            IpAddress        = Request.UserHostAddress;
            ActUserId        = MyConstants.ActUserId;
            if (ActUserId > 0)
            {
                if (!IsPostBack)
                {
                    bindData(-1);
                }
            }
            else
            {
                redirect = MyConstants.PRJ_ROOT + "/Login.aspx";
            }
        }
        catch (Exception ex)
        {
            LogFiles.WriteLog(ex.Message, LogFilePath + "\\Exception", LogFileName + "." + this.GetType().Name + "." + MethodBase.GetCurrentMethod().Name);
        }
        if (!string.IsNullOrEmpty(redirect))
        {
            Response.Redirect(redirect);
        }
    }
예제 #26
0
 //--------------------------------------------------------------------------------------------
 protected void m_grid_RowDeleting(object sender, GridViewDeleteEventArgs e)
 {
     try
     {
         short delId = (Int16)m_grid.DataKeys[e.RowIndex].Value;
         if (delId > 0)
         {
             m_Categories.CategoryId = delId;
             m_Categories.CrUserId   = ActUserId;
             m_Categories.CrDateTime = System.DateTime.Now;
             if (m_Categories.DeleteNoInform(LogFilePath, LogFileName, MyConstants.DISTRIBUTED_PROCESS, IpAddress, ActUserId))
             {
                 SysMessageDesc = "Đã xoá chuyên mục";
             }
             else
             {
                 SysMessageDesc = "Lỗi xoá chuyên mục";
             }
             JSAlert.Alert(SysMessageDesc, this);
             bindData(-1);
         }
     }
     catch (Exception ex)
     {
         LogFiles.WriteLog(ex.Message, LogFilePath + "\\Exception", LogFileName + "." + this.GetType().Name + "." + MethodBase.GetCurrentMethod().Name);
     }
 }
        //-----------------------------------------------------------------------------------------------------------------
        public bool UpdateNoInform(string LogFilePath, string LogFileName, byte DistributedProcess, string IpAddress, int ActUserId)
        {
            bool RetVal = false;

            try
            {
                if (this.ArticleContentMediaItemId > 0)
                {
                    SqlCommand cmd = new SqlCommand("ArticleContentMediaItems_UpdateNoInform");
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.Add(new SqlParameter("@DistributedProcess", DistributedProcess));
                    cmd.Parameters.Add(new SqlParameter("@IpAddress", IpAddress));
                    cmd.Parameters.Add(new SqlParameter("@ArticleContentId", this.ArticleContentId));
                    cmd.Parameters.Add(new SqlParameter("@MediaItemId", this.MediaItemId));
                    cmd.Parameters.Add(new SqlParameter("@CrUserId", ActUserId));
                    cmd.Parameters.Add(new SqlParameter("@CrDateTime", this.CrDateTime));
                    cmd.Parameters.Add(new SqlParameter("@ArticleContentMediaItemId", this.ArticleContentMediaItemId));
                    db.ExecuteSQL(cmd);
                    RetVal = true;
                }
            }
            catch (Exception ex)
            {
                LogFiles.WriteLog(ex.Message, LogFilePath + "\\Exception", LogFileName + "." + this.GetType().Name + "." + MethodBase.GetCurrentMethod().Name);
            }
            return(RetVal);
        }
예제 #28
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldCloseIndexAndLabelScanSnapshots() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldCloseIndexAndLabelScanSnapshots()
        {
            // Given
            LabelScanStore        labelScanStore  = mock(typeof(LabelScanStore));
            IndexingService       indexingService = mock(typeof(IndexingService));
            ExplicitIndexProvider explicitIndexes = mock(typeof(ExplicitIndexProvider));

            when(explicitIndexes.AllIndexProviders()).thenReturn(Collections.emptyList());
            DatabaseLayout databaseLayout = mock(typeof(DatabaseLayout));

            when(databaseLayout.MetadataStore()).thenReturn(mock(typeof(File)));
            LogFiles logFiles = mock(typeof(LogFiles));

            FilesInStoreDirAre(databaseLayout, _standardStoreDirFiles, _standardStoreDirDirectories);
            StorageEngine       storageEngine = mock(typeof(StorageEngine));
            NeoStoreFileListing fileListing   = new NeoStoreFileListing(databaseLayout, logFiles, labelScanStore, indexingService, explicitIndexes, storageEngine);

            ResourceIterator <File> scanSnapshot  = ScanStoreFilesAre(labelScanStore, new string[] { "blah/scan.store", "scan.more" });
            ResourceIterator <File> indexSnapshot = IndexFilesAre(indexingService, new string[] { "schema/index/my.index" });

            ResourceIterator <StoreFileMetadata> result = fileListing.Builder().excludeLogFiles().build();

            // When
            result.Close();

            // Then
            verify(scanSnapshot).close();
            verify(indexSnapshot).close();
        }
예제 #29
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private static void logFileInStoreDirectoryDoesNotExist(java.io.File storeDir, org.neo4j.graphdb.DependencyResolver dependencyResolver) throws java.io.IOException
        private static void LogFileInStoreDirectoryDoesNotExist(File storeDir, DependencyResolver dependencyResolver)
        {
            FileSystemAbstraction fileSystem = dependencyResolver.ResolveDependency(typeof(FileSystemAbstraction));
            LogFiles storeLogFiles           = logFilesBasedOnlyBuilder(storeDir, fileSystem).build();

            assertFalse(storeLogFiles.VersionExists(0));
        }
예제 #30
0
 /// <summary>
 /// read file from directory
 /// </summary>
 public void ReadFiles()
 {
     foreach (string filePath in FilePaths)
     {
         LogFiles.Add(new LogFile(filePath));
     }
 }
예제 #31
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void createTransactionLogWithCheckpoint(org.neo4j.kernel.configuration.Config config, boolean logsInStoreDir) throws java.io.IOException
        private void CreateTransactionLogWithCheckpoint(Config config, bool logsInStoreDir)
        {
            Org.Neo4j.Storageengine.Api.StoreId storeId = SimulateStoreCopy();

            int fromTxId = 37;
            int endTxId  = fromTxId + 5;

            TransactionLogCatchUpWriter catchUpWriter = new TransactionLogCatchUpWriter(_databaseLayout, _fs, _pageCache, config, NullLogProvider.Instance, fromTxId, PartOfStoreCopyConflict, logsInStoreDir, true);

            // when
            for (int i = fromTxId; i <= endTxId; i++)
            {
                catchUpWriter.OnTxReceived(new TxPullResponse(ToCasualStoreId(storeId), Tx(i)));
            }

            catchUpWriter.Close();

            // then
            LogFilesBuilder logFilesBuilder = LogFilesBuilder.activeFilesBuilder(_databaseLayout, _fs, _pageCache);

            if (!logsInStoreDir)
            {
                logFilesBuilder.WithConfig(config);
            }
            LogFiles logFiles = logFilesBuilder.Build();

            VerifyTransactionsInLog(logFiles, fromTxId, endTxId);
            VerifyCheckpointInLog(logFiles, PartOfStoreCopyConflict);
        }
예제 #32
0
        //---------------------------------------------------------------------------------------------------------
        public bool UpdateNoInform(string LogFilePath, string LogFileName, byte DistributedProcess, string IpAddress, int ActUserId)
        {
            bool RetVal = false;

            try
            {
                if (this.CategoryId > 0)
                {
                    SqlCommand cmd = new SqlCommand("Categories_UpdateNoInform");
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.Add(new SqlParameter("@DistributedProcess", DistributedProcess));
                    cmd.Parameters.Add(new SqlParameter("@IpAddress", IpAddress));
                    cmd.Parameters.Add(new SqlParameter("@DisplayOrder", this.DisplayOrder));
                    cmd.Parameters.Add(new SqlParameter("@ParentCategoryId", this.ParentCategoryId));
                    cmd.Parameters.Add(new SqlParameter("@CategoryName", this.CategoryName));
                    cmd.Parameters.Add(new SqlParameter("@CategoryDesc", this.CategoryDesc));
                    cmd.Parameters.Add(new SqlParameter("@Url", this.Url));
                    cmd.Parameters.Add(new SqlParameter("@CategoryStatusId", this.CategoryStatusId));
                    cmd.Parameters.Add(new SqlParameter("@ImageIcon", this.ImageIcon));
                    cmd.Parameters.Add(new SqlParameter("@CrUserId", ActUserId));
                    cmd.Parameters.Add(new SqlParameter("@CrDateTime", this.CrDateTime));
                    cmd.Parameters.Add(new SqlParameter("@CategoryId", this.CategoryId));
                    db.ExecuteSQL(cmd);
                    RetVal = true;
                }
            }
            catch (Exception ex)
            {
                LogFiles.WriteLog(ex.Message, LogFilePath + "\\Exception", LogFileName + "." + this.GetType().Name + "." + MethodBase.GetCurrentMethod().Name);
            }
            return(RetVal);
        }
예제 #33
0
 public string Put(string cap_usr, string new_cap_usr)
 {
     int return_val = 0;
     LogFiles lf = new LogFiles();
     DBservices dbs = new DBservices();
     Rider rdr = new Rider();
     try
     {
         return_val = dbs.updateRiderInDatabase(rdr, cap_usr, new_cap_usr);
     }
     catch (Exception ex)
     {
         string Response = ("Error while trying to switch the Captain(user) " + cap_usr + " in the database: " + ex.Message);
         lf.Main("Users", Response);
         return "Error";
     }
     if (return_val == 0) { return "Error"; }
     return "Success";
 }
예제 #34
0
 public string Post([FromBody]Competition cmpt)
 {
     DBservices dbs = new DBservices();
     int return_val = 0;
     LogFiles lf = new LogFiles();
     List<Object> mlist = new List<Object>();
     mlist.Add(cmpt);
     try
     {
         return_val = dbs.InsertDatabase(mlist);
     }
     catch (Exception ex)
     {
         string Response = ("Error updating the Competition database " + ex.Message);
         lf.Main("Competition", Response);
         return "Error";
     }
     if (return_val == 0) { return "Error"; }
     return "Success";
 }
예제 #35
0
 public string updateDB([FromBody]Routes rut)
 {
     DBservices dbs = new DBservices();
     int return_val = 0;
     LogFiles lf = new LogFiles();
     List<Object> mlist = new List<Object>();
     mlist.Add(rut);
     try
     {
         return_val = dbs.InsertDatabase(mlist);
     }
     catch (Exception ex)
     {
         string Response = ("Error while trying to INSERT the new Route to the database " + ex.Message);
         lf.Main("Routes", Response);
         return "Error";
     }
     if (return_val == 0) { return "Error"; }
     return "Success";
 }
예제 #36
0
 public string updateDB([FromBody]Rides rds)
 {
     LogFiles lf = new LogFiles();
     if (DateTime.Now.Day.CompareTo(Convert.ToDateTime(rds.RideDate).Day) < 0 || DateTime.Now.Month.CompareTo(Convert.ToDateTime(rds.RideDate).Month) != 0) { lf.Main("Rides", "The Ride Date:" + rds.RideDate + " Can't be in the future or in a diffetent month "); return "Error"; }
     int return_val = 0;
     DBservices dbs = new DBservices();
     List<Object> mlist = new List<Object>();
     mlist.Add(rds);
     try
     {
         return_val = dbs.InsertDatabase(mlist);
     }
     catch (Exception ex)
     {
         string Response = ("Error while trying to INSERT the new Ride to the database " + ex.Message);
         lf.Main("Rides", Response);
         return "Error";
     }
     if (return_val == 0) { return "Error"; }
     return "Success";
 }
예제 #37
0
 public string DeleteOrganization(string orgname)
 {
     int return_val = 0;
     LogFiles lf = new LogFiles();
     DBservices dbs = new DBservices();
     string Response = "";
     orgname = orgname.Replace("'", "''");
     try
     {
         return_val = dbs.DeleteDatabase("Organizations", orgname);
     }
     catch (Exception ex)
     {
         Response = ("Error in the Delete process the Organization from the database " + ex.Message);
         lf.Main("Organizations", Response);
         return "Error";
     }
     Response = "The Organization " + orgname + " was Deleted from the Event";
     lf.Main("Organizations", Response);
     if (return_val == 0) { return "Error"; }
     return "Success";
 }
예제 #38
0
 public string DeleteEvent(string eventname)
 {
     int return_val = 0;
     LogFiles lf = new LogFiles();
     DBservices dbs = new DBservices();
     string Response = "";
     eventname = eventname.Replace("'", "''");
     try
     {
         return_val = dbs.DeleteDatabase("Event", eventname);
     }
     catch (Exception ex)
     {
         Response = ("Error in the Delete process the Event from an event database " + ex.Message);
         lf.Main("UserEvent", Response);
         return "Error";
     }
     Response = "The Event " + eventname + " was Deleted from the Event";
     lf.Main("UserEvent", Response);
     if (return_val == 0) { return "Error"; }
     return "Success";
 }
예제 #39
0
 public string Delete(string username, string routename)
 {
     DBservices dbs = new DBservices();
     int return_val = 0;
     LogFiles lf = new LogFiles();
     username = username.Replace("'", "''");
     string Response = "";
     try
     {
         return_val = dbs.DeleteDatabase("Routes",username, routename);
     }
     catch (Exception ex)
     {
         Response = ("Error in the Delete process of the Route " + routename + " of " + username + ", " + ex.Message);
         lf.Main("Routes", Response);
         return "Error";
     }
     Response = "The Route " + routename + " was Deleted from the Database";
     lf.Main("Routes", Response);
     if (return_val == 0) { return "Error"; }
     return "Success";
 }
예제 #40
0
 public string DeleteGroup(string grpname, string orgname)
 {
     int return_val = 0;
     LogFiles lf = new LogFiles();
     DBservices dbs = new DBservices();
     string Response = "";
     grpname = grpname.Replace("'", "''");
     orgname = orgname.Replace("'", "''");
     try
     {
         return_val = dbs.DeleteDatabase("Groups", grpname, orgname);
     }
     catch (Exception ex)
     {
         Response = ("Error in the Delete process the group from an event database " + ex.Message);
         lf.Main("Groups", Response);
         return "Error";
     }
     Response = "The Group " + grpname + " was Deleted from the Databse";
     lf.Main("Groups", Response);
     if (return_val == 0) { return "Error"; }
     return "Success";
 }
예제 #41
0
 public string RiderInEvent(string eventname, string username)
 {
     int return_val = 0;
     LogFiles lf = new LogFiles();
     DBservices dbs = new DBservices();
     eventname = eventname.Replace("'", "''");
     username = username.Replace("'", "''");
     try
     {
         return_val = dbs.updateRiderIneventDatabase(eventname, username);
     }
     catch (Exception ex)
     {
         string Response = ("Error while trying to Update the Rider(user) " + username + " to the event " + eventname + ", "+ ex.Message);
         lf.Main("UsersEvents", Response);
         return "Error";
     }
     if ( return_val == 0 ){return "Error";}
     return "Success";
 }
예제 #42
0
 public string updateDB([FromBody]Rider rdr)
 {
     int return_val = 0;
     LogFiles lf = new LogFiles();
     DBservices dbs = new DBservices();
     try
     {
         return_val = dbs.insertRider(rdr);
     }
     catch (Exception ex)
     {
         string Response = ("Error while trying to INSERT the new Rider(user) to the database " + ex.Message);
         lf.Main("Users", Response);
         return "Error";
     }
     if (return_val != 3) { return "Error"; }
     return "Success";
 }
예제 #43
0
 public string Put(string username, [FromBody]Rider rdr)
 {
     int return_val = 0;
     LogFiles lf = new LogFiles();
     DBservices dbs = new DBservices();
     username = username.Replace("'", "''");
     try
     {
         return_val = dbs.updateRiderInDatabase(rdr,username);
     }
     catch (Exception ex)
     {
         string Response = ("Error while trying to Update the Rider(user) " + username + " to the database " + ex.Message);
         lf.Main("Users", Response);
         return "Error";
     }
     if ( return_val == 0 ){return "Error";}
     return "Success";
 }
        private void Save()
        {
            LogFiles pc = new LogFiles();
            pc.Files = Logs.ToList();
            if (_cfg.AppSettings.Settings.AllKeys.Contains(ConfigConstants.FileLogs) == true)
                _cfg.AppSettings.Settings[ConfigConstants.FileLogs].Value = pc.GetSerialized();
            else
                _cfg.AppSettings.Settings.Add(ConfigConstants.FileLogs, pc.GetSerialized());

            _cfg.Save(ConfigurationSaveMode.Modified);
            ConfigurationManager.RefreshSection("appSettings");
        }
예제 #45
0
 public string Put(string eventname, [FromBody]Event evt)
 {
     int return_val = 0;
     LogFiles lf = new LogFiles();
     DBservices dbs = new DBservices();
     eventname = eventname.Replace("'", "''");
     try
     {
         return_val = dbs.updateEventInDatabase(evt, eventname);
     }
     catch (Exception ex)
     {
         string Response = ("Error while trying to Update the Event " + eventname + " to the database " + ex.Message);
         lf.Main("Events", Response);
         return "Error";
     }
     if (return_val == 0) { return "Error"; }
     return "Success";
 }
예제 #46
0
 public string updateDB([FromBody]Group grp)
 {
     DBservices dbs = new DBservices();
     int return_val = 0;
     LogFiles lf = new LogFiles();
     List<Object> mlist = new List<Object>();
     mlist.Add(grp);
     try
     {
         return_val = dbs.InsertDatabase(mlist);
     }
     catch (Exception ex)
     {
         string Response = ("Error updating the Group database " + ex.Message);
         lf.Main("Groups", Response);
         return "Error";
     }
     if (return_val == 0) { return "Error"; }
     return "Success";
 }