Exemplo n.º 1
0
        private void UpdateCustomer(object obj)
        {
            if (IsNIPCorrect())
            {
                _selectedCustomer.NIP         = NIP;
                _selectedCustomer.Name        = Name;
                _selectedCustomer.Email       = Email;
                _selectedCustomer.PhoneNumber = PhoneNumber;
                _selectedCustomer.Address     = Address;

                if (Validator.IsCustomerValid(_selectedCustomer))
                {
                    if (CommandsRepository.UPDATE_CUSTOMER(_selectedCustomer, selectedNIP))
                    {
                        RefreshCustomerList();
                        Message = "";
                    }
                    else
                    {
                        Message = "Nie można zaktualizować klienta";
                    }
                }
                else
                {
                    Message = "Niektóre pola są niepoprawne";
                }
            }
            else
            {
                Message = "Nie można zaktualizować klienta";
            }
        }
Exemplo n.º 2
0
 private void AddProject(object obj)
 {
     try
     {
         Project project = new Project(Name, Status, Budget, TimeBudget, Deadline, Description, CustomerNIP);
         if (Validator.IsProjectValid(project))
         {
             if (CommandsRepository.ADD_PROJECT(project))
             {
                 ProjectObjectList.Add(project);
                 RefreshProjectList();
                 Message = "";
             }
             else
             {
                 Message = "Nie można dodać projektu";
             }
         }
         else
         {
             Message = "Niektóe pola są niepoprawne";
         }
     }
     catch
     {
         Message = "Nie można dodać projektu";
     }
 }
Exemplo n.º 3
0
 private void AddCustomer(object obj)
 {
     try
     {
         Customer customer = new Customer(NIP, Name, Email, PhoneNumber, Address);
         if (Validator.IsCustomerValid(customer))
         {
             if (CommandsRepository.ADD_CUSTOMER(customer))
             {
                 CustomerObjectList.Add(customer);
                 RefreshCustomerList();
                 Message = "";
             }
             else
             {
                 Message = "Nie można dodać klienta";
             }
         }
         else
         {
             Message = "Niektóre pola są niepoprawne";
         }
     }
     catch (Exception)
     {
         Message = "Nie można dodać klienta";
     }
 }
 private void AddUser(object obj)
 {
     try
     {
         User user = new User(Login, FirstName, LastName, Email, PhoneNumber, Address, Position, Salary, Hours, Password);
         if (Validator.IsUserValid(user))
         {
             if (CommandsRepository.ADD_USER(user))
             {
                 UserObjectList.Add(user);
                 RefreshUserList();
                 Message = "";
             }
             else
             {
                 Message = "Nie można dodać użytkownika";
             }
         }
         else
         {
             Message = "Niektóre pola są niepoprawne";
         }
     }
     catch (Exception)
     {
         Message = "Nie można dodać użytkownika";
     }
 }
        public virtual void Run()
        {
            var repo = new CommandsRepository();

            var commands = repo.GetCommands();

            ProcessTheme(commands);
            ProcessSubscriptionEmail(commands);
        }
Exemplo n.º 6
0
 private void SetupRepositories()
 {
     _streamerDataRepository = new StreamerDataRepository(_botConfig.DatabaseLocation);
     _streamerDataRepository.Initialize();
     _settingsRepository   = new SettingsRepository(_botConfig.DatabaseLocation);
     _botConfig.Prefix     = _settingsRepository.InitializeAndGetPrefix();
     _commandsRepository   = new CommandsRepository(_botConfig.DatabaseLocation);
     _twitchClient         = new TwitchClient(_token, _streamerDataRepository);
     _customCommandHandler = new CustomCommandHandler(_commandsRepository);
 }
