Example #1
0
 public DocumentProvision(IDocumentRepository docRepository,
                          IUserRepository userRepository,
                          IUploadHelperFunctions uploadHelperFunctions,
                          IOptions <GeneralSettings> generalSettings,
                          IOptions <DocumentSettings> documentSettings,
                          ICustomLogger customLogger,
                          IOptions <SearchSettings> searchSettings,
                          IConfigurationRoot configuration,
                          IHttpContextAccessor httpContextAccessor,
                          ISPOAuthorization spoAuthorization,
                          IOptions <LogTables> logTables, IOptions <ErrorSettings> errorSettings)
 {
     this.docRepository         = docRepository;
     this.uploadHelperFunctions = uploadHelperFunctions;
     this.userRepository        = userRepository;
     this.generalSettings       = generalSettings.Value;
     this.documentSettings      = documentSettings.Value;
     this.customLogger          = customLogger;
     this.logTables             = logTables.Value;
     this.errorSettings         = errorSettings.Value;
     this.searchSettings        = searchSettings.Value;
     this.configuration         = configuration;
     this.httpContextAccessor   = httpContextAccessor;
     this.spoAuthorization      = spoAuthorization;
 }
Example #2
0
        internal static void SendMessage(ErrorSettings setting, String subject, String body)
        {
            MailMessage message = new MailMessage();

            message.IsBodyHtml = true;
            message.Body       = body;
            message.From       = new MailAddress(setting.SenderMail, setting.SenderName);
            message.Priority   = MailPriority.High;
            message.ReplyTo    = new MailAddress(setting.ReplyTo);
            message.Subject    = subject;
            message.To.Add(new MailAddress(setting.RecipientMail));
            try
            {
                SmtpClient client = new SmtpClient(setting.HostSMTP, (setting.Port > 0) ? setting.Port : 25);
                client.EnableSsl = setting.UseSsl;
                if (setting.UseAuthentication && !String.IsNullOrEmpty(setting.AccountName))
                {
                    client.Credentials = new System.Net.NetworkCredential(setting.AccountName, setting.AccountPassword);
                }
                client.Send(message);
            }
            catch (Exception ex)
            {
                System.Diagnostics.EventLog.WriteEntry("SendMessage: ", ex.Message);
                throw ex;
            }
        }
