private void SetUpData() { try { ListMovimenti = new RegistryMovementTypeList(); ListGestioni = new RegistryOwnersList(); ListConti = new RegistryLocationList(); ListValute = new RegistryCurrencyList(); TipoSoldis = new TipoSoldiList(); RegistryMovementTypeList listaOriginale = new RegistryMovementTypeList(); listaOriginale = _registryServices.GetRegistryMovementTypesList(); var RMTL = from movimento in listaOriginale where (movimento.Id_tipo_movimento == (int)TipologiaMovimento.Cedola || movimento.Id_tipo_movimento == (int)TipologiaMovimento.InsertVolatili || movimento.Id_tipo_movimento == (int)TipologiaMovimento.Giroconto) || movimento.Id_tipo_movimento == (int)TipologiaMovimento.Costi || movimento.Id_tipo_movimento == (int)TipologiaMovimento.CambioValuta || movimento.Id_tipo_movimento == (int)TipologiaMovimento.AcquistoTitoli || movimento.Id_tipo_movimento == (int)TipologiaMovimento.VenditaTitoli select movimento; foreach (RegistryMovementType registry in RMTL) { ListMovimenti.Add(registry); } ListValute = _registryServices.GetRegistryCurrencyList(); RegistryOwnersList ListaInvestitoreOriginale = new RegistryOwnersList(); ListaInvestitoreOriginale = _registryServices.GetGestioneList(); var ROL = from gestione in ListaInvestitoreOriginale where (gestione.Tipologia == "Gestore") select gestione; _TabControl.TabStripPlacement = Dock.Left; foreach (RegistryOwner registryOwner in ROL) { // per ogni gestione acquisisco is dati per la sintesi soldi TabItem tabItem = new TabItem(); tabItem.Header = registryOwner.Nome_Gestione; tabItem.Content = new TabControlSintesiView(new TabControlSintesiViewModel(_liquidAssetServices.GetCurrencyAvailable(registryOwner.Id_gestione))); _TabControl.Items.Add(tabItem); ListGestioni.Add(registryOwner); } ListConti = _registryServices.GetRegistryLocationList(); TipoSoldis = _registryServices.GetTipoSoldiList(); SharesList = new ObservableCollection <RegistryShare>(_registryServices.GetRegistryShareList()); _Filter = new Predicate <object>(Filter); BirdsListView = _registryServices.GetSharesByFirms(typeOfShares); } catch (Exception err) { throw new Exception("Errore nel setup." + Environment.NewLine + err.Message); } }
public RegistryMovementTypeViewModel(IRegistryServices services) { _services = services ?? throw new ArgumentNullException("RegistryMovementTypeViewModel With No Services"); try { MovementTypeList = new ObservableCollection <RegistryMovementType>(services.GetRegistryMovementTypesList()); } catch (Exception err) { MessageBox.Show("Errore nella richiesta dei dati." + Environment.NewLine + err.Message, "DAF-C Lista Tipologia Movimenti"); } CloseMeCommand = new CommandHandler(CloseMe); }
private void Init() { #region start command CloseMeCommand = new CommandHandler(CloseMe); InsertCommand = new CommandHandler(SaveCommand, CanSave); ModifyCommand = new CommandHandler(UpdateCommand, CanModify); InsertQuotaCommand = new CommandHandler(SaveCommand, CanSaveQuota); ModifyQuotaCommand = new CommandHandler(UpdateCommand, CanModifyQuota); EraseQuotaCommand = new CommandHandler(DeleteCommand, CanDelete); ClearCommand = new CommandHandler(CleanCommand); #endregion try { #region Inizializzazione Liste ListQuoteInv = new QuoteInvList(); ListTabQuote = new QuoteTabList(); ListMovementType = new RegistryMovementTypeList(); ListInvestitori = new RegistryOwnersList(); ListInvestitori2 = new RegistryOwnersList(); ListGestioni = new RegistryOwnersList(); ListLocation = new RegistryLocationList(); ListQuoteGuadagno = new QuotePerPeriodoList(); ListTipoSoldi = new TipoSoldiList(); ListValutePrelievo = new RegistryCurrencyList(); ListValuteVersGiro = new RegistryCurrencyList(); ListAnni = _managerLiquidServices.GetAnniFromGuadagni(); #endregion #region liste combo RegistryMovementTypeList listaOriginale = new RegistryMovementTypeList(); listaOriginale = _registryServices.GetRegistryMovementTypesList(); foreach (RegistryMovementType registry in listaOriginale) { if (registry.Id_tipo_movimento == 1 || registry.Id_tipo_movimento == 2) { ListMovementType.Add(registry); } } RegistryOwnersList ListaInvestitoreOriginale = new RegistryOwnersList(); ListaInvestitoreOriginale = _registryServices.GetGestioneList(); foreach (RegistryOwner RO in ListaInvestitoreOriginale) { if (RO.Tipologia == "Investitore") { ListInvestitori.Add(RO); ListInvestitori2.Add(RO); } else if (RO.Tipologia == "Gestore") { ListGestioni.Add(RO); } } #endregion UpdateCollection(); } catch (Exception err) { MessageBox.Show("Errore nella richiesta dei dati." + Environment.NewLine + err.Message, "DAF-C Quote Investitori"); } }
/// <summary> /// E' l'evento di edit nella cella di descrizione della gestione /// se il modello ha un valore di id vuol dire che è in modifica /// se il valore è zero vuol dire che è un inserimento di nuova gestione /// </summary> /// <param name="sender">la cella di descrizione</param> /// <param name="e">la conferma o meno della modifica</param> public void CellChanged(object sender, DataGridCellEditEndingEventArgs e) { try { if (e.EditAction == DataGridEditAction.Commit) { MovementType = ((RegistryMovementType)e.Row.Item); if (MovementType.Id_tipo_movimento > 0) { _services.UpdateMovementType(MovementType); } else { _services.AddMovementType(MovementType.Desc_tipo_movimento); MovementTypeList = new ObservableCollection <RegistryMovementType>(_services.GetRegistryMovementTypesList()); } } } catch (Exception err) { MessageBox.Show("Errore nell'aggiornamento dei dati: " + err.Message); } }