private void ConsulterCompte_Load(object sender, EventArgs e)
        {
            txtNumero.Text = numéroCompte.ToString();

            Compte compte = clientService.GetCompteById(numéroCompte);

            Client client = clientService.GetClientByCompteId(compte.Id);

            ClientPersonne clientP = clientService.GetClientPersonneById(client.Id);

            if (clientP == null)
            {
                ClientEntreprise clientE = clientService.GetClientEntrepriseById(client.Id);
                txtNom.Text = clientE.raisonSociale;
            }
            else
            {
                txtNom.Text = clientP.nom + " " + clientP.prénom;
            }

            IReadOnlyList <ServiceDiffusion> serviceDiffusions = clientService.GetServiceDiffusionByCompteId(compte.Id);
            IReadOnlyList <Equipement>       equipements       = clientService.GetEquipementByCompteId(compte.Id);

            foreach (ServiceDiffusion s in serviceDiffusions)
            {
                lstServices.Items.Add(s.nom);      ///////
            }
            foreach (Equipement eq in equipements)
            {
                lstEquipements.Items.Add(eq.nom);     ///////
            }
        }
        private void CmbChercherClient_SelectionChangeCommitted(object sender, EventArgs e)
        {
            if (cmbChercherClient.SelectedItem == null)
            {
                return;
            }

            List <Compte> comptes = new List <Compte>();

            ClientPersonne client = clientService.SearchClientPersonnes(cmbChercherClient.SelectedItem.ToString(), 1, 5)[0];

            if (client == null)
            {
                ClientEntreprise client1 = clientService.SearchClientEntreprises(cmbChercherClient.SelectedItem.ToString(), 1, 5)[0];
                comptes = (List <Compte>)clientService.GetCompteByClientId(client1.Id);
            }
            else
            {
                comptes = (List <Compte>)clientService.GetCompteByClientId(client.Id);
            }



            foreach (Compte c in comptes)
            {
                grdComptes.Rows.Add(c.Id, c.solde);
            }



            cmbChercherClient.Items.Clear();
        }
        private void Selectionner_Click(object sender, EventArgs e)
        {
            if (grdInstallation.SelectedRows == null)
            {
                return;
            }


            int          numéro       = Util.StringToInt(grdInstallation.SelectedRows[0].Cells[0].Value.ToString());
            Installation installation = clientService.GetInstallationById(numéro);

            Compte compte = clientService.GetCompteByInstallationId(installation.Id);

            txtNumero.Text = compte.Id.ToString();

            Client client = clientService.GetClientByCompteId(compte.Id);

            txtAdresse.Text = client.adresse;

            ClientPersonne clientP = clientService.GetClientPersonneById(client.Id);

            if (clientP == null)
            {
                ClientEntreprise clientE = clientService.GetClientEntrepriseById(client.Id);
                txtNom.Text = clientE.raisonSociale;
            }
            else
            {
                txtNom.Text = clientP.nom + " " + clientP.prénom;
            }

            txtTelephone.Text         = client.téléphone;
            txtDateProgrammation.Text = installation.dateProgramation.Date.ToString();
        }