Example #3
0
 /// <summary>
 /// Handle the upload functionality.
 /// </summary>
 /// <param name="mailSettings"></param>
 /// <param name="errorSettings"></param>
 /// <param name="documentRepository"></param>
 /// <param name="generalSettings"></param>
 public UploadHelperFunctionsUtility(IOptions <MailSettings> mailSettings, IOptions <ErrorSettings> errorSettings, IDocumentRepository documentRepository, IOptions <GeneralSettings> generalSettings)
 {
     this.mailSettings       = mailSettings.Value;
     this.errorSettings      = errorSettings.Value;
     this.documentRepository = documentRepository;
     this.generalSettings    = generalSettings.Value;
 }
        public FirstRunWizard()
        {
            InitializeComponent();
            settings          = PersonalSettings.Default();
            dbsetup1.Settings = settings;
            foreach (var x in settings.ErrorSettings)
            {
                ErrorSettings.AddItem(x);
            }
            tbMainIntro.Text = @"Thank you for downloading KryGamesBot.

It looks like this is the first time you're using KryGamesBot on this computer, so we need to do a little bit of setup first.

If you would like to use completely default settings, you can cancel this Wizard now. If you would like to configure the bot, click next.

All the settings you will configure in this wizard can also be configured from the settings menu.";

            tbPortable.Text = @"Would you like to run KryGamesBot in portable mode?

In portable mode, all settings are stored in the root folder of the application and can be taken with one a flash drive etc. Whenever you update KryGamesBot, you will need to copy all settings accross or you will need to re-configure from scratch.

In normal mode, settings are stored in your application settings, thus cannot be easily copied over, but any update will not cause you to lose your settings.";

            tbKeepasstmp.Text = @"If you are using KeePass 2 to manage your passwords, you can open your passwords database using KryGamesBot to simplify your login experience.";

            tbNotificationsTmp.Text = @"KryGamesBot can show and send notifications when certain events happen. Here you can configure which kind of notification should happen for different events.";
            tbErrorsTmp.Text        = @"Unfortunately, errors are unavoidable. But luckily you can tell the bot what to do when it experiences some kind of error.";
            tbFinished.Text         = @"That's it!

You're all set up and ready to start. Finish this wizard to choose the site you want to play at and start betting!";

            DataContext = this;
            //DevExpress.Xpf.Core.Theme.Themes
        }
 public ValidationFunctions(ISPList spList, IOptions <MatterSettings> matterSettings,
                            IOptions <ErrorSettings> errorSettings, IMatterRepository matterRespository,
                            IOptions <ListNames> listNames, IOptions <CamlQueries> camlQueries)
 {
     this.matterSettings    = matterSettings.Value;
     this.spList            = spList;
     this.errorSettings     = errorSettings.Value;
     this.matterRespository = matterRespository;
     this.listNames         = listNames.Value;
     this.camlQueries       = camlQueries.Value;
 }
        public void ShowError(string obj, ErrorSettings errorSettings)
        {
            Log.Error(obj, new Exception(obj));

            IoCContainer.Kernel.Get <IWaitOverlayProvider>().DisposeAll();
            IoCContainer.Kernel.Get <IQuestionWindowService>().Close();
            IoCContainer.Kernel.Get <IEnterPinWindowService>().Close();
            try
            {
                Thread newWindowThread = new Thread(() =>
                {
                    SynchronizationContext.SetSynchronizationContext(new DispatcherSynchronizationContext(Dispatcher.CurrentDispatcher));

                    var window       = MyRegionManager.FindWindowByViewModel <ErrorMessageViewModel>(false);
                    var Model        = (ErrorMessageViewModel)window.DataContext;
                    Model.Dispatcher = new MyDispatcher(Dispatcher.CurrentDispatcher);
                    Models.Add(Model);
                    MaximizeWindow(window);
                    Model.Text       = obj;
                    Model.ErrorLevel = errorSettings.ErrorLevel;

                    Model.TextAligment      = errorSettings.TextAligment;
                    Model.WarningVisibility = errorSettings.WarningVisibility;
                    Model.YesButtonTime     = errorSettings.AddCounterSeconds;
                    Model.ShowButtons       = errorSettings.HideButtons ? Visibility.Collapsed : Visibility.Visible;
                    Model.OkClick          += errorSettings.OkClick;
                    if (errorSettings.CreateButtonEvent)
                    {
                        Mediator.SendMessage <bool>(true, "PrinterErrorValue");
                        window.Closed += window_Closed;
                    }
                    window.Closed -= window_Closed2;
                    window.ShowDialog();
                    Models.Remove(Model);
                });

                newWindowThread.SetApartmentState(ApartmentState.STA);
                newWindowThread.IsBackground = true;

                newWindowThread.Start();
                var dispatcher = Dispatcher.FromThread(newWindowThread);
                do
                {
                    Thread.Sleep(10);
                    dispatcher = Dispatcher.FromThread(newWindowThread);
                }while (dispatcher == null);
            }
            catch (Exception ex)
            {
                Log.Error(ex.Message, ex);
            }
        }
