Esempio n. 1
0
        /// <summary>
        /// Validates Batch Processing Settings
        /// </summary>
        /// <returns></returns>
        public static HttpResponseMessage ValidateBatchProcessingSettings(ConfigurationModel configurationModel)
        {
            try
            {
                var batchProcessingTypes = configurationModel.CampusLogicSection.BatchProcessingTypesList;

                foreach (var batchProcessingType in batchProcessingTypes)
                {
                    var paths = batchProcessingType.BatchProcesses.Select(b => b.FilePath);

                    foreach (var path in paths)
                    {
                        if (string.IsNullOrEmpty(path))
                        {
                            throw new Exception();
                        }
                        else
                        {
                            FileStoreManager documentManager = new FileStoreManager();
                            if (!documentManager.ValidateDirectory(path))
                            {
                                throw new Exception();
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                logger.Error(e);
                return(new HttpResponseMessage(HttpStatusCode.ExpectationFailed));
            }

            return(new HttpResponseMessage(HttpStatusCode.OK));
        }
Esempio n. 2
0
        /// <summary>
        /// Validates the File Store Settings
        /// </summary>
        /// <param name="settings"></param>
        /// <returns></returns>
        public static HttpResponseMessage ValidateAwardLetterPrintSettings(AwardLetterPrintSettings settings)
        {
            try
            {
                if (settings.AwardLetterPrintEnabled == null)
                {
                    throw new Exception();
                }

                if (string.IsNullOrEmpty(settings.AwardLetterPrintFilePath))
                {
                    throw new Exception();
                }
                else
                {
                    FileStoreManager documentManager = new FileStoreManager();
                    if (!documentManager.ValidateDirectory(settings.AwardLetterPrintFilePath))
                    {
                        throw new Exception();
                    }
                }
            }
            catch (Exception exception)
            {
                logger.Error(exception);
                return(new HttpResponseMessage(HttpStatusCode.ExpectationFailed));
            }

            return(new HttpResponseMessage(HttpStatusCode.OK));
        }