Esempio n. 1
0
        /// <summary>
        /// Sets the exception manager
        /// </summary>
        /// <param name="exceptionManager">Exception manager</param>
        public static void SetExceptionManager(
            IExceptionManager exceptionManager)
        {
            exceptionManager.NotNull(nameof(exceptionManager));

            ExceptionPolicy.ExceptionManager = exceptionManager;
        }
Esempio n. 2
0
        public IExceptionManager GetIExceptionManager()
        {
            if (_exceptionManager == null)
            _exceptionManager = new ExceptionManager();

              return _exceptionManager;
        }
Esempio n. 3
0
 public WindPowerManager(IWindmillFarmsQuery windmillFarmsQuery, ISamplesTransmitterFactory transmitterFactory, ISampleGatherer sampleGatherer, IExceptionManager exceptionManager)
 {
     _windmillFarmsQuery = windmillFarmsQuery;
     _transmitterFactory = transmitterFactory;
     _sampleGatherer     = sampleGatherer;
     _exceptionManager   = exceptionManager;
 }
Esempio n. 4
0
		ExceptionListSettings(IExceptionManager exceptionManager, ISettingsManager settingsManager, Lazy<IDefaultExceptionSettings> defaultExceptionSettings) {
			this.exceptionManager = exceptionManager;
			this.settingsManager = settingsManager;
			this.defaultExceptionSettings = defaultExceptionSettings;
			exceptionManager.Changed += ExceptionManager_Changed;

			disableSaveCounter++;
			Load();
			disableSaveCounter--;
		}
Esempio n. 5
0
        public AddinController(ISessionManager sessionManager, IDsmSettingsManager settingsManager, IViewAdapter viewAdapter, IDteAdapter dteAdapter, 
            IExceptionManager exceptionManager)
        {
            _exceptionManager = exceptionManager;
              _viewAdapter = viewAdapter;
              _settingsManager = settingsManager;
              _dteAdapter = dteAdapter;
              _sessionManager = sessionManager;

              if (_sessionManager.CurrentSession != null)
            _selectedSessionName = _sessionManager.CurrentSession.Name;
        }
Esempio n. 6
0
        public FrmSessions(IDteAdapter dteAdapter, IDsmSettingsManager settings, IExceptionManager exceptionManager)
            : base()
        {
            InitializeComponent();

              splitContainer1.Panel2Collapsed = true;

              _dteAdapter = dteAdapter;
              _settings = settings;
              _exceptionManager = exceptionManager;

              ShowInTaskbar = false;
        }
Esempio n. 7
0
 internal SafeActionBlock(ILogger logger, IExceptionManager exceptionManager, int retryCount)
 {
     this.safeBlock = new SafeActionReturnBlock(logger, exceptionManager, retryCount);
 }
Esempio n. 8
0
 /// <summary>
 /// ��ʼ��ģ��
 /// </summary>
 /// <param name="framework">IFramework</param>
 /// <param name="setting">��Ӧ�����ý�</param>
 protected override void OnInit(IFramework framework, IConfigSetting setting)
 {
     base.OnInit(framework, setting);
     exceptionManager = this.GetExceptionManager();
 }
Esempio n. 9
0
		public ExceptionContext(IExceptionManager exceptionManager) {
			this.ExceptionManager = exceptionManager;
		}
Esempio n. 10
0
 private void SetupCriticalExceptions(IEnumerable <Exception> exceptions)
 {
     _options.Setup(o => o.CriticalExceptionTypes)
     .Returns(exceptions.Select(e => e.GetType().ToString()).ToList());
     _exceptionManager = new Implementations.ExceptionManager(_options.Object, _serverClient.Object);
 }
Esempio n. 11
0
 public FileController(IExceptionManager exceptionManager) : base(exceptionManager)
 {
 }
Esempio n. 12
0
 public RCommonAppService(ILogger logger, IExceptionManager exceptionManager, IUnitOfWorkScopeFactory unitOfWorkScopeFactory)
     : base(logger)
 {
     ExceptionManager       = exceptionManager;
     UnitOfWorkScopeFactory = unitOfWorkScopeFactory;
 }