Example #7
0
 /// <summary>
 /// Controlls the functionality for email related.
 /// </summary>
 /// <param name="errorSettings"></param>
 /// <param name="customLogger"></param>
 /// <param name="matterCenterServiceFunctions"></param>
 /// <param name="logTables"></param>
 /// <param name="documentProvision"></param>
 /// <param name="documentSettings"></param>
 public EmailController(IOptions <ErrorSettings> errorSettings,
                        ICustomLogger customLogger,
                        IMatterCenterServiceFunctions matterCenterServiceFunctions,
                        IOptions <LogTables> logTables, IDocumentProvision documentProvision,
                        IOptions <DocumentSettings> documentSettings)
 {
     this.errorSettings = errorSettings.Value;
     this.matterCenterServiceFunctions = matterCenterServiceFunctions;
     this.customLogger      = customLogger;
     this.logTables         = logTables.Value;
     this.documentProvision = documentProvision;
     this.documentSettings  = documentSettings.Value;
 }
 public MatterProvision(IMatterRepository matterRepositoy, IOptions <MatterSettings> matterSettings, IOptions <ErrorSettings> errorSettings,
                        ISPOAuthorization spoAuthorization, IEditFunctions editFunctions, ValidationFunctions validationFunctions,
                        ICustomLogger customLogger, IOptions <LogTables> logTables, IOptions <MailSettings> mailSettings)
 {
     this.matterRepositoy     = matterRepositoy;
     this.matterSettings      = matterSettings.Value;
     this.spoAuthorization    = spoAuthorization;
     this.editFunctions       = editFunctions;
     this.errorSettings       = errorSettings.Value;
     this.customLogger        = customLogger;
     this.logTables           = logTables.Value;
     this.validationFunctions = validationFunctions;
     this.mailSettings        = mailSettings.Value;
 }
        /// <summary>
        /// Constructor where all dependencies are injected
        /// </summary>
        /// <param name="errorSettings"></param>
        /// <param name="sharedSettings"></param>
        /// <param name="matterCenterServiceFunctions"></param>
        /// <param name="customLogger"></param>
        /// <param name="logTables"></param>
        /// <param name="sharedRepository"></param>
        public SharedController(IOptions <ErrorSettings> errorSettings,
                                IOptions <SharedSettings> sharedSettings,
                                IMatterCenterServiceFunctions matterCenterServiceFunctions,
                                ICustomLogger customLogger, IOptions <LogTables> logTables,
                                ISharedRepository sharedRepository
                                )
        {
            this.errorSettings = errorSettings.Value;

            this.matterCenterServiceFunctions = matterCenterServiceFunctions;
            this.sharedRepository             = sharedRepository;
            this.customLogger   = customLogger;
            this.logTables      = logTables.Value;
            this.sharedSettings = sharedSettings.Value;
        }