Exemplo n.º 7
0
        public ActionResult GetCommands()
        {
            ICommandsRepository commandsRepository = new CommandsRepository();
            var commands = commandsRepository.GetCommands();

            var json = JsonConvert.SerializeObject(commands);

            return(new JsonResult()
            {
                Data = json
            });
        }
        // This method gets called by the runtime. Use this method to add services to the container.
        // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
        public void ConfigureServices(IServiceCollection services)
        {
            var commandsRepository = new CommandsRepository();

            services.AddSingleton(commandsRepository);
            services.AddGrpc(options =>
            {
                options.Interceptors.Add <LoggingInterceptor>("Users");
                //options.Interceptors.Add<CommandsInterceptor>(commandsRepository);
                options.MaxReceiveMessageSize = 16 * 1024 * 1024;
            });
            services.AddSingleton(new UsersRepository());
        }
 public MainWindowViewModel(ISoundBoardRepository soundBoardRepository, IDialogService dialogService,
                            IObservableSoundService soundService, IKernel container,
                            ISoundFactory soundFactory)
 {
     _soundBoardRepository = soundBoardRepository;
     _dialogService        = dialogService;
     _container            = container;
     _soundFactory         = soundFactory;
     SoundService          = soundService;
     Commands = new CommandsRepository(this, _soundFactory);
     SoundContextMenuCommands       = new SoundContextMenuCommands(this, _dialogService, container);
     ActiveSoundContextMenuCommands = new ActiveSoundContextMenuCommands(this);
     LoadSoundBoards();
 }
        // This method gets called by the runtime. Use this method to add services to the container.
        // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddLogging(c => c.AddSerilog().AddFile("log.txt"));
            var commandsRepository = new CommandsRepository();

            services.AddSingleton(commandsRepository);
            services.AddGrpc(options =>
            {
                options.Interceptors.Add <LoggingInterceptor>("TransactionsWrite");
                //options.Interceptors.Add<CommandsInterceptor>(commandsRepository);
                options.MaxReceiveMessageSize = 16 * 1024 * 1024;
            });
            services.AddSingleton(CreateMapper());
            services.AddSingleton(new TransactionsRepository());
            services.AddRabbitMqPublisher(configuration, "TransactionsWrite");
        }
Exemplo n.º 11
0
        private void UpdateProject(object obj)
        {
            try
            {
                _selectedProject.Name        = Name;
                _selectedProject.Status      = Status;
                _selectedProject.Budget      = Budget;
                _selectedProject.TimeBudget  = TimeBudget;
                _selectedProject.Deadline    = Deadline;
                _selectedProject.Description = Description;
                _selectedProject.CustomerNIP = CustomerNIP;

                if (Validator.IsProjectValid(_selectedProject))
                {
                    if (Validator.IsProjectValid(_selectedProject))
                    {
                        if (CommandsRepository.UPDATE_PROJECT(_selectedProject))
                        {
                            RefreshProjectList();
                            Message = "";
                        }
                        else
                        {
                            Message = "Nie można zaktualizować projektu";
                        }
                    }
                    else
                    {
                        Message = "Niektóre pola są niepoprawne";
                    }
                }
            }
            catch
            {
                Message = "Nie można zaktualizować projektu";
            }
        }
 private void UpdateUser(object obj)
 {
     if (IsLoginCorrect())
     {
         _selectedUser.Login = Login;
         _selectedUser.FirstName = FirstName;
         _selectedUser.LastName = LastName;
         _selectedUser.Email = Email;
         _selectedUser.PhoneNumber = PhoneNumber;
         _selectedUser.Address = Address;
         _selectedUser.Position = Position;
         _selectedUser.Salary = Salary;
         _selectedUser.Hours = Hours;
         _selectedUser.Password = Password;
         if (Validator.IsUserValid(_selectedUser))
         {
             if (CommandsRepository.UPDATE_USER(_selectedUser))
             {
                 RefreshUserList();
                 Message = "";
             }
             else
             {
                 Message = "Nie można zaktualizować użytkownika";
             }
         }
         else
         {
             Message = "Nie można zaktualizować użytkownika";
         }
     }
     else
     {
         Message = "Nie można zaktualizować użytkownika";
     }
 }
 public CommandsInterceptor(CommandsRepository commandsRepository)
 {
     this.commandsRepository = commandsRepository;
 }
Exemplo n.º 14
0
 public CommandsController(CommandsRepository commandsRepository)
 {
     _commands = commandsRepository;
 }
Exemplo n.º 15
0
 private void LoadProjectsFromDatabase()
 {
     CommandsRepository.GET_ALL_PROJECTS();
     ProjectObjectList = CommandsRepository.ProjectsList;
 }
Exemplo n.º 16
0
 public CustomCommandHandler(CommandsRepository commandsRepository)
 {
     _commandsRepository = commandsRepository;
     _reservedCommands   = new HashSet <string>(StringComparer.OrdinalIgnoreCase);
     Initialize();
 }
 private void LoadUsersFromDatabase()
 {
     CommandsRepository.GET_ALL_USERS();
     UserObjectList = CommandsRepository.UsersList;
 }
Exemplo n.º 18
0
 private void LoadCustomersFromDatabase()
 {
     CommandsRepository.GET_ALL_CUSTOMERS();
     CustomerObjectList = CommandsRepository.CustomersList;
 }