Esempio n. 13
0
        /// <summary>
        /// Update a IncidentType
        /// </summary>
        /// <param name="currentUser"></param>
        /// <param name="user"></param>
        /// <param name="appID"></param>
        /// <param name="overrideID"></param>
        /// <param name="dc"></param>
        /// <param name="dataRepository"></param>
        /// <param name="uow"></param>
        public IncidentTypeVMDC UpdateIncidentType(string currentUser, string user, string appID, string overrideID, IncidentTypeDC dc, IRepository <IncidentType> dataRepository, IUnitOfWork uow, IExceptionManager exceptionManager, IMappingService mappingService)
        {
            try
            {
                #region Parameter validation

                // Validate parameters
                if (string.IsNullOrEmpty(currentUser))
                {
                    throw new ArgumentOutOfRangeException("currentUser");
                }
                if (string.IsNullOrEmpty(user))
                {
                    throw new ArgumentOutOfRangeException("user");
                }
                if (string.IsNullOrEmpty(appID))
                {
                    throw new ArgumentOutOfRangeException("appID");
                }
                if (null == dc)
                {
                    throw new ArgumentOutOfRangeException("dc");
                }
                if (null == dataRepository)
                {
                    throw new ArgumentOutOfRangeException("dataRepository");
                }
                if (null == uow)
                {
                    throw new ArgumentOutOfRangeException("uow");
                }
                if (null == exceptionManager)
                {
                    throw new ArgumentOutOfRangeException("exceptionManager");
                }
                if (null == mappingService)
                {
                    throw new ArgumentOutOfRangeException("mappingService");
                }

                #endregion

                using (uow)
                {
                    // Map data contract to model
                    IncidentType destination = mappingService.Map <IncidentTypeDC, IncidentType>(dc);

                    // Add the new item
                    dataRepository.Update(destination);

                    // Commit unit of work
                    uow.Commit();

                    // Map model back to data contract to return new row id.
                    dc = mappingService.Map <IncidentType, IncidentTypeDC>(destination);
                }

                // Create new data contract to return
                IncidentTypeVMDC returnObject = new IncidentTypeVMDC();

                // Add new item to datacontract
                returnObject.IncidentTypeItem = dc;

                // Commit unit of work
                return(returnObject);
            }
            catch (Exception e)
            {
                //Prevent exception from propogating across the service interface
                exceptionManager.ShieldException(e);

                return(null);
            }
        }
Esempio n. 14
0
 public GraphController(IGraphRepository repo, IExceptionManager logger) : base(repo)
 {
     _logger = logger;
 }
Esempio n. 15
0
        public CustomerService(IUnitOfWorkScopeFactory unitOfWorkScopeFactory, IEagerFetchingRepository <Customer> repository, ILogger <CustomerService> logger, IExceptionManager exceptionManager)
            : base(unitOfWorkScopeFactory, repository, logger, exceptionManager)
        {
            repository.DataStoreName = "TestDbContext";
            this._repository         = repository;

            this.AddRulesAndValidators();
        }
 public TestController(HumanCaptchaContext _context, IExceptionManager _exceptionManager)
 {
     this.context          = _context;
     this.exceptionManager = _exceptionManager;
 }
Esempio n. 17
0
 // GET api/<controller>
 public ValuesController(IExceptionManager exceptionManager) : base(exceptionManager)
 {
 }
Esempio n. 18
0
 public DiveTypeService(IUnitOfWorkScopeFactory unitOfWorkScopeFactory, IEagerFetchingRepository <DiveType> diveTypeRepository, ILogger <DiveTypeService> logger, IExceptionManager exceptionManager)
     : base(unitOfWorkScopeFactory, diveTypeRepository, logger, exceptionManager)
 {
     _diveTypeRepository = diveTypeRepository;
     _diveTypeRepository.DataStoreName = DataStoreDefinitions.Samples;
 }
