/// <summary> /// constructor /// </summary> public DefaultBatchController(string batchMainSettingsFileName) { if (string.IsNullOrWhiteSpace(batchMainSettingsFileName)) { //implement system exception MessageData messageData = new MessageData("fbce00050", Properties.Resources.fbce00050); Exception nullEx = new NullReferenceException(); logger.Error(messageData, nullEx); throw new Framework.SystemException(messageData, nullEx); } ConfigurationReader batchConfigReader; try { batchConfigReader = new Framework.BatchStaticCachedConfigurationReader(batchMainSettingsFileName); } catch (Exception readerEx) { //implement system exception MessageData messageData = new MessageData("fbce00052", Properties.Resources.fbce00052); logger.Error(messageData, readerEx); throw new Framework.SystemException(messageData, readerEx); } //set the BatchConfigurationDataTypeEnum.SetConfigurationReader(batchConfigReader); //check the settings file values and logg try { DefaultBatchApplicationInitializer.GetInstance().Init(); } catch (Exception ex) { if (ex is Framework.SystemException) //systemexception throw from mandatory check in initializer { Framework.SystemException sysEx = (Framework.SystemException)ex; logger.Error(sysEx.GetMessageData(), ex); ExitApplication(Properties.Settings.Default.SCHED_RETURN_IN_APPLICATION_INITIALIZER_SYSTEM_EXCEPTION); } else //unhandledexception throw from mandatory check in initializer { MessageData messageData = new MessageData("fbce00043", Properties.Resources.fbce00043); logger.Error(messageData, ex); ExitApplication(Properties.Settings.Default.SCHED_RETURN_IN_APPLICATION_INITIALIZER_UNHANDLED_EXCEPTION); } } }
/// <summary> /// check mandatory applicationsettings value /// </summary> private void CheckMandatorySettings(BatchConfigurationDataTypeEnum settingsdata, string messageCode, string message) { try { string settingValue = settingsdata.GetValue(); if (string.IsNullOrWhiteSpace(settingValue)) { MessageData messageData = new MessageData(messageCode, message, Properties.Resources.fbce00014); Framework.SystemException sysEx = new Framework.SystemException(messageData); throw sysEx; } } catch (Exception ex) { MessageData messageData = new MessageData(messageCode, message, Properties.Resources.fbce00015); Framework.SystemException sysEx = new Framework.SystemException(messageData, ex); throw sysEx; } }