예제 #1
0
 public Boolean TableSyncTerminal(Replica replica, ReplicaLog replicaLog)
 {
     SqlDatabaseDA sqlDatabaseAccess = new SqlDatabaseDA(replica.StrTerminalUser, replica.StrTerminalPassword, replica.StrTerminalIPAddress, replica.IntTerminalPort.ToString(), replica.StrTerminalDatabase);
     return sqlDatabaseAccess.TableSync(replica.StrSourceTable, replicaLog.StrReplicaTransaction);
 }
예제 #2
0
 public Boolean SetReplicaTerminalLogSync(Replica replica, ReplicaLog oreplicaLog)
 {
     SqlDatabaseDA sqlDatabaseAccess = new SqlDatabaseDA(replica.StrTerminalUser, replica.StrTerminalPassword, replica.StrTerminalIPAddress, replica.IntTerminalPort.ToString(), replica.StrTerminalDatabase);
     return sqlDatabaseAccess.SetReplicaLogSync(oreplicaLog);
 }
예제 #3
0
 public Boolean SetReplicaSourceLogSync(Replica replica,ReplicaLog oreplicaLog)
 {
     SqlDatabaseDA sqlDatabaseAccess = new SqlDatabaseDA(replica.StrSourceUser, replica.StrSourcePassword, replica.StrSourceIPAddress, replica.IntSourcePort.ToString(), replica.StrSourceDatabase);
     return sqlDatabaseAccess.SetReplicaLogSync(oreplicaLog);
 }
        public Boolean SetReplicaLogSync(ReplicaLog oreplicaLog)
        {
            Boolean result = false;

            string strQuery = string.Empty;

            try
            {
                this.OpenConnection();

                strQuery = "UPDATE ReplicaLog SET IsSynchronized = 1 WHERE idReplicaLog = " + oreplicaLog.IntIdReplicaLog.ToString();

                MySqlCommand cmdComando = new MySqlCommand(strQuery, this._oConnection);
                cmdComando.ExecuteNonQuery();

                result = true;

            }
            catch (Exception ex)
            {
                this._oLogErrors.GuardarLog(IConstantes.TIPOCAPA.ACCESODATOS, this.GetType().ToString(), MethodInfo.GetCurrentMethod().Name, ex.Message, strQuery);
            }
            finally
            {
                this.CloseConnection();
            }

            return result;
        }
        /// <summary>
        /// Return all logs that have not been synchronized
        /// </summary>
        /// <returns>A list of all the ReplicasLogs on the data base</returns>
        public List<ReplicaLog> GetReplicaLogsUnsynchronized(string strTable)
        {
            ReplicaLog oReplicaLog = new ReplicaLog();
            List<ReplicaLog> listResult = new List<ReplicaLog>();

            string strQuery = string.Empty;
            MySqlDataReader dtrResult = null;
            DataTable dtResult = new DataTable();

            try
            {
                this.OpenConnection();

                strQuery = "SELECT idReplicaLog,  ReplicaTable,  ReplicaDatetime,  ReplicaTransaction, IsSynchronized FROM ReplicaLog WHERE IsSynchronized = 0 and ReplicaTable = '"+strTable.Trim()+"';";

                MySqlCommand cmdComando = new MySqlCommand(strQuery, this._oConnection);
                dtrResult = cmdComando.ExecuteReader();

                //Load the Results on the DataTable
                dtResult.Load(dtrResult);

                foreach (DataRow dtrFila in dtResult.Rows)
                {
                    oReplicaLog = new ReplicaLog();

                    oReplicaLog.IntIdReplicaLog = Convert.ToInt32(dtrFila["idReplicaLog"].ToString());
                    oReplicaLog.StrReplicaTable = dtrFila["ReplicaTable"].ToString();
                    oReplicaLog.DtReplicaDatetime = Convert.ToDateTime(dtrFila["ReplicaDatetime"].ToString());
                    oReplicaLog.StrReplicaTransaction = dtrFila["ReplicaTransaction"].ToString();
                    oReplicaLog.BlnIsSynchronized = Convert.ToBoolean(dtrFila["IsSynchronized"]);

                    listResult.Add(oReplicaLog);
                }
            }
            catch (Exception ex)
            {
                this._oLogErrors.GuardarLog(IConstantes.TIPOCAPA.ACCESODATOS, this.GetType().ToString(), MethodInfo.GetCurrentMethod().Name, ex.Message, strQuery);
            }
            finally
            {
                this.CloseConnection();
            }

            return listResult;
        }
 public Boolean TableSyncSource(Replica replica, ReplicaLog replicaLog)
 {
     MysqlDatabaseDA sqlDatabaseAccess = new MysqlDatabaseDA(replica.StrSourceUser, replica.StrSourcePassword, replica.StrSourceIPAddress, replica.IntSourcePort.ToString(), replica.StrSourceDatabase);
     return sqlDatabaseAccess.TableSync(replica.StrSourceTable, replicaLog.StrReplicaTransaction);
 }