Esempio n. 19
0
 /// <summary>
 /// Initialises a new instance of the <see cref="DeploymentService" /> class.
 /// </summary>
 /// <param name="pathToConfigurationFile">The path to configuration file.</param>
 /// <param name="repositoryManager">The repository manager.</param>
 /// <param name="projectBuilder">The project builder.</param>
 /// <param name="deploymentManager">The deployment manager.</param>
 /// <param name="exceptionManager">The exception manager.</param>
 /// <exception cref="System.ArgumentNullException">pathToConfigurationFile; A valid path to the configuration file has not been provided.</exception>
 public DeploymentService(string pathToConfigurationFile, IDistributedRevControlRepositoryManager repositoryManager, IProjectBuilder projectBuilder, IDeploymentManager deploymentManager, IExceptionManager exceptionManager)
     : this(pathToConfigurationFile, true, repositoryManager, projectBuilder, deploymentManager, exceptionManager)
 {
 }
Esempio n. 20
0
 public Trx2Any([Import("ExceptionManager")]IExceptionManager exceptionManager, [Import("Trx2AnyViewModel")]ITrx2AnyViewModel viewModel)
 {
     _exceptionManager = exceptionManager;
     _viewModel = viewModel;
 }
Esempio n. 21
0
		ExceptionsVM(IDebuggerSettings debuggerSettings, IExceptionManager exceptionManager, IExceptionListSettings exceptionListSettings, IGetNewExceptionName getNewExceptionName) {
			this.debuggerSettings = debuggerSettings;
			this.exceptionManager = exceptionManager;
			this.exceptionListSettings = exceptionListSettings;
			this.getNewExceptionName = getNewExceptionName;
			this.exceptionContext = new ExceptionContext(exceptionManager) {
				SyntaxHighlight = debuggerSettings.SyntaxHighlightExceptions,
			};
			this.exceptionsList = new ObservableCollection<ExceptionVM>();
			this.collectionView = CollectionViewSource.GetDefaultView(exceptionsList);
			debuggerSettings.PropertyChanged += DebuggerSettings_PropertyChanged;
			exceptionManager.Changed += ExceptionManager_Changed;
			InitializeDefaultExceptions();
		}
Esempio n. 22
0
 internal SafeActionBlock(ILogger logger, IExceptionManager exceptionManager, int retryCount)
 {
     this.safeBlock = new SafeActionReturnBlock(logger, exceptionManager, retryCount);
 }
Esempio n. 23
0
 public void Setup()
 {
     _serverClient     = new Mock <IServerClient>();
     _options          = new Mock <ExceptionManagerOptions>();
     _exceptionManager = new Implementations.ExceptionManager(_options.Object, _serverClient.Object);
 }
Esempio n. 24
0
 public OrderService(ILogger <OrderService> logger, IExceptionManager exceptionManager, IOrderRepository orderRepository) : base(logger, exceptionManager)
 {
     this._orderRepository = orderRepository;
 }
Esempio n. 25
0
 public ApiControllerBase(IExceptionManager exceptionManager)
 {
     ExceptionManager = exceptionManager;
 }
Esempio n. 26
0
 public CartController(ILog log, ICartService cartService, IExceptionManager exceptionManager)
 {
     _log         = log;
     _cartService = cartService;
     _exception   = exceptionManager;
 }
