public void changeUserPassword(string oldPassword, string newPassword)
        {
            string currentPassword = hashWorker.getHash(oldPassword, getSultForCurrentUser());

            if (converter.convert(configProxyForLoadDataFromBDAndExecute(
                                      queryConfigurator.checkUser(
                                          currentUser.getLogin(), currentPassword))) == 1)
            {
                configProxyForLoadDataFromBDAndExecute(
                    queryConfigurator.changePassword(currentUser.getLogin(),
                                                     hashWorker.getHash(newPassword, getSultForCurrentUser())));

                currentUser.setPassword(newPassword);

                InformationPopupWindow       view   = new InformationPopupWindow();
                InformationPopupWindowConfig config = new InformationPopupWindowConfig(
                    "Пароль успешно изменен");
                view.setConfig(config);
                view.show();
            }
            else
            {
                throw new IncorrectOldPassword("Exception: old password is not a right");
            }
        }
Beispiel #2
0
        public void changeUserPassword(string oldPassword, string newPassword)
        {
            if (currentUser.isEnterIntoSystem())
            {
                string currentPassword = hashWorker.getHash(oldPassword, getSultForCurrentUser());

                if (DataSetConverter.fromDsToSingle.toInt.convert(
                        SqlLiteSimpleExecute.execute(queryConfigurator.checkUser(
                                                         currentUser.getLogin(), currentPassword))) == 1)
                {
                    SqlLiteSimpleExecute.execute(
                        queryConfigurator.changePassword(currentUser.getLogin(),
                                                         hashWorker.getHash(newPassword, getSultForCurrentUser())));

                    currentUser.setPassword(newPassword);

                    InformationPopupWindow       view   = new InformationPopupWindow();
                    InformationPopupWindowConfig config = new InformationPopupWindowConfig(
                        "Пароль успешно изменен");
                    view.setConfig(config);
                    view.show();
                }
                else
                {
                    throw new IncorrectOldPassword("Exception: old password is not a right");
                }
            }
            else
            {
                throw new InsufficientPermissionsException("This user does not"
                                                           + "have sufficient rights to perform the specified operation");
            }
        }
Beispiel #3
0
        private void showInformationMessage(string message)
        {
            InformationPopupWindow       view   = new InformationPopupWindow();
            InformationPopupWindowConfig config = new InformationPopupWindowConfig(message);

            view.setConfig(config);
            view.show();
        }
Beispiel #4
0
        public void processing(Exception ex)
        {
            ExceptionViewInterface <InformationPopupWindowConfig> view = new InformationPopupWindow();
            InformationPopupWindowConfig config = new InformationPopupWindowConfig(
                "Конфигурация не задана");

            view.setConfig(config);
            view.show();
        }
Beispiel #5
0
        public void processing(Exception ex)
        {
            ExceptionViewInterface <InformationPopupWindowConfig> view = new InformationPopupWindow();
            InformationPopupWindowConfig config = new InformationPopupWindowConfig("Исключение " +
                                                                                   ex.GetType() + " было добавлено ранее, оно будет пропущено!");

            view.setConfig(config);
            view.show();
        }
Beispiel #6
0
        public void processing(Exception ex)
        {
            ExceptionViewInterface <InformationPopupWindowConfig> view = new InformationPopupWindow();
            InformationPopupWindowConfig config = new InformationPopupWindowConfig(
                "В базе данных отсутствуют необходимые таблицы или(и) объекты.");

            view.setConfig(config);
            view.show();
        }
        public void processing(Exception ex)
        {
            ExceptionViewInterface <InformationPopupWindowConfig> view = new InformationPopupWindow();
            InformationPopupWindowConfig config = new InformationPopupWindowConfig(
                "Не найден файл с базой данных: goTest.db.");

            view.setConfig(config);
            view.show();
        }
