Beispiel #1
0
        public EditCneViewModel(CneItemViewModel _cneItemViewModel)
        {
            //  Gets an intance of the services class
            this.apiService        = new ApiService();
            this.dialogService     = new DialogService();
            this.navigationService = new NavigationService();

            //  Capture the instance of the CneItemViewModel
            this.cneItemViewModel = _cneItemViewModel;
            this.mainViewModel    = MainViewModel.GetInstance();
            this.cantvViewModel   = CantvViewModel.GetInstance();

            //  Invoke the method of load values CNE
            this.LoadData();
        }
        public GetCneViewModel(CneItemViewModel _cneItemViewModel)
        {
            //  Load value of the CneItemViewModel
            this.cneItemViewModel = _cneItemViewModel;

            //  Gets an instance of the services class
            this.apiService        = new ApiService();
            this.dialogService     = new DialogService();
            this.navigationService = new NavigationService();

            //  Sets status of controls
            this.SetStatusControl(true, false, "Green", 0);

            //  Initialize the values of the controls
            this.isValid = true;
            this.LoadValuesControls(0, null);

            //  Get data of the CNE
            FindDataCne();
        }
        public void UpdateCneData(
            int _option,
            CneItemViewModel _cneItemViewModel)
        {
            this.SetStatusControls(true);

            //  Opti an list of the CneIvssData
            var oldListCne = this.listCnes
                             .Where(cid => cid.CneIvssDataId == _cneItemViewModel.CneIvssDataId)
                             .FirstOrDefault();

            switch (_option)
            {
            case -1:
                this.listCnes.Remove(_cneItemViewModel);
                break;

            case 0:
                oldListCne = _cneItemViewModel;
                break;

            case 1:
                this.listCnes.Add(_cneItemViewModel);
                break;
            }

            //this.Cnes.Clear();

            //this.Cnes = new ObservableCollection<CneItemViewModel>(
            //this.listCnes
            //.OrderBy(cne => cne.NationalityDatas.First().Abbreviation)
            //.ThenBy(cne => cne.IdentificationCard));

            LoadUserData();

            this.SetStatusControls(false);
        }