Ejemplo n.º 1
0
        /// <summary>
        /// Stars a view showing detailed information about a single user.
        /// </summary>
        /// <param name="db">The location of the database containing all the users.</param>
        /// <param name="view">The view on which the detailed user information should be shown.s</param>
        internal static void GetUserById(IRepository <User> db, IAdminView view)
        {
            int  id   = TextProcessor.GetProperInt("Please enter the user ID: ");
            User user = db.Read(id);

            view.ShowDetailedInfoView(user);
        }
Ejemplo n.º 2
0
        public void ShowTeamInfo(IAdminView inForm, int teamId)
        {
            var form = _formsFactory.AdminTeamView();

            form.SetTeamValues(_teamRepository.GetTeamById(teamId), _playerRepository.GetAll(), _trainerRepository.GetAll());
            _adminController.ShowTeam(form);
        }
Ejemplo n.º 3
0
        public ComponentController(IComponentService service, IAdminView view)
        {
            servComponent = service;
            _view         = view;

            _view.AddComponent += _view_AddComponent;
            _view.ShowProject  += _view_ShowProject;
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Constructor of the presenter
        /// </summary>
        /// <param name="adminView">View of the presenter</param>
        /// <param name="adminDao">Data Access Object of the presenter</param>
        public AdminPresenter(AdminView adminView, AdminDao adminDao)
        {
            Logger.debug("Initalizing Admin Presenter.", origin: "ChatMail.AdminPresenter");
            m_adminView = adminView;
            m_adminDao  = adminDao;

            Initialize();
        }
Ejemplo n.º 5
0
        public Application()
        {
            string appType = ConfigurationManager.AppSettings["UI"];

            _view = (IAdminView)AssemblyUtils.GetAssembly(appType);

            _repository = AbstractDBFactory.CreateDBFactory().GetRepository();
        }
Ejemplo n.º 6
0
 public void Homepage(IAdminView form, IMainController inController, Admin admin, IPlayerRepository playerRepository, ITrainerRepository trainerRepository, ITeamRepository teamRepository, ITransactionRepository transactionRepository)
 {
     _form                  = form;
     _playerRepository      = playerRepository;
     _trainerRepository     = trainerRepository;
     _teamRepository        = teamRepository;
     _transactionRepository = transactionRepository;
     form.ShowViewModaless(inController, admin, playerRepository.GetAll(), trainerRepository.GetAll(), teamRepository.GetAll(), transactionRepository.GetAll());
 }
Ejemplo n.º 7
0
 public ProjectController(ProjectManager.Business.IProjectService serv, IAdminView view)
 {
     servProj             = serv;
     _view                = view;
     _view.ActualProjects = servProj.Items.Select(it => it.Name);
     _view.Save          += _view_Save;
     _view.Save_Activate  = false;
     _view.ShowProject   += _view_ShowProject;
     _view.AddNewProj    += _view_AddNewProj;
     _view.SetLeadOfProj += _view_SetLeadOfProj;
 }
Ejemplo n.º 8
0
        /// <summary>
        /// Starts A view for creating a new user and adds the result to the database.
        /// </summary>
        /// <param name="db">The location of the database.</param>
        /// <param name="view">The view which should be shown to the client.</param>
        internal static void CreateUser(IRepository <User> db, IAdminView view)
        {
            User user = view.ShowAndCreateUserView();

            InitUsers(db, view);
            if (user != null)
            {
                user.ID = (_users.Count() > 0) ? _users.Max(x => x.ID) + 1 : 1;
                db.Insert(user);
            }
        }
Ejemplo n.º 9
0
        public AdminPresenter(IAdminView adminView, ICurrencyService currencyService, IOperationService operationService)
        {
            _adminView        = adminView;
            _currencyService  = currencyService;
            _operationService = operationService ?? throw new ArgumentNullException(nameof(operationService));

            _adminView.GetCurrencies           += GetCurrencies;
            _adminView.AddCurrency             += AddCurrency;
            _adminView.UpdateCurrency          += UpdateCurrency;
            _operationService.UpdateOperations += UpdateOperations;
            _adminView.FilterOperations        += FilterOperations;
        }
Ejemplo n.º 10
0
        public AdminPresenter(IAdminView adminView, ICurrencyService currencyService, ITransactionService transactionService)
        {
            AdminView          = adminView;
            CurrencyService    = currencyService;
            TransactionService = transactionService;

            AdminView.AddCurrencyEvent                 += AddCurrency;
            AdminView.GetCurrenciesEvent               += UpdateCurrencies;
            AdminView.GetTransactionsEvent             += UpdateTransactions;
            AdminView.UpdateCurrencyEvent              += UpdateCurrency;
            TransactionService.UpdateTransactionsEvent += UpdateTransactions;
        }
Ejemplo n.º 11
0
 public AdminPresenter(IAdminView view, IMedicineRepository medicineRepository
                       , IStaffRepository staffRepository, IServiceRepository serviceRepository
                       , IBillRepository billRepository,
                       IStatisticRepository statisticRepository
                       )
 {
     _view = view;
     _medicineRepository  = medicineRepository;
     _staffRepository     = staffRepository;
     _serviceRepository   = serviceRepository;
     _billRepository      = billRepository;
     _statisticRepository = statisticRepository;
 }
Ejemplo n.º 12
0
        public AdminPresenter(IAdminView view, SchoolDBEntities data, IUser user, ILoginPresenter loginPresenter)
        {
            this.view           = view;
            view.Presenter      = this;
            this.data           = data;
            this.user           = user;
            this.loginPresenter = loginPresenter;

            var admin = user as Model.Admin;

            view.AdminLabelText = admin.admin_firstN + ' ' + admin.admin_lastN;

            view.FillInProfile(new string[] { "Учител", "Ученик", "Родител" });
            view.FillInWhichGrade(new string[] { "8", "9", "10", "11", "12" });
        }
Ejemplo n.º 13
0
        public void ShowPlayerOptions(IAdminView parentForm, IAdminPlayerOptionsView form, Player player, IPlayerRepository playerRepository, ITeamRepository teamRepository, ITransactionRepository transactionRepository)
        {
            form.DisplayTransactionList(transactionRepository.GetAll());
            form.SetPlayerValues(player, teamRepository.GetAll());
            var result = form.ShowViewModal();

            if (result == DialogResult.Yes)
            {
                teamRepository.AddPlayerToTeam(player, playerRepository);
            }
            else if (result == DialogResult.No)
            {
                teamRepository.RemovePlayerFromTeam(player, playerRepository);
            }
            else if (result == DialogResult.Abort)
            {
                teamRepository.DeletePlayer(player, playerRepository);
            }
            parentForm.DisplayPlayerList(playerRepository.GetAll(), teamRepository.GetAll());
            parentForm.DisplayTeamList(teamRepository.GetAll());
        }
Ejemplo n.º 14
0
        public AdminPresenter(IKernel kernel, IAdminView view, IAdmin_sUpdateService admin_SUpdateService, IAdminService adminService)
        {
            this.kernel = kernel;
            this.view   = view;
            this.admin_SUpdateService = admin_SUpdateService;
            this.adminService         = adminService;

            this.admin_SUpdateService.RegistrationQueueChange += ShowRegistrationQueue;
            this.admin_SUpdateService.UsersListChange         += ShowUsersList;
            this.admin_SUpdateService.FeedersListChange       += ShowFeederList;
            this.admin_SUpdateService.TagsListChange          += ShowTagsList;

            this.view.selectedFeederWasChanged += SelectedFeederWasChanged;
            this.view.selectedUserWasChanged   += SelectedUserWasChanged;
            this.view.AskRegistration          += AskRegistration;

            this.adminService.RegistrationView += RegistrationView;


            view.Show();
        }
Ejemplo n.º 15
0
        public void ShowTrainerOptions(IAdminView parentForm, IAdminTrainerOptionsView form, Trainer trainer, ITrainerRepository trainerRepository, ITeamRepository teamRepository)
        {
            form.SetTrainerValues(trainer, teamRepository.GetAll());
            var result = form.ShowViewModal();

            if (result == DialogResult.Yes)
            {
                string teamAddName = form.NameAddTeam();
                teamRepository.AddTrainerToTeam(trainer, teamAddName, trainerRepository);
            }
            else if (result == DialogResult.No)
            {
                string teamRemoveName = form.NameRemoveTeam();
                teamRepository.RemoveTrainerFromTeam(trainer, teamRemoveName, trainerRepository);
            }
            else if (result == DialogResult.Abort)
            {
                teamRepository.DeleteTrainer(trainer, trainerRepository);
            }
            parentForm.DisplayTrainerList(trainerRepository.GetAll(), teamRepository.GetAll());
            parentForm.DisplayTeamList(teamRepository.GetAll());
        }
Ejemplo n.º 16
0
 /// <summary>
 /// Starts a view showing a help menu (or possible commands).
 /// </summary>
 /// <param name="db">Optional location of database in case extra information needs to be shown.</param>
 /// <param name="view">The view on which the help information should be shown.</param>
 internal static void Help(IRepository <User> db, IAdminView view)
 {
     view.ShowMainMenu();
 }
Ejemplo n.º 17
0
        public void ShowTrainerInfo(IAdminView inForm, int trainerId)
        {
            var form = _formsFactory.AdminTrainerOptionsView();

            _adminController.ShowTrainerOptions(inForm, form, _trainerRepository.GetTrainerById(trainerId), _trainerRepository, _teamRepository);
        }
Ejemplo n.º 18
0
        public void ShowPlayerInfo(IAdminView inForm, int playerId)
        {
            var form = _formsFactory.AdminPlayerOptionsView(_playerRepository.GetPlayerById(playerId), _formsFactory, _adminController);

            _adminController.ShowPlayerOptions(inForm, form, _playerRepository.GetPlayerById(playerId), _playerRepository, _teamRepository, _transactionRepository);
        }
Ejemplo n.º 19
0
 public AdminPresenter(IAdminView adminView)
 {
     view = adminView;
     Initializer();
 }
Ejemplo n.º 20
0
 public AdminPresenter(IAdminView view)
 {
     _view = view;
     Subscribe();
 }
Ejemplo n.º 21
0
 /// <summary>
 /// Starts an optional view which handles any cases of improper commands.
 /// </summary>
 /// <param name="db">Location of optional database, probably not necessary in this context, but future proof.</param>
 /// <param name="view">The view on which handles the unknown command.</param>
 internal static void UnknownCommand(IRepository <User> db, IAdminView view)
 {
     view.UnknownCommand();
 }
Ejemplo n.º 22
0
 internal static void GenerateHtml(IRepository <User> db, IAdminView view)
 {
     // TODO Generate html file using XSLT ( generate table containing all users in html )
     view.ShowGenerateHTMLView();
 }
Ejemplo n.º 23
0
 /// <summary>
 /// Starts the quit command of the application which should be called on a view to close the application.
 /// </summary>
 /// <param name="db">Optional location of database in case extra handling is required.
 /// (e.g. persisting changes before quitting)</param>
 /// <param name="view">The view on which the quit command is called.</param>
 internal static void Quit(IRepository <User> db, IAdminView view)
 {
     view.QuitView();
 }
Ejemplo n.º 24
0
 public AdminService(IAdminView view)
 {
     this._adminView = view;
     _db             = new AdminRepo(this);
 }
Ejemplo n.º 25
0
 public AdminPresenter(IAdminView adminView)
 {
     _adminView  = adminView;
     _adminModel = new AdminModel();
 }
Ejemplo n.º 26
0
 private static void InitUsers(IRepository <User> db, IAdminView view)
 {
     _users = db.ReadAll();
 }
Ejemplo n.º 27
0
 /// <summary>
 /// Starts a view to show all the user in the database.
 /// </summary>
 /// <param name="db">The location of the database containing all the users</param>
 /// <param name="view">The view on which the users should be shown.</param>
 internal static void GetUsers(IRepository <User> db, IAdminView view)
 {
     InitUsers(db, view);
     view.ShowUserOverview(_users);
 }