private async void AddPosition_Click(object sender, RoutedEventArgs e)
        {
            var settings = new MetroDialogSettings
            {
                ColorScheme = MetroDialogColorScheme.Theme,
                AnimateShow = true,
            };

            if (string.IsNullOrWhiteSpace(TextBoxPositionName.Text) || string.IsNullOrWhiteSpace(FacultyList.Text))
            {
                await this.ShowMessageAsync("Add new Position", "Please Specify Position Name ");
            }
            var result = await this.ShowMessageAsync("Add new Position", "are you sure you want to add ", MessageDialogStyle.AffirmativeAndNegative, settings);

            if (result != MessageDialogResult.Affirmative)
            {
                return;
            }
            CurrentPosition = new Position {
                Id = _positionId, PositionName = TextBoxPositionName.Text, RankId = Convert.ToInt32(RankList.SelectedValue), FacultyId = Convert.ToInt32(FacultyList.SelectedValue)
            };
            _electionConfigurationService = container.Resolve <IElectionConfigurationService>();
            await _electionConfigurationService.AddPositionAsync(CurrentPosition);

            await this.ShowMessageAsync("Add new Position", "success");

            AdminSetUpPositionPage_Loaded(this, e);
        }
 public PresidentLoginWindow(IElectionConfigurationService electionConfigurationService, IVotingService votingService)
 {
     _electionConfigurationService = electionConfigurationService;
     _votingService = votingService;
     InitializeComponent();
     BtnLogin.Click += BtnLogin_Click;
     //Username.Focus();
 }
Пример #3
0
        public AdminLoginWindow()
        {
            var container = new BootStrapper().BootStrap();

            _electionConfigurationService = container.Resolve <IElectionConfigurationService>();
            InitializeComponent();
            BtnLogin.IsDefault = true;
            //Username.Focus();
            BtnLogin.Click += BtnLogin_Click;
        }
        private async void AdminSetUpPositionPage_Loaded(object sender, RoutedEventArgs e)
        {
            _electionConfigurationService = container.Resolve <IElectionConfigurationService>();
            FacultyList.ItemsSource       = await _electionConfigurationService.GetFacultiesAsync();

            PositionList.ItemsSource
                = await _electionConfigurationService.GetAllPositionsAsync(true);

            RankList.ItemsSource
                = await _electionConfigurationService.GetAllRanksAsync();
        }
        public AdminDispensePasswordWindow()
        {
            var container = new BootStrapper().BootStrap();

            _electionConfigurationService = container.Resolve <IElectionConfigurationService>();
            InitializeComponent();
            Loaded += AdminDispensePasswordWindow_Loaded;
            StudentName.TextChanged             += StudentName_TextChanged;
            StudentsSearchList.MouseDoubleClick += StudentsSearchList_MouseDoubleClick;
            RefreshList.Click += RefreshList_Click;
        }
Пример #6
0
        public EcChairmanLoginWindow(IElectionConfigurationService electionConfigurationService)
        {
            var container = new BootStrapper().BootStrap();

            _electionConfigurationService = electionConfigurationService;

            InitializeComponent();
            WindowState        = WindowState.Maximized;
            BtnLogin.IsDefault = true;
            BtnLogin.Click    += BtnLogin_Click;
            //Username.Focus();
        }
Пример #7
0
        public AdminCreateAccountPage(IElectionConfigurationService electionConfigurationService)
        {
            var container = new BootStrapper().BootStrap();

            _electionConfigurationService = electionConfigurationService;
            InitializeComponent();
            BtnSave.Click       += BtnSave_Click;
            IsChairman.Checked  += IsChairman_Checked;
            IsPresident.Checked += IsPresident_Checked;
            //RepeatPassword.PasswordChanged += RepeatPassword_TextChanged;
            RepeatPassword.PasswordChanged += RepeatPassword_PasswordChanged;
        }
Пример #8
0
        public ClientsLoginWindow()
        {
            InitializeComponent();
            container = new BootStrapper().BootStrap();

            _electionConfigurationService = container.Resolve <IElectionConfigurationService>();

            _positionsStack = new Stack <Position>();
            Loaded         += ClientsLoginWindow_Loaded;
            _voter          = new Voter();
            BtnGo.Click    += BtnGo_Click;
        }
Пример #9
0
 public AdminAddVotersPage()
 {
     _container = new BootStrapper().BootStrap();
     _electionConfigurationService = _container.Resolve <IElectionConfigurationService>();
     _votingService = _container.Resolve <IVotingService>();
     InitializeComponent();
     _dataSet                      = new DataSet();
     voters                        = new List <Voter>();
     BtnSearch.Click              += BtnSearch_Click;
     BtnImportFile.Click          += BtnImportFile_Click;
     BtnSave.Click                += BtnSave_Click;
     TextBoxIndexNumber.LostFocus += TextBoxIndexNumber_LostFocus;
     Loaded                       += AdminAddVotersPage_Loaded;
 }
Пример #10
0
 public App()
 {
     try
     {
         _container = new BootStrapper().BootStrap();
         _window    = _container.Resolve <ClientsLoginWindow>();
         _electionConfigurationService = _container.Resolve <IElectionConfigurationService>();
         BlobCache.ApplicationName     = $"VotingApplication";
         AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
     }
     catch (Exception e)
     {
         _container.Resolve <IDialogService>().ShowMessageAsync(_window, "Error", e.Message).Wait();
     }
 }
        private async void SaveElection_Click(object sender, RoutedEventArgs e)
        {
            if (
                !string.IsNullOrWhiteSpace(TextBoxElectionName.Text) || !string.IsNullOrWhiteSpace(TextBoxElectionName.Text))
            {
                _electionConfigurationService = _container.Resolve <IElectionConfigurationService>();
                await _electionConfigurationService.AddElectionConfigurationsAsync(new ElectionConfiguration
                {
                    ElectionName     = TextBoxElectionName.Text,
                    ElectionSubTitle = TextBoxSubtitle.Text,
                    Colour           = string.Join(",", _chosencolor.R.ToString(), _chosencolor.G.ToString(), _chosencolor.B.ToString()),
                    Logo             = Util.ConvertToBytes(Logo)
                });

                Util.Clear(this);
            }
        }
Пример #12
0
        public AdminSetUpCandidatesPage()
        {
            _candidateId = 0;
            InitializeComponent();
            SaveCandidate.Click += SaveCandidate_Click;
            #region RankGeneration
            //_rank = new List<int>();
            //for (int i = 1; i <= 10; ++i)
            //{
            //	_rank.Add(i);
            //}
            //RankCombo.ItemsSource = _rank;
            #endregion

            var container = new BootStrapper().BootStrap();
            _electionConfigurationService = container.Resolve <IElectionConfigurationService>();
        }
Пример #13
0
 public MainWindowViewModel(IElectionConfigurationService service)
 {
     _service = service;
 }
Пример #14
0
 public AddPositionViewModel(IElectionConfigurationService electionConfigurationService)
 {
     _electionConfigurationService = electionConfigurationService;
 }