public void FillDGV(int id) { List <DGVHistoriqueClient> HistoriquesClient = _historiqueDataService.GetAllHistoriquesOfCli(id) ?? new List <DGVHistoriqueClient>(); var h = new BindingList <DGVHistoriqueClient>(HistoriquesClient); _view.DataGridViewHistorique.DataSource = new BindingSource(h, null); List <DGVAbonnementsClient> AbonnementsClients = _abonnementDataService.GetAllAbonnementsOfCli(id) ?? new List <DGVAbonnementsClient>(); var magDataService = new MagazineDataService(_cache, _serializer, _errorLogger); foreach (DGVAbonnementsClient abo in AbonnementsClients) { Magazine mag = magDataService.GetMagazine(abo.MagId); abo.Price = mag.PrixAnnuel.ToString(); abo.MagazineName = mag.Titre; abo.StatusFriendly = ((StatusCode)abo.Status).GetDescription(); } var a = new BindingList <DGVAbonnementsClient>(AbonnementsClients); _view.DataGridViewClientAbonnement.DataSource = new BindingSource(a, null); _view.DataGridViewClientAbonnement.Columns["AbonnementId"].Visible = false; _view.DataGridViewClientAbonnement.Columns["Status"].Visible = false; _view.DataGridViewClientAbonnement.Columns["MagId"].Visible = false; _view.DataGridViewClientAbonnement.Columns["MagazineName"].HeaderText = "Titre"; _view.DataGridViewClientAbonnement.Columns["StatusFriendly"].HeaderText = "Etat"; _view.DataGridViewClientAbonnement.Columns["Price"].HeaderText = "Prix"; _view.DataGridViewClientAbonnement.Columns["DateFin"].HeaderText = "Date de fin"; }
public void FillDGV() { List <DGVMagazine> Magazines = new MagazineDataService(_cache, _serializer, _errorLogger).GetMagazines() ?? new List <DGVMagazine>(); var h = new BindingList <DGVMagazine>(Magazines); _control.BTMag.Enabled = false; _control.DataGridViewMagazine.DataSource = new BindingSource(h, null); _control.DataGridViewMagazine.Columns["Id"].Visible = false; _control.DataGridViewMagazine.Columns["NumeroAnnée"].HeaderText = "Numéro année"; _control.DataGridViewMagazine.Columns["PrixAnnuel"].HeaderText = "Prix annuel"; }
public AbonnementsViewModel() { try { AbonnementDataService abonnementDataService = new AbonnementDataService(Serializer, ErrorLogger, DialogService); MagazineDataService magazineDataService = new MagazineDataService(Serializer, ErrorLogger, DialogService); _abonnements = new ObservableCollection <Abonnement>(abonnementDataService.GetAbonnements(Settings.CurrentUser.Id));//Settings.UserId foreach (var abo in _abonnements) { abo.Magazine = magazineDataService.GetMagazine(abo.IdMagazine) ?? new Magazine(); } } catch (Exception ex) { _abonnements = new ObservableCollection <Abonnement>(); _abonnements.Add(new Abonnement { Magazine = new Magazine { Titre = "le monde" }, DateExpiration = new DateTime(DateTime.Now.Ticks).AddMonths(2) }); _abonnements.Add(new Abonnement { Magazine = new Magazine { Titre = "Le Gorafi" }, DateExpiration = new DateTime(DateTime.Now.Ticks).AddYears(2) }); _abonnements.Add(new Abonnement { Magazine = new Magazine { Titre = "Le Parisien" }, DateExpiration = new DateTime(DateTime.Now.Ticks).AddMonths(8) }); _abonnements.Add(new Abonnement { Magazine = new Magazine { Titre = "La Provence" }, DateExpiration = new DateTime(DateTime.Now.Ticks).AddDays(7) }); _abonnements.Add(new Abonnement { Magazine = new Magazine { Titre = "Le canard enchaîné" }, DateExpiration = new DateTime(DateTime.Now.Ticks).AddMonths(1) }); } }
public MagazineViewModel(MagazineDataService magazineDateService, ButtonSubscribedMagazineViewModel subscribed, ButtonSubscribeMagazineViewModel subscribe) { _magazineDataService = magazineDateService; _subscribe = subscribe; _subscribed = subscribed; }