Пример #4
0
        public Task InitialiserEnvironnementAsync()
        {
            Client client = GetClientByIdAsync(1).Result;

            if (client == null)
            {
                string[] territoires = new string[] { "Alberta", "Colombie Britannique", "Île-du-Prince-Édouard", "Manitoba", "Nouveau-Brunswick", "Nouvelle-Écosse", "Nunavut", "Ontario", "Québec", "Saskatchewan", "Terre-Neuve-et-Labrador", "Territoires-du-Nord-Ouest", "Yukon" };


                foreach (string t in territoires)
                {
                    AddTerritoire(new Territoire(t));
                }

                Territoire territoire = GetTerritoireByNomAsync("Québec").Result[0];

                ClientPersonne client1 = new ClientPersonne("123456789", "g5l 3x8 rimouski", territoire, "ayman", "chafni");

                AddClientPersonneAsync(client1);

                EmployéRC employérc1 = new EmployéRC("test", "michel", "antoin", "632145789", "g5l 3x8 montréal", 20);
                AddEmployéRCAsync(employérc1);
                Technicien technicien = new Technicien("test", "bilal", "rami", "457895123", "g5l 3x8 montréal", 24, territoire);
                AddTechnicienAsync(technicien);
                Compte compte1 = new Compte(ModeFacturation.Annuel, client1, employérc1);
                Compte compte2 = new Compte(ModeFacturation.Mensuel, client1, employérc1);

                AddCompteAsync(compte1);
                AddCompteAsync(compte2);
            }

            return(new Task(null));
        }
        private void Ajouter_Click(object sender, EventArgs e)
        {
            if (txtAdresse.Text == "" || txtAdresse == null)
            {
                errAdresse.Visible = true;
                return;
            }

            if (txtTelephone.Text == "" || txtTelephone == null)
            {
                errTelephone.Visible = true;
                return;
            }

            if (txtTerritoire.Text == "" || txtTerritoire == null)
            {
                errTerritoire.Visible = true;
                return;
            }

            if ((txtRaisonSociale.Text == "" || txtRaisonSociale == null) & ((txtNom.Text == "" || txtNom == null) || (txtPrenom.Text == "" || txtPrenom == null)))
            {
                errNomVide.Visible = true;
                return;
            }

            if ((txtRaisonSociale.Text != "" & txtRaisonSociale != null) & ((txtNom.Text != "" & txtNom != null) || (txtPrenom.Text != "" & txtPrenom != null)))
            {
                errNomVide.Visible = true;
                return;
            }

            if (txtRaisonSociale.Text != "" & txtRaisonSociale != null)
            {
                Territoire       territoire = clientService.GetTerritoireByNom(txtTerritoire.Text)[0];
                ClientEntreprise client     =
                    clientService.AddClientEntreprise(new ClientEntreprise(txtTelephone.Text, txtAdresse.Text, territoire, txtRaisonSociale.Text));

                MessageBox.Show(client.raisonSociale);


                AjouterCompte formAjouterCompte = new AjouterCompte(client.Id, clientService, facturationService);
                formAjouterCompte.ShowDialog();
            }

            if (txtNom.Text != "" & txtNom != null)
            {
                Territoire     territoire        = clientService.GetTerritoireByNom(txtTerritoire.Text)[0];
                ClientPersonne client            = clientService.AddClientPersonne(new ClientPersonne(txtTelephone.Text, txtAdresse.Text, territoire, txtNom.Text, txtPrenom.Text));
                AjouterCompte  formAjouterCompte = new AjouterCompte(client.Id, clientService, facturationService);
                formAjouterCompte.ShowDialog();
            }
        }
        private void GrdComptes_SelectionChanged(object sender, EventArgs e)
        {
            if (grdComptes.SelectedRows.Count == 0 || grdComptes.SelectedRows[0].Cells[0].Value == null)
            {
                return;
            }



            int numéro = (int)grdComptes.SelectedRows[0].Cells[0].Value;

            //MessageBox.Show(numéro.ToString());

            Compte compte = clientService.GetCompteById(numéro);

            txtModeFacture.Text = compte.modeFacturation.ToString();

            Client client = clientService.GetClientByCompteId(compte.Id);

            ClientPersonne clientP = clientService.GetClientPersonneById(client.Id);

            if (clientP == null)
            {
                ClientEntreprise clientE = clientService.GetClientEntrepriseById(client.Id);
                txtNomClient.Text = clientE.raisonSociale;
            }
            else
            {
                txtNomClient.Text = clientP.nom + " " + clientP.prénom;
            }

            txtSolde.Text        = compte.solde.ToString();
            txtNumeroCompte.Text = compte.Id.ToString();


            btnConsulterCompte.Enabled  = true;
            btnConsulterFacture.Enabled = true;
            btnModifierCompte.Enabled   = true;
            btnSupprimerCompte.Enabled  = true;
            btnVoirFilm.Enabled         = true;
            btnModifierClient.Enabled   = true;
            btnConsulterClient.Enabled  = true;
            btnAjouterCompte.Enabled    = true;
        }
        private void CmbChercherCompte_SelectionChangeCommitted(object sender, EventArgs e)
        {
            cmbChercherCompte.Items.Clear();
            grdComptes.Rows.Clear();

            int    numéro = Util.StringToInt(cmbChercherCompte.Text);
            Compte compte = clientService.GetCompteById(numéro);

            txtModeFacture.Text  = compte.modeFacturation.ToString();
            txtSolde.Text        = compte.solde.ToString();
            txtNumeroCompte.Text = compte.Id.ToString();

            Client client = clientService.GetClientByCompteId(compte.Id);

            ClientPersonne clientP = clientService.GetClientPersonneById(client.Id);

            if (clientP == null)
            {
                ClientEntreprise clientE = clientService.GetClientEntrepriseById(client.Id);
                txtNomClient.Text = clientE.raisonSociale;
            }
            else
            {
                txtNomClient.Text = clientP.nom + " " + clientP.prénom;
            }



            IReadOnlyList <Compte> comptes = clientService.GetCompteByClientId(client.Id);

            //MessageBox.Show(grdComptes.Rows.Count.ToString());



            foreach (Compte c in comptes) ////////////////////////
            {
                grdComptes.Rows.Add(c.Id, c.solde);
            }

            grdComptes.Refresh();
        }
        private void ModifierCompte_Load(object sender, EventArgs e)
        {
            txtNumero.Text = numéroCompte.ToString();
            Client client = clientService.GetClientByCompteId(numéroCompte);

            ClientEntreprise clientEntreprise = clientService.GetClientEntrepriseById(client.Id);

            if (clientEntreprise == null)
            {
                ClientPersonne clientPersonne = clientService.GetClientPersonneById(client.Id);
                txtNom.Text = clientPersonne.nom + clientPersonne.prénom;
            }

            else
            {
                txtNom.Text = clientEntreprise.raisonSociale;
            }

            IReadOnlyList <EstDesserviDans> ests = clientService.GetEstDesserviDansByTerritoireId(clientService.GetTerritoireByClientId(client.Id).Id);

            foreach (EstDesserviDans est in ests)
            {
                ServiceDiffusion service = clientService.GetServiceDiffusionByEstDesserviDans(est.Id);

                chkServices.Items.Add(service.nom);
            }


            IReadOnlyList <Equipement> _equipements = clientService.GetAllEquipements();
            List <Equipement>          equipements1 = new List <Equipement>();

            foreach (Equipement eq in _equipements)
            {
                bool existe = false;
                foreach (Equipement e1 in equipements1)
                {
                    if (e1.nom == eq.nom)
                    {
                        existe = true;
                        break;
                    }
                }

                if (existe == false)
                {
                    equipements1.Add(eq);
                    chkEquipements.Items.Add(eq.nom);
                }
            }

            //chkEquipements.Items.AddRange(equipements.ToArray());

            IReadOnlyList <ServiceDiffusion> services    = clientService.GetServiceDiffusionByCompteId(numéroCompte);
            IReadOnlyList <Equipement>       equipements = clientService.GetEquipementByCompteId(numéroCompte);

            foreach (ServiceDiffusion s in services)
            {
                if (chkServices.Items.Contains(s.nom))
                {
                    chkServices.SetItemChecked(chkServices.Items.IndexOf(s.nom), true);
                }
            }

            foreach (Equipement eq in equipements)
            {
                if (chkEquipements.Items.Contains(eq.nom))
                {
                    chkEquipements.SetItemChecked(chkEquipements.Items.IndexOf(eq.nom), true);
                }
            }
        }
