Ejemplo n.º 1
0
        public void Execute(object parameter)
        {
            var newPerson = new PersonUI(new Person {
                Addresses = new List <Address>(new List <Address> {
                    new Address()
                })
            });

            this.mainWindowViewModel.People.Add(newPerson);
            this.mainWindowViewModel.PeopleToAddWhenSaving.Add(newPerson);
            this.mainWindowViewModel.SelectedPerson = newPerson;
        }
Ejemplo n.º 2
0
        public async Task <List <PersonUI> > AddPSCommissionStaff(Guid eid, Guid id, PersonUI person)
        {
            var q    = from c in _context.PollingStationCommission where c.ElectionFk == eid && c.Id == id select c;
            var comm = new PollingStationCommissioner();

            comm.Id       = Guid.NewGuid();
            comm.PersonFk = person.Id;
            comm.PollingStationCommissionFk = id;
            _context.PollingStationCommissioner.Add(comm);
            await _context.SaveChangesAsync();

            var l = (await q.FirstAsync()).PollingStationCommissioner.ToList().ConvertAll(c => new PersonUI(c.PersonFkNavigation));

            return(l);
        }
Ejemplo n.º 3
0
        public MainWindowViewModel(List <IDataClient> dataClients)
        {
            this.selectedPerson            = null;
            this.People.CollectionChanged += People_CollectionChanged;
            this.People.CollectionChanged += SomePeople_CollectionChanged;
            this.PeopleToAddWhenSaving.CollectionChanged    += SomePeople_CollectionChanged;
            this.PeopleToRemoveWhenSaving.CollectionChanged += SomePeople_CollectionChanged;

            this.dataSourceChoices = new List <DataSourceChoice>(dataClients.Select(p =>
            {
                var dataSourceChoice              = new DataSourceChoice(p);
                dataSourceChoice.PropertyChanged += DataSourceChoice_PropertyChanged;
                return(dataSourceChoice);
            }));
        }
Ejemplo n.º 4
0
 public void Execute(object parameter)
 {
     try
     {
         var people = this.mainWindowViewModel.CurrentDataClient.GetPeopleWithAddresses();
         this.mainWindowViewModel.ResetPeopleList();
         foreach (var person in people)
         {
             var personUI = new PersonUI(person);
             this.mainWindowViewModel.People.Add(personUI);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Ejemplo n.º 5
0
        public MainWindowViewModel()
        {
            this.selectedPerson            = null;
            this.People.CollectionChanged += People_CollectionChanged;
            this.People.CollectionChanged += SomePeople_CollectionChanged;
            this.PeopleToAddWhenSaving.CollectionChanged    += SomePeople_CollectionChanged;
            this.PeopleToRemoveWhenSaving.CollectionChanged += SomePeople_CollectionChanged;

            var webApi2BaseUrl = Properties.Settings.Default.WebApi2DataClientUrl.TrimEnd("/".ToCharArray()) + "/";
            var wcfBaseUrl     = Properties.Settings.Default.WCFDataClientUrl.TrimEnd("/".ToCharArray()) + "/";

            this.dataSourceChoices = new List <DataSourceChoice>();
            this.dataSourceChoices.Add(new DataSourceChoice(new WebApi2DataClient(webApi2BaseUrl)));
            this.dataSourceChoices.Add(new DataSourceChoice(new WCFDataClient(wcfBaseUrl)));
            foreach (var dataSourceChoice in this.dataSourceChoices)
            {
                dataSourceChoice.PropertyChanged += DataSourceChoice_PropertyChanged;
            }
        }
Ejemplo n.º 6
0
        public async Task <List <PersonUI> > DeletePSCommissionStaff(Guid eid, Guid id, PersonUI person)
        {
            var q = from c in _context.PollingStationCommission
                    join sc in _context.PollingStationCommissioner on c.Id equals sc.PollingStationCommissionFk
                    where c.ElectionFk == eid && c.Id == id && person.Id == sc.PersonFk
                    select sc;

            _context.PollingStationCommissioner.Remove(await q.FirstAsync());
            await _context.SaveChangesAsync();

            var staff = from c in _context.PollingStationCommission where c.ElectionFk == eid && c.Id == id select c;
            var l     = (await staff.FirstAsync()).PollingStationCommissioner.ToList().ConvertAll(c => new PersonUI(c.PersonFkNavigation));

            return(l);
        }