예제 #1
0
 public ConsolePresentable(IBookService bsc, IReaderService rsc, IAuthorService asc, IRecordService recsc)
 {
     _bs    = bsc;
     _as    = asc;
     _rs    = rsc;
     _recsc = recsc;
 }
예제 #2
0
        public void InitReader(IReaderService readerService, string endpoint, ReaderInfo objReader, int pReadTimeOutInMS = 1000)
        {
            rdrServiceEndpoint = endpoint;
            DisconnectExistingReader();
            SetToDefault();

            if (objReader == null)
            {
                throw new ApplicationException("Please check configuration ! Null RFIDReader object supplied.");
            }

            readTimeOutInMS = pReadTimeOutInMS;

            readerInfo = objReader;
            if (readerService == null)
                throw new ApplicationException("Error :  supplied object of Reader Service is NULL/Invalid.");

            readerServiceObj = readerService;

            SetToDefault();
            //string wcfServiceConn = frmMain.frmMainObj.objReaderGrpBO.ReaderGroups[readerInfo.ReaderGroupId].ReaderWCFConnectionString;
            //client = frmMain.frmMainObj.objReaderGrpBO.InitService(wcfServiceConn);
            //if (client == null)
            //    throw new ApplicationException("Error :  Could not connect to Reader Service on given connection - " + wcfServiceConn);
        }
예제 #3
0
 public APP(ILogger logger, IInputMapper inputMapperService, IReaderService readerService, IWriterService writerService)
 {
     this._writerService     = writerService;
     this._readerService     = readerService;
     this._logger            = logger;
     this._inputMaperService = inputMapperService;
 }
예제 #4
0
        private static void FindReaders(IReaderService rs, IRecordService recsc)
        {
            Console.Clear();
            Console.WriteLine("Choose value to search by:\n" +
                              "t - ticket number\n" +
                              "n - name\n\n" +
                              "any other symbol - return to menu");
            var inp = Console.ReadLine();

            switch (inp.Trim())
            {
            case "t":
            case "T":
                FindReadersByTicket(rs, recsc);
                break;

            case "n":
            case "N":
                FindReadersByName(rs);
                break;

            default:
                return;
            }
        }
예제 #5
0
 public ChangeUserCommand(IReaderService readerService, IWriterService writerService, IInterfaceService interfaceService, IUserService userService)
 {
     this.readerService    = readerService;
     this.writerService    = writerService;
     this.interfaceService = interfaceService;
     this.userService      = userService;
 }
예제 #6
0
        private static void FindReadersByName(IReaderService rs)
        {
            Console.Clear();
            Console.WriteLine("You have chosen finding readers by name");
            Console.Write("Input name: ");
            var str = Console.ReadLine();

            if (string.IsNullOrWhiteSpace(str))
            {
                Console.WriteLine("Bad input");
                Console.Write("Press any key to return to menu");
                Console.ReadLine();
                return;
            }

            var res = rs.FindReadersByName(str);

            if (res.Count() == 0)
            {
                Console.WriteLine("Nothing was found");
            }
            else
            {
                Console.WriteLine("\nResult\n");
                Console.WriteLine($"{"Full name",-25} | {"Ticket number",-12} | {"Phone number",-20}");

                foreach (var r in res)
                {
                    Console.WriteLine($"{r.Fullname,-25} | {r.TicketNumber,-12} | {r.Phone,-20}");
                }
            }

            Console.Write("Press any key to return to menu");
            Console.ReadLine();
        }
예제 #7
0
        public ConsoleMenuService(Zoo zoo)
        {
            _reader       = new ConsoleReaderService();
            _notification = new ConsoleNotificationService();             //Сервисы ввода/вывода в консоль
            _animalParser = new ConsoleAnimalParserService();

            _fileReader = new FileReader(_animalParser);
            _fileWriter = new FileWriter();

            _service = new ConsoleAnimalCreatorService(_reader, _notification);
            AnimalsFactory factory = AnimalsFactory.CreateFactory(_service);

            _zoo = zoo;

            _dict = new Dictionary <string, ICommand>()
            {
                { "1", new AddAnimalCommand(_zoo, factory, _notification, _reader) },            // TODO: Вводить "ваше животное успешно добавлено"
                { "2", new DeleteAnimalCommand(_zoo, _notification, _reader) },                  // TODO: Вводить "ваше животное успешно удалено"
                { "3", new PrintAnimalInfoCommand(_zoo, _notification, _reader) },               //TODO: Убрать вывод животных над меню
                { "4", new AnimalMakeSoundCommand(_zoo, _notification, _reader) },
                { "5", new PrintAllAnimalsInfoCommand(_zoo, _notification) },
                { "6", new AllAnimalMakeSoundCommand(_zoo) },
                { "7", new FileReadCommand(_zoo, _notification, _reader, _fileReader) },
                { "8", new FileWriteCommand(_zoo, _fileWriter) },
                { "0", new ExitCommand() }
            };
        }