Esempio n. 27
0
        /// <summary>Implements the OnConnection method of the IDTExtensibility2 interface. Receives notification that the Add-in is being loaded.</summary>
        /// <param term='application'>Root object of the host application.</param>
        /// <param term='connectMode'>Describes how the Add-in is being loaded.</param>
        /// <param term='addInInst'>Object representing this Add-in.</param>
        /// <seealso class='IDTExtensibility2' />
        public void OnConnection(object application, ext_ConnectMode connectMode, object addInInst, ref Array custom)
        {
            try
              {
            _applicationObject = (DTE2)application;

            _addInInstance = (AddIn)addInInst;

            var container = new Container();

            _exceptionManager = container.GetIExceptionManager();

            _controller = container.GetAddinController(_applicationObject);

            _debugHook = container.GetDebugHook(_applicationObject);
            _debugHook.Hook();

            _settingsManager = container.GetIDsmSettingsManager();

            if ((connectMode == ext_ConnectMode.ext_cm_Startup) || (connectMode == ext_ConnectMode.ext_cm_AfterStartup))
            {
              //_settings = Settings.Default;
              //_settings.Reload();

              CommandBars commandBars = (CommandBars)_applicationObject.CommandBars;

              // Create a toolbar for this app
              string managerToolbarName = "Document Session Manager";
              managerToolbar = null;
              //try
              //{
              //  managerToolbar = ((Microsoft.VisualStudio.CommandBars.CommandBars)this._applicationObject.CommandBars)[managerToolbarName];
              //}
              //catch (ArgumentException)
              //{
              //}

              if (managerToolbar == null)
              {
            managerToolbar = (CommandBar)commandBars.Add(managerToolbarName, MsoBarPosition.msoBarTop, System.Type.Missing, true);

            _settingsManager.LoadSettings();
            managerToolbar.Position = (MsoBarPosition)Enum.Parse(typeof(MsoBarPosition),
              _settingsManager.DsmSettings.ToolBarPosition ?? MsoBarPosition.msoBarTop.ToString());
            managerToolbar.RowIndex = _settingsManager.DsmSettings.ToolBarRowIndex;
            managerToolbar.Visible = _settingsManager.DsmSettings.ToolBarVisible;

            if (_settingsManager.DsmSettings.ToolBarTop != -1)
              managerToolbar.Top = _settingsManager.DsmSettings.ToolBarTop;
            if (_settingsManager.DsmSettings.ToolBarLeft != -1)
              managerToolbar.Left = _settingsManager.DsmSettings.ToolBarLeft;
            //if (_settingsManager.DsmSettings.ToolBarWidth != -1)
            //  managerToolbar.Width = _settingsManager.DsmSettings.ToolBarWidth;
            //if (_settingsManager.DsmSettings.ToolBarHeight != -1)
            //  managerToolbar.Height = _settingsManager.DsmSettings.ToolBarHeight;

              }

              object controlCreated;

              _controlsCreated.Clear();

              //PictureManager.CommandButtons.Clear();

              AddCommand(managerToolbar, "DsmSessionList", "DsmSessionList",
            "Sessions", vsCommandControlType.vsCommandControlTypeDropDownCombo, 1,
            vsCommandStyle.vsCommandStyleComboCaseSensitive, 0, out controlCreated);

              CommandBarComboBox combo = controlCreated as CommandBarComboBox;
              if (combo != null)
            combo.Width = 200;

              AddCommand(managerToolbar, "DsmLoadSession", "DsmLoadSession",
            "Load session", vsCommandControlType.vsCommandControlTypeButton, 1,
            vsCommandStyle.vsCommandStylePict, 2, out controlCreated);

              AddCommand(managerToolbar, "DsmSaveSessionAs", "DsmSaveSessionAs",
            "Save session as", vsCommandControlType.vsCommandControlTypeButton, 2,
            vsCommandStyle.vsCommandStylePict, 6, out controlCreated);

              AddCommand(managerToolbar, "DsmSaveSession", "DsmSaveSession",
            "Save session", vsCommandControlType.vsCommandControlTypeButton, 3,
            vsCommandStyle.vsCommandStylePict, 5, out controlCreated);

              AddCommand(managerToolbar, "DsmDeleteSessions", "DsmDeleteSessions",
            "Delete sessions", vsCommandControlType.vsCommandControlTypeButton, 4,
            vsCommandStyle.vsCommandStylePict, 1, out controlCreated);

              AddCommand(managerToolbar, "DsmReloadSession", "DsmReloadSession",
            "Reload session", vsCommandControlType.vsCommandControlTypeButton, 5,
            vsCommandStyle.vsCommandStylePict, 4, out controlCreated);

              AddCommand(managerToolbar, "DsmRecentlyClosed", "DsmRecentlyClosed",
            "Recently closed documents", vsCommandControlType.vsCommandControlTypeButton, 6,
            vsCommandStyle.vsCommandStylePict, 3, out controlCreated);

            }
              }
              catch (Exception ex)
              {
            _exceptionManager.HandleException(ex);
              }
        }