Example #10
0
 /// <summary>
 /// constructor where are all the dependencies are injected
 /// </summary>
 /// <param name="errorSettings"></param>
 /// <param name="matterCenterServiceFunctions"></param>
 /// <param name="userRepositoy"></param>
 /// <param name="customLogger"></param>
 /// <param name="logTables"></param>
 /// <param name="generalSettings"></param>
 public UserController(IOptions <ErrorSettings> errorSettings,
                       IMatterCenterServiceFunctions matterCenterServiceFunctions,
                       IUserRepository userRepositoy,
                       ICustomLogger customLogger,
                       IOptions <LogTables> logTables,
                       IOptions <GeneralSettings> generalSettings
                       )
 {
     this.errorSettings = errorSettings.Value;
     this.matterCenterServiceFunctions = matterCenterServiceFunctions;
     this.customLogger    = customLogger;
     this.logTables       = logTables.Value;
     this.generalSettings = generalSettings.Value;
     this.userRepositoy   = userRepositoy;
 }
 /// <summary>
 /// Constructor where all the required dependencies are injected
 /// </summary>
 /// <param name="errorSettings"></param>
 /// <param name="documentSettings"></param>
 /// <param name="spoAuthorization"></param>
 /// <param name="matterCenterServiceFunctions"></param>
 /// <param name="documentRepositoy"></param>
 public DocumentController(IOptions <ErrorSettings> errorSettings,
                           IOptions <DocumentSettings> documentSettings,
                           ISPOAuthorization spoAuthorization,
                           IMatterCenterServiceFunctions matterCenterServiceFunctions,
                           IDocumentRepository documentRepositoy,
                           ICustomLogger customLogger, IOptions <LogTables> logTables
                           )
 {
     this.errorSettings                = errorSettings.Value;
     this.documentSettings             = documentSettings.Value;
     this.spoAuthorization             = spoAuthorization;
     this.matterCenterServiceFunctions = matterCenterServiceFunctions;
     this.documentRepositoy            = documentRepositoy;
     this.customLogger = customLogger;
     this.logTables    = logTables.Value;
 }
 /// <summary>
 /// Constructor where all the required dependencies are injected
 /// </summary>
 /// <param name="errorSettings"></param>
 /// <param name="taxonomySettings"></param>
 /// <param name="generalSettings"></param>
 /// <param name="spoAuthorization"></param>
 /// <param name="matterCenterServiceFunctions"></param>
 /// <param name="taxonomyRepository"></param>
 public TaxonomyController(IOptions <ErrorSettings> errorSettings,
                           IOptions <TaxonomySettings> taxonomySettings,
                           IOptions <GeneralSettings> generalSettings,
                           ISPOAuthorization spoAuthorization,
                           IMatterCenterServiceFunctions matterCenterServiceFunctions,
                           ITaxonomyRepository taxonomyRepository, ICustomLogger customLogger, IOptions <LogTables> logTables)
 {
     this.errorSettings                = errorSettings.Value;
     this.taxonomySettings             = taxonomySettings.Value;
     this.generalSettings              = generalSettings.Value;
     this.spoAuthorization             = spoAuthorization;
     this.matterCenterServiceFunctions = matterCenterServiceFunctions;
     this.taxonomyRepository           = taxonomyRepository;
     this.customLogger = customLogger;
     this.logTables    = logTables.Value;
 }
        /// <summary>
        /// Constructor where all the required dependencies are injected
        /// </summary>
        /// <param name="errorSettings"></param>
        /// <param name="generalSettings"></param>
        /// <param name="uiConfigSettings"></param>
        /// <param name="configRepository"></param>
        /// <param name="logTables"></param>
        /// <param name="hostingEnvironment"></param>
        /// <param name="matterCenterServiceFunctions"></param>
        public ConfigController(IOptions <ErrorSettings> errorSettings,
                                IOptions <GeneralSettings> generalSettings,
                                IOptions <UIConfigSettings> uiConfigSettings,
                                IOptions <LogTables> logTables,
                                IMatterCenterServiceFunctions matterCenterServiceFunctions,
                                IConfigRepository configRepository,
                                IHostingEnvironment hostingEnvironment

                                )
        {
            this.errorSettings = errorSettings.Value;
            this.matterCenterServiceFunctions = matterCenterServiceFunctions;
            this.configRepository             = configRepository;
            this.generalSettings    = generalSettings.Value;
            this.uiConfigSettings   = uiConfigSettings.Value;
            this.hostingEnvironment = hostingEnvironment;
        }
Example #14
0
        public GlobalSettings()
        {
            nodes.Add(new SettingNode {
                Id = 1, Name = "Skin", UserControl = new SetTheme()
            });
            nodes.Add(new SettingNode {
                Id = 2, Name = "KeePass", UserControl = new KeePassSettings()
                {
                    FileName = ""
                }
            });
            nodes.Add(new SettingNode {
                Id = 3, Name = "Storage"
            });
            nodes.Add(new SettingNode {
                Id = 4, Name = "Bets", ParentId = 3, UserControl = new DatabaseSetup()
            });
            nodes.Add(new SettingNode {
                Id = 5, Name = "Strategies", ParentId = 3
            });
            nodes.Add(new SettingNode {
                Id = 6, Name = "Notifications"
            });
            nodes.Add(new SettingNode {
                Id = 7, Name = "Updates"
            });
            nodes.Add(new SettingNode {
                Id = 8, Name = "Live Bets", UserControl = new LiveBetSettings()
            });
            nodes.Add(new SettingNode {
                Id = 11, Name = "Donate"
            });
            nodes.Add(new SettingNode {
                Id = 12, Name = "Proxy"
            });
            var ErrSetts = new ErrorSettings();

            nodes.Add(new SettingNode {
                Id = 13, Name = "Errors", UserControl = ErrSetts
            });

            InitializeComponent();
            this.Loaded += GlobalSettings_Loaded;
            //SettingItems =  new string[]{"Skin","KeePass","Bet Storage","Errors","Notifications","Updates","Live View","Donate","Proxy","Strategy Storage" };
            DataContext = this;
        }
