예제 #1
0
        /// <summary>
        /// Sets the data version poll.
        /// </summary>
        /// <param name="version">The version.</param>
        /// <param name="server">The server.</param>
        public void SetDataVersionPoll(int version, string server)
        {
            Sproc procedure = new Sproc("InsertDataVersionPoll", DatabaseName);

            procedure.Parameters.Add("@version", SqlDbType.Int).Value = version;
            procedure.Parameters.Add("@server", SqlDbType.Char).Value = server;
            procedure.ExecuteNonQuery();
        }
예제 #2
0
        /// <summary>
        /// Gets the data version info.
        /// </summary>
        /// <returns>The latest data version and timestamp</returns>
        public KeyValuePair <int, DateTime> GetDataVersionInfo()
        {
            string versionParameter   = "@version";
            string timestampParameter = "@timestamp";

            Sproc procedure = new Sproc("SelectDataVersion", DatabaseName);

            procedure.Parameters.Add(versionParameter, SqlDbType.Int).Direction        = ParameterDirection.Output;
            procedure.Parameters.Add(timestampParameter, SqlDbType.DateTime).Direction = ParameterDirection.Output;

            procedure.ExecuteNonQuery();

            int      versionId = Convert.ToInt32(procedure.Parameters[versionParameter].Value);
            DateTime versionTimestamp;

            DateTime.TryParse(procedure.Parameters[timestampParameter].Value.ToString(), out versionTimestamp);

            KeyValuePair <int, DateTime> result = new KeyValuePair <int, DateTime>(versionId, versionTimestamp);

            return(result);
        }