Esempio n. 28
0
 public ArgumentChecker(IExceptionManager exceptionManager)
 {
     this.exceptionManager = exceptionManager;
 }
 private void MapException(Exception exception)
 {
     if (exception.InnerException is ComponentModelException)
         throw exception.InnerException;
     else {
         if (this.defaultExceptionManager == null) {
             //Type typeManager = this.GetTypeExceptionManager (this.VO.ExceptionManagerClassName);
             Type typeManager = this.GetTypeExceptionManager (this.ComponentModelDTO.ExceptionManagerClassName);
             this.defaultExceptionManager = (IExceptionManager) typeManager.GetConstructor (null).Invoke (null);
         }
         this.defaultExceptionManager.ProcessException (exception.InnerException);
     }
 }
Esempio n. 30
0
 public StoreController(ILog log, IStoreService storeService, IExceptionManager exception)
 {
     _log          = log;
     _storeService = storeService;
     _exception    = exception;
 }
Esempio n. 31
0
 private IExceptionManager GetExceptionManager()
 {
     lock(lockObject) {
         if(exceptionManager == null) {
             IFactory logFactory = (IFactory)this.framework.GetModule(this.setting["logModule"].Property["name"].Value);
             ILogManager logManager = (ILogManager)logFactory.GetManager();
             exceptionManager = CreateExceptionManager(this.setting, logManager);
         }
     }
     return exceptionManager;
 }
Esempio n. 32
0
        /// <summary>
        /// Update a Organisation
        /// </summary>
        /// <param name="currentUser"></param>
        /// <param name="user"></param>
        /// <param name="appID"></param>
        /// <param name="overrideID"></param>
        /// <param name="code"></param>
        /// <param name="lockID"></param>
        /// <param name="dataRepository"></param>
        /// <param name="uow"></param>
        public void DeleteOrganisation(string currentUser, string user, string appID, string overrideID, string code, string lockID, IRepository <Organisation> dataRepository, IUnitOfWork uow, IExceptionManager exceptionManager, IMappingService mappingService)
        {
            try
            {
                #region Parameter validation

                // Validate parameters
                if (string.IsNullOrEmpty(currentUser))
                {
                    throw new ArgumentOutOfRangeException("currentUser");
                }
                if (string.IsNullOrEmpty(user))
                {
                    throw new ArgumentOutOfRangeException("user");
                }
                if (string.IsNullOrEmpty(appID))
                {
                    throw new ArgumentOutOfRangeException("appID");
                }
                if (string.IsNullOrEmpty(code))
                {
                    throw new ArgumentOutOfRangeException("code");
                }
                if (string.IsNullOrEmpty(lockID))
                {
                    throw new ArgumentOutOfRangeException("lockID");
                }
                if (null == dataRepository)
                {
                    throw new ArgumentOutOfRangeException("dataRepository");
                }
                if (null == uow)
                {
                    throw new ArgumentOutOfRangeException("uow");
                }
                if (null == exceptionManager)
                {
                    throw new ArgumentOutOfRangeException("exceptionManager");
                }
                if (null == mappingService)
                {
                    throw new ArgumentOutOfRangeException("mappingService");
                }

                #endregion

                using (uow)
                {
                    // Convert string to guid
                    Guid codeGuid = Guid.Parse(code);

                    // Find item based on ID
                    Organisation dataEntity = dataRepository.Single(x => x.Code == codeGuid);

                    // Delete the item
                    dataRepository.Delete(dataEntity);

                    // Commit unit of work
                    uow.Commit();
                }
            }
            catch (Exception e)
            {
                //Prevent exception from propogating across the service interface
                exceptionManager.ShieldException(e);
            }
        }