Example #15
0
        public List <ErrorSettings> GetErrorSettings()
        {
            List <ErrorSettings> oList     = new List <ErrorSettings>();
            Database             oDatabase = DatabaseFactory.CreateDatabase(DataHelpers.ConnectionString());

            using (DbConnection connection = oDatabase.CreateConnection())
            {
                connection.Open();
                try
                {
                    String    query    = "SELECT Id,ComolUniqueID,Name,ServerSMTP,SenderMail,SenderName,RealMailSender,ReplyTo,RecipientMail,NotifyAfterErrors,NotificationDelay,UseAuthentication,AccountName,AccountPassword,Port,UseSSL FROM Settings";
                    DbCommand oCommand = oDatabase.GetSqlStringCommand(query);
                    oCommand.Connection = connection;
                    DbDataReader reader = oCommand.ExecuteReader();
                    while (reader.Read())
                    {
                        ErrorSettings setting = new  ErrorSettings();
                        setting.Id                = (long)reader.GetValue(0);
                        setting.ComolUniqueID     = (String)reader.GetValue(1);
                        setting.Name              = (String)reader.GetValue(2);
                        setting.HostSMTP          = (String)reader.GetValue(3);
                        setting.SenderMail        = (String)reader.GetValue(4);
                        setting.SenderName        = (String)reader.GetValue(5);
                        setting.RealMailSender    = (String)reader.GetValue(6);
                        setting.ReplyTo           = (String)reader.GetValue(7);
                        setting.RecipientMail     = (String)reader.GetValue(8);
                        setting.NotifyAfterErrors = (int)reader.GetValue(9);
                        setting.NotificationDelay = (int)reader.GetValue(10);
                        setting.UseAuthentication = (Boolean)reader.GetValue(11);
                        setting.AccountName       = (String)reader.GetValue(12);
                        setting.AccountPassword   = (String)reader.GetValue(13);
                        setting.Port              = (int)reader.GetValue(14);
                        setting.UseSsl            = (Boolean)reader.GetValue(15);

                        oList.Add(setting);
                    }
                }
                catch (Exception ex)
                {
                    System.Diagnostics.EventLog.WriteEntry("-GetErrorSettings", ex.Message);
                    throw new Exception(ex.Message, ex);
                }
            }
            return(oList);
        }
        /// <summary>
        /// DcouemtsController Constructor where all the required dependencies are injected
        /// </summary>
        /// <remarks></remarks>        ///
        /// <param name="errorSettings"></param>
        /// <param name="documentSettings"></param>
        /// <param name="matterCenterServiceFunctions"></param>
        /// <param name="documentRepositoy"></param>
        /// <param name="customLogger"></param>
        /// <param name="logTables"></param>
        /// <param name="documentProvision"></param>
        /// <param name="generalSettings"></param>
        public DocumentController(IOptions <ErrorSettings> errorSettings,
                                  IOptions <DocumentSettings> documentSettings,
                                  IMatterCenterServiceFunctions matterCenterServiceFunctions,
                                  IDocumentRepository documentRepositoy,
                                  ICustomLogger customLogger, IOptions <LogTables> logTables, IDocumentProvision documentProvision,
                                  IOptions <GeneralSettings> generalSettings

                                  )
        {
            this.errorSettings                = errorSettings.Value;
            this.documentSettings             = documentSettings.Value;
            this.matterCenterServiceFunctions = matterCenterServiceFunctions;
            this.documentRepositoy            = documentRepositoy;
            this.customLogger      = customLogger;
            this.logTables         = logTables.Value;
            this.documentProvision = documentProvision;
            this.generalSettings   = generalSettings.Value;
        }
        public void ShowError(string obj, EventHandler okClick = null, bool bCreateButtonEvent = false, int iAddCounterSeconds = 0, ErrorLevel errorLevel = ErrorLevel.Normal)
        {
            var errorSettings = new ErrorSettings();

            errorSettings.ErrorLevel        = errorLevel;
            errorSettings.OkClick           = okClick;
            errorSettings.CreateButtonEvent = bCreateButtonEvent;
            errorSettings.AddCounterSeconds = iAddCounterSeconds;
            if (errorSettings.ErrorLevel == ErrorLevel.Normal)
            {
                errorSettings.WarningVisibility = Visibility.Collapsed;
            }
            if (errorSettings.ErrorLevel == ErrorLevel.ModalWindow)
            {
                errorSettings.ErrorLevel  = ErrorLevel.Critical;
                errorSettings.HideButtons = true;
            }

            ShowError(obj, errorSettings);
        }
        private IManagerErrors GetManager(PersistTo type, String ComolUniqueID, ErrorType errorType)
        {
            IManagerErrors manager = null;

            switch (type)
            {
            case PersistTo.Mail:
                MailTemplate  template = (from t in GetCachedTemplates() where t.Type == errorType select t).FirstOrDefault <MailTemplate>();
                ErrorSettings setting  = (from s in GetCachedErrorSettings() where s.ComolUniqueID == ComolUniqueID select s).FirstOrDefault <ErrorSettings>();
                manager = new ManagerMail(template, setting);
                break;

            case PersistTo.File:
                manager = new ManagerFile();
                break;

            case PersistTo.Database:
                System.Diagnostics.EventLog.WriteEntry("DEBUG", "PersistTo.Database");
                manager = new ManagerDatabase();
                break;
            }
            return(manager);
        }