예제 #8
0
        private static void Menu(IReaderService rs, IAuthorService asc, IBookService bs, IRecordService recsc)
        {
            Console.Clear();
            Console.WriteLine("Choose options: \n" +
                              "b - find book\n" +
                              "r - find reader\n" +
                              "e - exit");
            var inp = Console.ReadLine().Trim();

            switch (inp.Trim())
            {
            case "b":
            case "B":
                FindBooks(bs, asc);
                Menu(rs, asc, bs, recsc);
                break;

            case "r":
            case "R":
                FindReaders(rs, recsc);
                Menu(rs, asc, bs, recsc);
                break;

            case "e":
            case "E":
                return;

            default:
                Menu(rs, asc, bs, recsc);
                break;
            }
        }
예제 #9
0
        private static void FindReadersByTicket(IReaderService rs, IRecordService recsc)
        {
            Console.Clear();
            Console.WriteLine("You have chosen finding readers by ticket");
            Console.Write("Input ticket number: ");
            var ticketIn = Console.ReadLine();

            if (int.TryParse(ticketIn, out int num))
            {
                var readers = rs.FindReaderByTicket(num);

                if (readers == null || readers.Count() == 0)
                {
                    Console.WriteLine("nothing was found");
                }
                else if (readers.Count() > 1)
                {
                    Console.WriteLine("It seems that there is more than one reader with such ticket number");
                }
                else
                {
                    var res = readers.FirstOrDefault();

                    Console.WriteLine("\nResult\n");
                    Console.WriteLine($"{"Full name",-25} | {"Ticket number",-12} | {"Phone number",-20}");
                    Console.WriteLine($"{res.Fullname,-25} | {res.TicketNumber,-12} | {res.Phone,-20}");

                    Console.WriteLine("To see activity choose:\n" +
                                      "r - to see returned books\n" +
                                      "b - to see currently borrowed books\n" +
                                      "any key to return to menu");

                    var inp = Console.ReadLine();

                    switch (inp.Trim())
                    {
                    case "r":
                    case "R":
                        GetReturnedBooks(rs, recsc, res);
                        break;

                    case "b":
                    case "B":
                        GetBorrowedBooks(rs, recsc, res);
                        break;

                    default:
                        return;
                    }
                }
            }
            else
            {
                Console.WriteLine("Bad input");
            }

            Console.Write("Press any key to return to menu");
            Console.ReadLine();
        }
예제 #10
0
 public ConsoleMenuPagination(IReaderService reader, IWriterService writer, IInterfaceService interfaceService, IMenuNavigation menuNavigation, IMenuNavigationStrategyFactory menuNavigationStrategyFactory)
 {
     this.reader           = reader;
     this.writer           = writer;
     this.interfaceService = interfaceService;
     this.menuNavigation   = menuNavigation;
     this.menuNavigationStrategyFactory = menuNavigationStrategyFactory;
 }
예제 #11
0
 public ExitGameCommand(IUserSessionService userSessionService, IInterfaceService interfaceService, IWriterService writerService, IReaderService readerService, IUserService userService)
 {
     this.userSessionService = userSessionService;
     this.interfaceService   = interfaceService;
     this.writerService      = writerService;
     this.readerService      = readerService;
     this.userService        = userService;
 }
예제 #12
0
        public Kernel(IStorageService storageImpl, IReaderService readerImpl)
        {
            this.storageService = storageImpl;
            this.readerService = readerImpl;

            sleepTime = Convert.ToInt32(Properties.Settings.Default["ScanForTasksSleep"]);
            Console.CancelKeyPress += Console_CancelKeyPress;
        }
예제 #13
0
 public UserService(IInterfaceService interfaceService, IReaderService reader, IWriterService writer, IUserSessionService userSessionService, IPlayerRepository playerRepository)
 {
     this.interfaceService   = interfaceService;
     this.reader             = reader;
     this.writer             = writer;
     this.userSessionService = userSessionService;
     this.playerRepository   = playerRepository;
 }
예제 #14
0
 public ReaderController(IReaderService readerService,
                         IReaderRepository readerRepository,
                         IMapper mapper)
 {
     _readerService    = readerService;
     _readerRepository = readerRepository;
     _mapper           = mapper;
 }