Esempio n. 33
0
        /// <summary>
        /// Search for Organisation items
        /// </summary>
        /// <param name="currentUser"></param>
        /// <param name="user"></param>
        /// <param name="appID"></param>
        /// <param name="overrideID"></param>
        /// <param name="searchCriteria"></param>
        /// <param name="page"></param>
        /// <param name="pageSize"></param>
        /// <param name="includeInActive"></param>
        /// <param name="specification"></param>
        /// <param name="dataRepository"></param>
        /// <param name="uow"></param>
        /// <returns></returns>
        public OrganisationSearchVMDC SearchOrganisation(string currentUser, string user, string appID, string overrideID, OrganisationSearchCriteriaDC searchCriteria, int page, int pageSize, bool includeInActive,
                                                         ISpecification <Organisation> specification, ISpecification <Organisation> isActiveSpecification, IRepository <Organisation> dataRepository, IUnitOfWork uow, IExceptionManager exceptionManager, IMappingService mappingService)
        {
            try
            {
                #region Parameter validation

                // Validate parameters
                if (string.IsNullOrEmpty(currentUser))
                {
                    throw new ArgumentOutOfRangeException("currentUser");
                }
                if (string.IsNullOrEmpty(user))
                {
                    throw new ArgumentOutOfRangeException("user");
                }
                if (string.IsNullOrEmpty(appID))
                {
                    throw new ArgumentOutOfRangeException("appID");
                }
                if (null == dataRepository)
                {
                    throw new ArgumentOutOfRangeException("dataRepository");
                }
                if (null == specification)
                {
                    throw new ArgumentOutOfRangeException("specification");
                }
                if (null == uow)
                {
                    throw new ArgumentOutOfRangeException("uow");
                }
                if (null == exceptionManager)
                {
                    throw new ArgumentOutOfRangeException("exceptionManager");
                }
                if (null == mappingService)
                {
                    throw new ArgumentOutOfRangeException("mappingService");
                }

                #endregion

                using (uow)
                {
                    // Evaluate search criteria if supplied
                    if (null != searchCriteria)
                    {
                        EvaluateOrganisationSearchCriteria(searchCriteria, ref specification);
                    }

                    if (!includeInActive)
                    {
                        specification = specification.And(isActiveSpecification);
                    }

                    // Set default sort expression
                    System.Linq.Expressions.Expression <Func <Organisation, Object> > sortExpression = x => new { x.Name };

                    // Find all items that satisfy the specification created above.
                    IEnumerable <Organisation> dataEntities = dataRepository.Find(specification, sortExpression, page, pageSize);

                    // Get total count of items for search critera
                    int itemCount = dataRepository.Count(specification);

                    OrganisationSearchVMDC results = new OrganisationSearchVMDC();

                    // Convert to data contracts
                    List <OrganisationSearchMatchDC> destinations = mappingService.Map <IEnumerable <Organisation>, List <OrganisationSearchMatchDC> >(dataEntities);

                    results.MatchList      = destinations;
                    results.SearchCriteria = searchCriteria;
                    results.RecordCount    = itemCount;

                    return(results);
                }
            }
            catch (Exception e)
            {
                //Prevent exception from propogating across the service interface
                exceptionManager.ShieldException(e);

                return(null);
            }
        }
Esempio n. 34
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="currentUser"></param>
        /// <param name="user"></param>
        /// <param name="appID"></param>
        /// <param name="overrideID"></param>
        /// <param name="includeInActive"></param>
        /// <param name="specification"></param>
        /// <param name="dataRepository"></param>
        /// <param name="uow"></param>
        /// <returns></returns>
        public List <OrganisationDC> GetAllOrganisation(string currentUser, string user, string appID, string overrideID, bool includeInActive, ISpecification <Organisation> specification, ISpecification <Organisation> isActiveSpecification, IRepository <Organisation> dataRepository, IUnitOfWork uow, IExceptionManager exceptionManager, IMappingService mappingService)
        {
            try
            {
                #region Parameter validation

                // Validate parameters
                if (string.IsNullOrEmpty(currentUser))
                {
                    throw new ArgumentOutOfRangeException("currentUser");
                }
                if (string.IsNullOrEmpty(user))
                {
                    throw new ArgumentOutOfRangeException("user");
                }
                if (string.IsNullOrEmpty(appID))
                {
                    throw new ArgumentOutOfRangeException("appID");
                }
                if (null == dataRepository)
                {
                    throw new ArgumentOutOfRangeException("dataRepository");
                }
                if (null == specification)
                {
                    throw new ArgumentOutOfRangeException("specification");
                }
                if (null == uow)
                {
                    throw new ArgumentOutOfRangeException("uow");
                }
                if (null == exceptionManager)
                {
                    throw new ArgumentOutOfRangeException("exceptionManager");
                }
                if (null == mappingService)
                {
                    throw new ArgumentOutOfRangeException("mappingService");
                }

                #endregion

                using (uow)
                {
                    // Build specification
                    if (!includeInActive)
                    {
                        specification = specification.And(isActiveSpecification);
                    }

                    // Set default sort expression
                    System.Linq.Expressions.Expression <Func <Organisation, Object> > sortExpression = x => new { x.Name };

                    // Find all items that satisfy the specification created above.
                    IEnumerable <Organisation> dataEntities = dataRepository.Find(specification, sortExpression);

                    // Convert to data contracts
                    List <OrganisationDC> destinations = mappingService.Map <IEnumerable <Organisation>, List <OrganisationDC> >(dataEntities);

                    return(destinations);
                }
            }
            catch (Exception e)
            {
                //Prevent exception from propogating across the service interface
                exceptionManager.ShieldException(e);

                return(null);
            }
        }
