public void OnCreationHistoriqueRequested(object sender, EventArgs e)
        {
            Button bt = (Button)sender;
            HistoriqueDataService historiqueDataService = new HistoriqueDataService(_cache, _serializer, _errorLogger);
            string moyen = "";

            switch (bt.Name)
            {
            case "BTCourrier":
                moyen = "Courrier";
                break;

            case "BTTelephone":
                moyen = "Telephone";
                break;

            case "BTMail":
                moyen = "Mail";
                break;

            default:
                MessageBox.Show("Erreur lors de la tentative");
                break;
            }
            if (!string.IsNullOrEmpty(moyen))
            {
                bool insert = historiqueDataService.CreateHistorique(new Historique(_view.Id, Constant.CurrentEmploye.Id, moyen, _view.Motif, DateTime.Now));
                if (insert)
                {
                    MessageBox.Show("Insertion réussie");
                }
                _view.Close();
            }
        }
 public ClientPresenter(IClientView view, ICacheService cache, IErrorLogger errorLogger, IDeserializer serializer) : base(cache, errorLogger, serializer)
 {
     _view = view;
     _view.CloseRequested += OnCloseRequested;
     _view.CreationHistoriqueRequested += OnCreationHistoriqueRequested;
     _view.OnSuspendAbonnement         += SuspendAbonnement;
     _view.OnRepayAbonnement           += RepayAbonnement;
     _clientDataService     = new ClientDataService(_cache, _serializer, _errorLogger);
     _abonnementDataService = new AbonnementDataService(_cache, _serializer, _errorLogger);
     _historiqueDataService = new HistoriqueDataService(_cache, _serializer, _errorLogger);
 }
Exemple #3
0
        public void FillDGV()
        {
            List <DGVHistorique> Historiques       = new HistoriqueDataService(_cache, _serializer, _errorLogger).GetAllHistoriquesOfEmp(Constant.CurrentEmploye.Id) ?? new List <DGVHistorique>();
            ClientDataService    clientDataService = new ClientDataService(_cache, _serializer, _errorLogger);

            foreach (DGVHistorique his in Historiques)
            {
                Client cli = clientDataService.GetClient(his.ClientId);
                if (cli != null)
                {
                    his.Prenom = cli.Prenom;
                    his.Nom    = cli.Nom;
                }
            }
            var h = new BindingList <DGVHistorique>(Historiques);

            _control.DataGridViewHistorique.DataSource = new BindingSource(h, null);
            if (Historiques.Count > 0)
            {
                _control.DataGridViewHistorique.Columns["ClientId"].Visible = false;
            }
        }