예제 #15
0
 public ReaderModelService(IReaderMapper mapper, IReaderService service)
 {
     if (service == null || mapper == null)
     {
         throw new ArgumentNullException("Cannot pass null as argument for AuthorModelService constructor");
     }
     _mapper  = mapper;
     _service = service;
 }
예제 #16
0
 public CheckGameCommand(IUserSessionService userSessionService, ISudokuGridSolver sudokuGridSolver, IUserService userService, IWriterService writerService, IInterfaceService interfaceService, IReaderService readerService)
 {
     this.userSessionService = userSessionService;
     this.sudokuGridSolver   = sudokuGridSolver;
     this.userService        = userService;
     this.writerService      = writerService;
     this.interfaceService   = interfaceService;
     this.readerService      = readerService;
 }
예제 #17
0
        public frmModifyReader(ReaderInfo readerInfo, IReaderService client)
        {
            InitializeComponent();

            this.client = client;
            this.readerInfo = readerInfo;

            FillForm();
        }
예제 #18
0
 public NetworkDataSetService(
     MNCDContext ctx,
     IHashService hashService,
     IReaderService readerService)
 {
     _ctx           = ctx;
     _hashService   = hashService;
     _readerService = readerService;
 }
예제 #19
0
 public SolutionGameCommand(IUserSessionService userSessionService, ISudokuGridSolver sudokuGridSolver, IInterfaceService interfaceService, IReaderService readerService, IWriterService writerService, IUserService userService, IGameSetUpFasade gameSetUpFasade)
 {
     this.userSessionService = userSessionService;
     this.sudokuGridSolver   = sudokuGridSolver;
     this.interfaceService   = interfaceService;
     this.readerService      = readerService;
     this.writerService      = writerService;
     this.userService        = userService;
     this.gameSetUpFasade    = gameSetUpFasade;
 }
예제 #20
0
파일: EventReader.cs 프로젝트: kalayl/rfid
        public EventReader(PhaseUtils phaseUtils, IReaderService readerService)
        {
            _phaseUtils = phaseUtils;
            _readerService = readerService;

            Readings = new ObservableCollection<Reading>();
            PerAntennaReadings = new Dictionary<string, List<Reading>>();

            Readings.CollectionChanged += ReadingsChanged;
        }
예제 #21
0
 public Service()
 {
     Logger.Log.Info("Incoming request...");
     _context            = new Context();
     _readService        = new ReadService(_context);
     _readerService      = new ReaderService(_context);
     _readingService     = new ReadingService(_context);
     _raceService        = new RaceService(_context);
     _lastSeenLogService = new LastSeenLogService(_context);
 }
예제 #22
0
        public LocalReadingsViewModel()
        {
            _context        = new Context();
            _raceService    = new RaceService(_context);
            _readerService  = new ReaderService(_context);
            _readingService = new ReadingService(_context);
            _readService    = new ReadService(_context);

            Init();
        }
예제 #23
0
 public QueryCountFunction(IVehicleQueryService vehicleQueryService,
                           IEmailService emailService,
                           IReaderService <Stream> readerService,
                           IJsonConverter jsonConverter)
 {
     _vehicleQueryService = vehicleQueryService;
     _emailService        = emailService;
     _readerService       = readerService;
     _jsonConverter       = jsonConverter;
 }
 public LibraryVisitController(
     IReaderService readerService,
     IBookService bookService,
     IAuthorService authorService,
     ISubscriptionService subscriptionService)
 {
     _readerService       = readerService;
     _booksService        = bookService;
     _authorService       = authorService;
     _subscriptionService = subscriptionService;
 }
예제 #25
0
        public ReaderViewModel(int id, string name, string surname)
        {
            ID           = id;
            this.name    = name;
            this.surname = surname;


            this.rs       = new ReaderService();
            AddReaderCmd  = new Commands.Command(AddUser);
            EditReaderCmd = new Commands.Command(EditUser);
        }
예제 #26
0
 public BookController(ILogger <BookController> nLogger,
                       IBookService nBookService,
                       IAuthorService nAuthorService,
                       IReaderService nReaderService)
 {
     sup           = new SupportingFunctions();
     _logger       = nLogger;
     bookService   = nBookService;
     authorService = nAuthorService;
     readerService = nReaderService;
 }
예제 #27
0
 public LibraryController(IBookService bookService,
                          IReaderService readerService,
                          IReaderRepository readerRepository,
                          IBookRepository bookRepository,
                          IMapper mapper)
 {
     _bookService      = bookService;
     _readerService    = readerService;
     _readerRepository = readerRepository;
     _bookRepository   = bookRepository;
     _mapper           = mapper;
 }