Esempio n. 35
0
 public KUserFetcher(ISession session, IExceptionManager exceptionManager)
 {
     _session = session;
     _exceptionManager = exceptionManager;
 }
Esempio n. 36
0
        /// <summary>
        /// Retrieve a Organisation with associated lookups
        /// </summary>
        /// <param name="currentUser"></param>
        /// <param name="user"></param>
        /// <param name="appID"></param>
        /// <param name="overrideID"></param>
        /// <param name="code"></param>
        /// <param name="dataRepository"></param>
        /// <param name="uow"></param>
        /// <returns></returns>
        public OrganisationVMDC GetOrganisation(string currentUser, string user, string appID, string overrideID, string code, IUnitOfWork uow, IRepository <Organisation> dataRepository
                                                , IRepository <OrganisationType> organisationTypeRepository
                                                , IExceptionManager exceptionManager, IMappingService mappingService)

        {
            try
            {
                #region Parameter validation

                // Validate parameters
                if (string.IsNullOrEmpty(currentUser))
                {
                    throw new ArgumentOutOfRangeException("currentUser");
                }
                if (string.IsNullOrEmpty(user))
                {
                    throw new ArgumentOutOfRangeException("user");
                }
                if (string.IsNullOrEmpty(appID))
                {
                    throw new ArgumentOutOfRangeException("appID");
                }
                if (null == dataRepository)
                {
                    throw new ArgumentOutOfRangeException("dataRepository");
                }
                if (null == uow)
                {
                    throw new ArgumentOutOfRangeException("uow");
                }
                if (null == exceptionManager)
                {
                    throw new ArgumentOutOfRangeException("exceptionManager");
                }
                if (null == mappingService)
                {
                    throw new ArgumentOutOfRangeException("mappingService");
                }

                #endregion

                using (uow)
                {
                    OrganisationDC destination = null;

                    // If code is null then just return supporting lists
                    if (!string.IsNullOrEmpty(code))
                    {
                        // Convert code to Guid
                        Guid codeGuid = Guid.Parse(code);

                        // Retrieve specific Organisation
                        Organisation dataEntity = dataRepository.Single(x => x.Code == codeGuid);

                        // Convert to data contract for passing through service interface
                        destination = mappingService.Map <Organisation, OrganisationDC>(dataEntity);
                    }

                    IEnumerable <OrganisationType> organisationTypeList = organisationTypeRepository.GetAll(x => x.Name);

                    List <OrganisationTypeDC> organisationTypeDestinationList = mappingService.Map <List <OrganisationTypeDC> >(organisationTypeList);

                    // Create aggregate contract
                    OrganisationVMDC returnObject = new OrganisationVMDC();

                    returnObject.OrganisationItem     = destination;
                    returnObject.OrganisationTypeList = organisationTypeDestinationList;

                    return(returnObject);
                }
            }
            catch (Exception e)
            {
                //Prevent exception from propogating across the service interface
                exceptionManager.ShieldException(e);

                return(null);
            }
        }
Esempio n. 37
0
 public ViewAdapter(IDteAdapter dteAdapter, IDsmSettingsManager settings, IExceptionManager exceptionManager)
 {
     _settings = settings;
       _dteAdapter = dteAdapter;
       _exceptionManager = exceptionManager;
 }