Пример #9
0
 public ClientPersonne AddClientPersonne(ClientPersonne client)
 {
     return(_clientPersonneRepository.Add(client));
 }
Пример #10
0
 public int UpdateClientPersonne(ClientPersonne client)
 {
     return(_clientPersonneRepository.Update(client));
 }
Пример #11
0
        public int InitialiserEnvironnement()
        {
            Client client = GetClientById(1);

            if (client == null)
            {
                string[] territoires = new string[] { "Alberta", "Colombie Britannique", "Île-du-Prince-Édouard", "Manitoba", "Nouveau-Brunswick", "Nouvelle-Écosse", "Nunavut", "Ontario", "Québec", "Saskatchewan", "Terre-Neuve-et-Labrador", "Territoires-du-Nord-Ouest", "Yukon" };


                foreach (string t in territoires)
                {
                    AddTerritoire(new Territoire(t));
                }

                Territoire territoire = GetTerritoireByNom("Québec")[0];

                ClientPersonne client1 = AddClientPersonne(new ClientPersonne("123456789", "g5l 3x8 rimouski", territoire, "ayman", "chafni"));



                EmployéRC  employérc1 = AddEmployéRC(new EmployéRC("test", "michel", "antoin", "632145789", "g5l 3x8 montréal", 20));
                Technicien technicien = new Technicien("test", "bilal", "rami", "457895123", "g5l 3x8 montréal", 24, territoire);

                AddTechnicien(technicien);
                Compte compte1 = new Compte(ModeFacturation.Annuel, client1, employérc1);
                Compte compte2 = new Compte(ModeFacturation.Mensuel, client1, employérc1);



                List <ServiceDiffusion> services = new List <ServiceDiffusion>();

                services.Add(AddServiceDiffusion(new ServiceDiffusion("service de base")));
                AddServiceDiffusion(new ServiceDiffusion("service maxi-vue"));
                services.Add(AddServiceDiffusion(new ServiceDiffusion("service 911")));


                compte1.serviceDiffusions = services;
                AddCompte(compte1);
                AddCompte(compte2);

                AddEquipement(new Equipement(121, "téléviseur", compte1));
                AddEquipement(new Equipement(121, "télécommande", compte1));
                AddEquipement(new Equipement(121, "décodeur", compte1));
                AddEquipement(new Equipement(121, "téléviseur XL", compte1));


                EstDesserviDans est  = new EstDesserviDans(74, GetTerritoireByNom("Québec")[0], GetServiceByNom("service de base")[0]);
                EstDesserviDans est1 = new EstDesserviDans(140, GetTerritoireByNom("Québec")[0], GetServiceByNom("service maxi-vue")[0]);
                EstDesserviDans est2 = new EstDesserviDans(74, GetTerritoireByNom("Québec")[0], GetServiceByNom("service 911")[0]);

                AddEstDesserviDans(est);
                AddEstDesserviDans(est1);
                AddEstDesserviDans(est2);

                return(0);
            }



            return(1);
        }
Пример #12
0
 public Task AddClientPersonneAsync(ClientPersonne client)
 {
     return(_clientPersonneRepository.AddAsync(client));
 }