Example #19
0
        private void CreateCheckpoint()
        {
            WsdlRepository.CreateProfitAccountingCheckpoint(Int32.Parse(StationRepository.GetUid(ChangeTracker.CurrentUser).location_id.ToString()), StationRepository.StationNumber);

            var lastcheckpoint = _Checkpoints.FirstOrDefault(x => x.IsLastCheckpoint);



            var errorWindowSettings = new ErrorSettings();

            errorWindowSettings.ErrorLevel        = ErrorLevel.Critical;
            errorWindowSettings.HideButtons       = true;
            errorWindowSettings.WarningVisibility = Visibility.Collapsed;
            errorWindowSettings.TextAligment      = TextAlignment.Center;
            ErrorWindowService.ShowError(TranslationProvider.Translate(MultistringTags.SETTLEMENT_PROCESSING), errorWindowSettings);
            while (true)
            {
                Thread.Sleep(5000);
                OnLoadData();
                var newCheckpoint = _Checkpoints.FirstOrDefault(x => x.IsLastCheckpoint);
                if (newCheckpoint != null && lastcheckpoint == null)
                {
                    break;
                }
                if (lastcheckpoint != null && newCheckpoint != null && newCheckpoint.ProfitAccountingCheckpoint.general.endDate > lastcheckpoint.ProfitAccountingCheckpoint.general.endDate)
                {
                    break;
                }
            }
            ErrorWindowService.Close();

            SelectedCheckpoint = _Checkpoints.ElementAt(0);

            OnPropertyChanged("Checkpoints");
            TryUpdateLocationTotals();
        }
Example #20
0
 /// <summary>
 /// Constructor.
 /// </summary>
 public HomeController(BaseControllerArgs args, ErrorSettings errorSettings)
     : base(args)
 {
     _errorSettings = errorSettings;
 }
Example #21
0
 public ManagerMail(MailTemplate template, ErrorSettings setting)
 {
     _template = template;
     _setting  = setting;
 }