예제 #28
0
 public GamePlayFasade(IReaderService readerService, IWriterService writerService, IInterfaceService interfaceService, IUserSessionService userSessionService, INavigationService navigationService, IGameNavigationStrategyFactory gameNavigationStrategyFactory, IAsciiFactoriesFactory asciiFactoriesFactory, IInGameValueStrategyFactory gameValueStrategyFactory, IInGameCommandFactory inGameCommandFactory)
 {
     this.readerService                 = readerService;
     this.writerService                 = writerService;
     this.interfaceService              = interfaceService;
     this.userSessionService            = userSessionService;
     this.navigationService             = navigationService;
     this.gameNavigationStrategyFactory = gameNavigationStrategyFactory;
     this.asciiFactoriesFactory         = asciiFactoriesFactory;
     this.gameValueStrategyFactory      = gameValueStrategyFactory;
     this.inGameCommandFactory          = inGameCommandFactory;
 }
예제 #29
0
        public ReaderListViewModel(IReaderService irs, IEventService ies, IBookService ibs)
        {
            rs = irs;
            es = ies;
            bs = ibs;

            RemoveReaderCommand = new Commands.Command(DeleteUser);
            RefreshUsersCMD     = new Commands.Command(RefreshEverything);
            AddReaderCommand    = new Commands.Command(AddUser);
            EditUserCommand     = new Commands.Command(EditUser);
            Refresh();
            RefreshEvents();
        }
예제 #30
0
        public FrmKullanicilar()
        {
            InitializeComponent();
            _userService = InstanceFactory.GetInstance <IUserService>();
            _userDal     = InstanceFactory.GetInstance <IUserDal>();

            _readerService = InstanceFactory.GetInstance <IReaderService>();
            _readerDal     = InstanceFactory.GetInstance <IReaderDal>();

            _bookService = InstanceFactory.GetInstance <IBookService>();
            _bookDal     = InstanceFactory.GetInstance <IBookDal>();

            _categoryService = InstanceFactory.GetInstance <ICategoryService>();
        }
예제 #31
0
        public BookListViewModel()
        {
            bs = new BookService();
            es = new EventService();
            rs = new ReaderService();

            books  = new ObservableCollection <BookViewModel>();
            events = new ObservableCollection <EventViewModel>();

            RemoveBookCommand = new Commands.Command(DeleteBook);
            AddBookCommand    = new Commands.Command(AddBook);
            EditBookCommand   = new Commands.Command(EditBook);
            RefreshCommand    = new Commands.Command(RefreshEverything);
            RefreshCatalog();
        }
예제 #32
0
        public ReaderListViewModel()
        {
            rs = new ReaderService();
            es = new EventService();
            bs = new BookService();

            readers = new ObservableCollection <ReaderViewModel>();
            books   = new ObservableCollection <BookViewModel>();
            events  = new ObservableCollection <EventViewModel>();

            RemoveReaderCommand = new Commands.Command(DeleteUser);
            RefreshUsersCMD     = new Commands.Command(Refresh);
            AddReaderCommand    = new Commands.Command(AddUser);
            EditUserCommand     = new Commands.Command(EditUser);
            RefreshEverything();
        }
예제 #33
0
        public EventListViewModel()
        {
            bs = new BookService();
            es = new EventService();
            rs = new ReaderService();

            books  = new ObservableCollection <BookViewModel>();
            users  = new ObservableCollection <ReaderViewModel>();
            events = new ObservableCollection <EventViewModel>();

            Borrow  = new Commands.Command(BorrowBook);
            Return  = new Commands.Command(ReturnBook);
            Refresh = new Commands.Command(RefreshEverything);

            RefreshCatalog();
            RefreshUsers();
            RefreshEvents();
        }
예제 #34
0
        public void Setup()
        {
            var options = new DbContextOptionsBuilder <ApplicationContext>()
                          .UseInMemoryDatabase(databaseName: "readers")
                          .Options;

            var context = new ApplicationContext(options);

            seedBooks(context);
            seedReaders(context);

            bookRepository   = new BookRepository(context);
            readerRepository = new ReaderRepository(context);

            bookService = new BookService(
                bookRepository,
                readerRepository
                );
            readerService = new ReaderService(readerRepository);
        }
예제 #35
0
 private bool CheckConnection()
 {
     try
     {
         readerServiceObj.GetVersion();
     }
     catch
     {
         try
         {
             readerServiceObj = InitService(rdrServiceEndpoint);
             readerServiceObj.GetVersion();
         }
         catch { return false; }
     }
     return true;
 }