Beispiel #1
0
 public Employe(string nom, string prenom, long salaireBrut,
                int nombreDeJours, CodeConjoint conjoint, int enfants, string matricule)
 {
     this.nom           = nom;
     this.prenom        = prenom;
     this.salaireBrut   = salaireBrut;
     this.nombreDeJours = nombreDeJours;
     this.conjoint      = conjoint;
     this.enfants       = enfants;
     this.matricule     = matricule;
 }
Beispiel #2
0
 public Employe(string matricule, string nom, string prenom, double salaire,
                int nbreJours, int enfants, CodeConjoint conjoint)
 {
     Matricule   = matricule;
     Nom         = nom;
     Prenom      = prenom;
     SalaireBrut = salaire;
     NbreJours   = nbreJours;
     Enfants     = enfants;
     Conjoint    = conjoint;
 }
Beispiel #3
0
        private void ValiderButton_Click(object sender, RoutedEventArgs e)
        {
            Matricule = matricule.Text;
            Nom       = nom.Text;
            Prenom    = prenom.Text;
            Salaire   = salaire.Text;
            NbreJours = jours.Text;
            Conjoint  = conjoint.Text;
            Enfants   = enfant.Text;

            if (double.TryParse(Salaire, out double sal))
            {
                if (sal > 1000000000)
                {
                    MessageBox.Show("Le montant du salaire n'est par pris en charge par ce programme !");
                    return;
                }
            }

            string reponse = ValidateEmployeInformation();

            if (reponse == "ok")
            {
                CodeConjoint conjoint = Conjoint == "0" ? CodeConjoint.Celibataire : CodeConjoint.ConjointNonSalarie;
                Employe      employe  = new Employe(Matricule,
                                                    Nom,
                                                    Prenom,
                                                    double.Parse(Salaire),
                                                    int.Parse(NbreJours),
                                                    int.Parse(Enfants),
                                                    conjoint);

                CalculImpot calculImpot = new CalculImpot(employe);
                if (!calculImpot.ValidateSalaire(calculImpot.GetBrutFiscalAnnuel() / 12))
                {
                    MessageBox.Show("Donnez un montant de salaire supérieur au SMIG et ne dépassant pas la normal !");
                    return;
                }
                if (!IsEmployeExist(employe))
                {
                    listEmploye.Add(employe.Matricule, employe);
                    //databaseConnection.Insert(employe);
                    DataSource.Add(employe);
                    calculImpot = new CalculImpot(employe);
                    brutFiscalAnnuel.Content     = "Brut Fiscal Annuel : " + calculImpot.GetBrutFiscalAnnuel();
                    abattement.Content           = "Abbattement : " + calculImpot.GetAbattement();
                    brutFiscalAbattement.Content = "Brut Fiscal après Abattement : " + calculImpot.GetBrutFiscalApresAbattement();
                    nbreParts.Content            = "Nombre de parts : " + calculImpot.GetNbreParts();
                    reduction.Content            = "Réduction : " + calculImpot.GetReduction();
                    IRPP.Content    = "IRPP avant réduction : " + calculImpot.GetIRPPAvantReduction();
                    impot.Text      = " " + calculImpot.GetImpot();
                    salaireNet.Text = "Salaire Net : " + calculImpot.GetSalaireNet();
                }
                else
                {
                    MessageBox.Show("Ce matricule existe déjà !");
                }
            }
            else
            {
                MessageBox.Show(reponse);
            }
            //MessageBox.Show("Vous avez clické sur le boutton Valider ! ");
        }