Beispiel #8
0
        public void processing(Exception ex)
        {
            ExceptionViewInterface <InformationPopupWindowConfig> view = new InformationPopupWindow();
            InformationPopupWindowConfig config = new InformationPopupWindowConfig(
                "Неподдерживаемая длинна ключа. Обратитесь к администратору.");

            view.setConfig(config);
            view.show();
        }
        public void processing(Exception ex)
        {
            ExceptionViewInterface <InformationPopupWindowConfig> view = new InformationPopupWindow();
            InformationPopupWindowConfig config = new InformationPopupWindowConfig("Исключение " +
                                                                                   ex.GetType() + " было добавлено ранее, оно будет пропущено!");

            view.setConfig(config);
            view.show();

            TextJornalistConfig jornalistConfig =
                new TextJornalistConfig(ex.Message, ex.StackTrace, ex.Source);
            TextFilesJornalist jornalist = new TextFilesJornalist();

            jornalist.setConfig(jornalistConfig);
            jornalist.write();
        }
        public void processing(Exception ex)
        {
            ExceptionViewInterface <InformationPopupWindowConfig> view = new InformationPopupWindow();
            InformationPopupWindowConfig config = new InformationPopupWindowConfig(
                "Неизвестное исключение " + ex.GetType());

            view.setConfig(config);
            view.show();

            TextJornalistConfig jornalistConfig =
                new TextJornalistConfig(ex.Message, ex.StackTrace, ex.Source);
            TextFilesJornalist jornalist = new TextFilesJornalist();

            jornalist.setConfig(jornalistConfig);
            jornalist.write();
        }
        public void processing(Exception ex)
        {
            ExceptionViewInterface <InformationPopupWindowConfig> view = new InformationPopupWindow();
            InformationPopupWindowConfig config = new InformationPopupWindowConfig(
                "Конфигурация не задана");

            view.setConfig(config);
            view.show();

            TextJornalistConfig jornalistConfig =
                new TextJornalistConfig(ex.Message, ex.StackTrace, ex.Source);
            TextFilesJornalist jornalist = new TextFilesJornalist();

            jornalist.setConfig(jornalistConfig);
            jornalist.write();
        }
        public void processing(Exception ex)
        {
            ExceptionViewInterface<InformationPopupWindowConfig> view = 
                new InformationPopupWindow();
            InformationPopupWindowConfig config = new InformationPopupWindowConfig(
                "Недостаточно данных для анализа, попробуйте изменить "+
                "рассматриваемый интервал времени."+ex.Message);
            view.setConfig(config);
            view.show();

            TextJornalistConfig jornalistConfig =
                new TextJornalistConfig(ex.Message, ex.StackTrace, ex.Source);
            TextFilesJornalist jornalist = new TextFilesJornalist();
            jornalist.setConfig(jornalistConfig);
            jornalist.write();
        }
Beispiel #13
0
        public void addNewUser(SecurityUserInterface user)
        {
            string sult = hashWorker.getSult(user);
            int    id   = DataSetConverter.fromDsToSingle.toInt.convert(
                SqlLiteSimpleExecute.execute(queryConfigurator.getUserId(user.getLogin())));

            SqlLiteSimpleExecute.execute(queryConfigurator.setSult(id, sult));
            SqlLiteSimpleExecute.execute(queryConfigurator.setPassword(id,
                                                                       hashWorker.getHash(user.getPassword(), sult)));
            InformationPopupWindow       view   = new InformationPopupWindow();
            InformationPopupWindowConfig config = new InformationPopupWindowConfig(
                "Пользователь: " + user.getLogin() + " успешно добавлен!");

            view.setConfig(config);
            view.show();
        }
        public void addNewUser(SecurityUserInterface user)
        {
            string sult = hashWorker.getSult(user);


            if (currentUser.isAdmin())
            {
                //Проверка, есть ли уже такой пользователь
                FromDataSetToString newConverter = new FromDataSetToString();
                if (newConverter.convert(configProxyForLoadDataFromBDAndExecute(
                                             queryConfigurator.getSult(
                                                 currentUser.getLogin()))) == null)
                {
                    configProxyForLoadDataFromBDAndExecute(queryConfigurator.addNewUser(
                                                               user.getLogin(), hashWorker.getHash(user.getPassword(), sult),
                                                               sult, user.isAdmin()));
                    InformationPopupWindow       view   = new InformationPopupWindow();
                    InformationPopupWindowConfig config = new InformationPopupWindowConfig(
                        "Пользователь: " + user.getLogin() + " успешно добавлен!");
                    view.setConfig(config);
                    view.show();
                }
                else
                {
                    InformationPopupWindow       view   = new InformationPopupWindow();
                    InformationPopupWindowConfig config = new InformationPopupWindowConfig(
                        "Логин: " + user.getLogin() + " был ранее добавлен в систему, " +
                        "пожалуйста, придумайте другой");
                    view.setConfig(config);
                    view.show();
                }
            }
            else
            {
                throw new InsufficientPermissionsException("This user does not"
                                                           + "have sufficient rights to perform the specified operation");
            }
        }
        public bool configAndCheckConnect(string connectionString)
        {
            DataWorker <MsSQLServerStateFields, DataSet> accessProxy =
                setConfigToProxyDataBase(connectionString);

            try
            {
                accessProxy.connect();
                ExceptionViewInterface <InformationPopupWindowConfig> view =
                    new InformationPopupWindow();
                InformationPopupWindowConfig config = new InformationPopupWindowConfig(
                    "Соединение установлено");
                view.setConfig(config);
                view.show();
                return(true);
            }
            catch (Exception ex)
            {
                ExceptionHandler.Concrete.ExceptionHandler.getInstance().processing(
                    new NoDataBaseConnection());
                return(false);
            }
        }