Esempio n. 38
0
        /// <summary>
        ///  Create a Organisation
        /// </summary>
        /// <param name="currentUser"></param>
        /// <param name="user"></param>
        /// <param name="appID"></param>
        /// <param name="overrideID"></param>
        /// <param name="dc"></param>
        /// <param name="dataRepository"></param>
        /// <param name="uow"></param>
        public OrganisationVMDC CreateOrganisation(string currentUser, string user, string appID, string overrideID, OrganisationDC dc, IRepository <Organisation> dataRepository, IUnitOfWork uow, IExceptionManager exceptionManager, IMappingService mappingService)
        {
            try
            {
                #region Parameter validation

                // Validate parameters
                if (string.IsNullOrEmpty(currentUser))
                {
                    throw new ArgumentOutOfRangeException("currentUser");
                }
                if (string.IsNullOrEmpty(user))
                {
                    throw new ArgumentOutOfRangeException("user");
                }
                if (string.IsNullOrEmpty(appID))
                {
                    throw new ArgumentOutOfRangeException("appID");
                }
                if (null == dc)
                {
                    throw new ArgumentOutOfRangeException("dc");
                }
                if (null == dataRepository)
                {
                    throw new ArgumentOutOfRangeException("dataRepository");
                }
                if (null == uow)
                {
                    throw new ArgumentOutOfRangeException("uow");
                }
                if (null == exceptionManager)
                {
                    throw new ArgumentOutOfRangeException("exceptionManager");
                }
                if (null == mappingService)
                {
                    throw new ArgumentOutOfRangeException("mappingService");
                }

                #endregion

                using (uow)
                {
                    // Create a new ID for the Organisation item
                    dc.Code = Guid.NewGuid();

                    // Map data contract to model
                    Organisation destination = mappingService.Map <OrganisationDC, Organisation>(dc);

                    // Add the new item
                    dataRepository.Add(destination);

                    // Commit unit of work
                    uow.Commit();

                    // Map model back to data contract to return new row id.
                    dc = mappingService.Map <Organisation, OrganisationDC>(destination);
                }

                // Create aggregate data contract
                OrganisationVMDC returnObject = new OrganisationVMDC();

                // Add new item to aggregate
                returnObject.OrganisationItem = dc;

                return(returnObject);
            }
            catch (Exception e)
            {
                //Prevent exception from propogating across the service interface
                exceptionManager.ShieldException(e);

                return(null);
            }
        }
Esempio n. 39
0
 public Trx2Excel([Import("ExceptionManager")] IExceptionManager exceptionManager)
 {
     _exceptionManager = exceptionManager;
 }
Esempio n. 40
0
        /// <summary>
        /// Initialises a new instance of the <see cref="DeploymentService" /> class.
        /// </summary>
        /// <param name="pathToConfigurationFile">The path to configuration file.</param>
        /// <param name="readConfigurationAndCheckForUpdates">if set to <c>true</c> [read configuration and check for updates].</param>
        /// <param name="repositoryManager">The repository manager.</param>
        /// <param name="projectBuilder">The project builder.</param>
        /// <param name="deploymentManager">The deployment manager.</param>
        /// <param name="exceptionManager">The exception manager.</param>
        /// <exception cref="System.ArgumentNullException">pathToConfigurationFile; A valid path to the configuration file has not been provided.</exception>
        public DeploymentService(string pathToConfigurationFile, bool readConfigurationAndCheckForUpdates, IDistributedRevControlRepositoryManager repositoryManager, IProjectBuilder projectBuilder, IDeploymentManager deploymentManager, IExceptionManager exceptionManager)
        {
            _repositoryManager = repositoryManager;
            _projectBuilder    = projectBuilder;
            _deploymentManager = deploymentManager;
            _exceptionManager  = exceptionManager;

            if (pathToConfigurationFile == null)
            {
                throw new ArgumentNullException("pathToConfigurationFile", "A valid path to the configuration file has not been provided.");
            }
            else
            {
                _pathToConfigurationFile = pathToConfigurationFile;
                if (readConfigurationAndCheckForUpdates)
                {
                    ReadConfigurationFromFile();
                    CheckRepositoriesForUpdates();
                }
            }
        }