Ejemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BasicRepository{T}"/> class.
 /// </summary>
 /// <param name="dbFunction">
 /// The db function.
 /// </param>
 /// <param name="dbAccess">
 /// The db Access.
 /// </param>
 /// <param name="raiseEvent">
 /// The raise Event.
 /// </param>
 /// <param name="haveBoardId">
 /// The have Board Id.
 /// </param>
 public BasicRepository(IDbFunction dbFunction, IDbAccess dbAccess, IRaiseEvent raiseEvent, IHaveBoardID haveBoardId)
 {
     this.DbFunction = dbFunction;
     this.DbAccess   = dbAccess;
     this.DbEvent    = raiseEvent;
     this.BoardID    = haveBoardId.BoardID;
 }
Ejemplo n.º 2
0
 public FtpState(IRaiseEvent h, int e, FileInfo fname)
 {
     _mHandler = h;
     _eventId = e;
     MData = new MemoryStream();
     FileName = fname;
 }
Ejemplo n.º 3
0
        //--------------------------------------------------------------------------------------
        public static bool WriteFile(IRaiseEvent bh, int t, FileInfo fileInfo, byte[] buffer, bool rename)
        {
            try
            {
                if (fileInfo.Exists)
                {
                    if (rename)
                    {
                        DateTime td = DateTime.Now;
                        int index = fileInfo.FullName.LastIndexOf('.');
                        string newName = fileInfo.FullName.Remove(index, fileInfo.FullName.Length - index);
                        newName = newName + td.ToString("MMddHHmmss") + ".txt";
                        fileInfo.CopyTo(newName);
                    }
                    else
                    {
                        fileInfo.Delete();
                    }
                }

                FileReadWriteState ws = new FileReadWriteState(bh, t, fileInfo);
                ws.mFileStream = new FileStream(fileInfo.FullName, FileMode.Create, FileAccess.Write, FileShare.None, BUFFER_SIZE, true);

                IAsyncResult asyncResult = ws.mFileStream.BeginWrite(
                        buffer, 0, buffer.Length,
                        new AsyncCallback(WriteFileComplete), ws);
            }
            catch (Exception e)
            {
                FileReadWriteState st = new FileReadWriteState(bh, t, fileInfo);
                st.RaiseException(e);
            }
               return true;
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="HttpRuntimeCache"></see>
        ///   class.
        /// </summary>
        /// <param name="eventRaiser">
        /// The event raiser.
        /// </param>
        /// <param name="haveLockObject">
        /// The have lock object.
        /// </param>
        /// <param name="treatCacheKey">
        /// The treat Cache Key.
        /// </param>
        public HttpRuntimeCache(
            [NotNull] IRaiseEvent eventRaiser,
            [NotNull] IHaveLockObject haveLockObject,
            [NotNull] ITreatCacheKey treatCacheKey)
        {
            CodeContracts.VerifyNotNull(eventRaiser, "eventRaiser");
            CodeContracts.VerifyNotNull(haveLockObject, "haveLockObject");

            this._eventRaiser    = eventRaiser;
            this._haveLockObject = haveLockObject;
            this._treatCacheKey  = treatCacheKey;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="HttpRuntimeCache"></see>
        ///   class.
        /// </summary>
        /// <param name="eventRaiser">
        /// The event raiser.
        /// </param>
        /// <param name="haveLockObject">
        /// The have lock object.
        /// </param>
        /// <param name="treatCacheKey">
        /// The treat Cache Key.
        /// </param>
        public HttpRuntimeCache(
      [NotNull] IRaiseEvent eventRaiser, 
      [NotNull] IHaveLockObject haveLockObject, 
      [NotNull] ITreatCacheKey treatCacheKey)
        {
            CodeContracts.ArgumentNotNull(eventRaiser, "eventRaiser");
              CodeContracts.ArgumentNotNull(haveLockObject, "haveLockObject");

              this._eventRaiser = eventRaiser;
              this._haveLockObject = haveLockObject;
              this._treatCacheKey = treatCacheKey;
        }
Ejemplo n.º 6
0
        //--------------------------------------------------------------------------------------
        public static void ReadFile(IRaiseEvent bh, int t, FileInfo fileInfo)
        {
            try
            {
                if (fileInfo.Exists)
                {
                    FileReadWriteState ws = new FileReadWriteState(bh, t, fileInfo);
                    ws.mFileStream = new FileStream(fileInfo.FullName, FileMode.Open, FileAccess.Read);

                    IAsyncResult asyncResult = ws.mFileStream.BeginRead(
                                ws.mBuffer, 0, ws.mBuffer.Length,
                                new AsyncCallback(ReadFileComplete), ws);
                }
                else
                {
                    throw new Exception("File: " + fileInfo.FullName + " does not exist");
                }
            }
            catch (Exception e)
            {
                FileReadWriteState st = new FileReadWriteState(bh, t, fileInfo);
                st.RaiseException(e);
            }
        }
Ejemplo n.º 7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="InstallUpgradeService" /> class.
 /// </summary>
 /// <param name="serviceLocator">The service locator.</param>
 /// <param name="raiseEvent">The raise Event.</param>
 /// <param name="dbAccess">The database access.</param>
 public InstallUpgradeService(IServiceLocator serviceLocator, IRaiseEvent raiseEvent, IDbAccess dbAccess)
 {
     this.RaiseEvent     = raiseEvent;
     this.DbAccess       = dbAccess;
     this.ServiceLocator = serviceLocator;
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="InstallUpgradeService" /> class.
 /// </summary>
 /// <param name="serviceLocator">The service locator.</param>
 /// <param name="raiseEvent">The raise Event.</param>
 /// <param name="dbAccess">The database access.</param>
 public InstallUpgradeService(IServiceLocator serviceLocator, IRaiseEvent raiseEvent, IDbAccess dbAccess)
 {
     this.RaiseEvent = raiseEvent;
     this.DbAccess = dbAccess;
     this.ServiceLocator = serviceLocator;
 }
Ejemplo n.º 9
0
 public EmailDetails(IRaiseEvent h, int eventId)
 {
     mHandler = h;
     mEventId = eventId;
 }
Ejemplo n.º 10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="InstallUpgradeService"/> class.
 /// </summary>
 /// <param name="serviceLocator">
 /// The service locator.
 /// </param>
 /// <param name="raiseEvent">
 /// The raise Event.
 /// </param>
 public InstallUpgradeService(IServiceLocator serviceLocator, IRaiseEvent raiseEvent)
 {
     this.RaiseEvent = raiseEvent;
     this.ServiceLocator = serviceLocator;
 }
Ejemplo n.º 11
0
 public FtpState(IRaiseEvent h, int e, FileInfo fname)
 {
     mHandler = h;
     eventId = e;
     mFileName = fname;
 }
Ejemplo n.º 12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="InstallUpgradeService"/> class.
 /// </summary>
 /// <param name="serviceLocator">
 /// The service locator.
 /// </param>
 /// <param name="raiseEvent">
 /// The raise Event.
 /// </param>
 public InstallUpgradeService(IServiceLocator serviceLocator, IRaiseEvent raiseEvent)
 {
     this.RaiseEvent     = raiseEvent;
     this.ServiceLocator = serviceLocator;
 }
Ejemplo n.º 13
0
 public MessageDetails(IRaiseEvent h, int eventId)
 {
     _mHandler = h;
     _mEventId = eventId;
 }
Ejemplo n.º 14
0
 public FileReadWriteState(IRaiseEvent bh, int t, FileInfo file)
 {
     mHandler = bh;
     mEventT = t;
     mFileInfo = file;
 }
Ejemplo n.º 15
0
        /// <summary>
        /// Raises the event that matches the specified contract name passing the <see cref="EventArgs.Empty"/> event data.
        /// </summary>
        /// <param name="raise">The event broker.</param>
        /// <param name="contractName">The contract name of the event to raise.</param>
        /// <param name="sender">The source of the event.</param>
        /// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
        /// <returns>The <see cref="Task"/> that represents the asynchronous operation.</returns>
        public static Task RaiseAsync(this IRaiseEvent raise, string contractName, object sender, CancellationToken cancellationToken = default)
        {
            Requires.NotNull(raise, nameof(raise));

            return(raise.RaiseAsync(contractName, sender, EventArgs.Empty, cancellationToken));
        }
Ejemplo n.º 16
0
        /// <summary>
        /// Raises the event that matches the specified contract name passing the <see cref="EventArgs.Empty"/> event data.
        /// </summary>
        /// <param name="raise">The event broker.</param>
        /// <param name="contractName">The contract name of the event to raise.</param>
        /// <param name="sender">The source of the event.</param>
        public static void Raise(this IRaiseEvent raise, string contractName, object sender)
        {
            Requires.NotNull(raise, nameof(raise));

            raise.Raise(contractName, sender, EventArgs.Empty);
        }