Example #1
0
        public void ajouter()
        {
            using (paieEntities12 db = new paieEntities12())
            {
                rubrique liste = new rubrique()
                {
                    code        = this.code,
                    libellé     = this.Libellé,
                    abrégé      = this.abrégé,
                    imopsalblee = this.imprimable,
                    montant     = this.montant,
                    imopsalble  = this.imopsalble,
                    cotisable   = this.cotisable,
                    compt       = this.compt,
                    sens        = true,
                    Type_val    = Typee,
                };
                if (formule != null)
                {
                    var     query = from it in db.rubriques.OrderByDescending((x => x.id_rubrique)).ToList() select it;
                    int     i     = query.First().id_rubrique;
                    formule lise2 = new formule()
                    {
                        id_rubrique = i + 1,
                        Base        = formule.Base,
                        taux        = formule.taux,
                        nombre      = formule.nombre,
                        montont     = formule.montont,
                        equoiation  = formule.equoiation
                    };
                    db.formules.Add(lise2);
                }
                else if (Double.IsNaN(valeur_ini))
                {
                    var     query = from it in db.rubriques.OrderByDescending((x => x.id_rubrique)).ToList() select it;
                    int     i     = query.First().id_rubrique;
                    formule lise2 = new formule()
                    {
                        id_rubrique = i + 1,
                        montont     = valeur_ini,
                    };
                }
                try
                {
                    db.rubriques.Add(liste);
                    db.SaveChanges();
                    const string message = "la rubrique est bien ajouter avec succès";
                    const string caption = "Message";

                    MessageBox.Show(message, caption,
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Question);
                }

                catch (System.Data.Entity.Validation.DbEntityValidationException e)
                {
                    MessageBox.Show(e.ToString(), "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Example #2
0
        private void Liste_rubrique_Activated(object sender, EventArgs e)
        {
            dataGridView1.Rows.Clear();
            dataGridView1.AllowUserToAddRows = false;
            list_rub.Clear();



            using (paieEntities12 db = new paieEntities12())

            {
                var     query  = from it in db.rubriques select it;
                var     queryy = from it in db.formules select it;
                formule formu  = new formule();
                foreach (rubrique new_rub in query)
                {
                    foreach (var item in queryy)
                    {
                        if (new_rub.id_rubrique == item.id_rubrique)
                        {
                            formu = item;
                        }
                    }



                    list_rub.Add(new Rubriquee()
                    {
                        id_rubrique = new_rub.id_rubrique, code = new_rub.code, Type = new_rub.sens.GetValueOrDefault(), abrégé = new_rub.abrégé, Libellé = new_rub.libellé, imopsalble = new_rub.imopsalble, montant = new_rub.montant.Value, formule = formu, cotisable = new_rub.cotisable.GetValueOrDefault(), imprimable = new_rub.imopsalblee, Typee = new_rub.Type_val
                    });
                }
            }
            DataAjoute(dataGridView1, list_rub);
        }
Example #3
0
        private void Constant_Load(object sender, EventArgs e)
        {
            using (paieEntities12 db = new paieEntities12())
            {
                var querry = from it in db.Constantts select it;
                var query  = from it in db.rubriques select it;
                var query2 = from it in db.formules select it;

                int     row   = dataGridView1.Rows.Add();
                formule formu = new formule();
                foreach (var new_rub in query)
                {
                    foreach (var item in query2)
                    {
                        if (new_rub.id_rubrique == item.id_rubrique)
                        {
                            formu = item;
                        }
                    }
                    list_rub.Add(new Rubriquee()
                    {
                        id_rubrique = new_rub.id_rubrique, code = new_rub.code, Type = new_rub.sens.GetValueOrDefault(), abrégé = new_rub.abrégé, Libellé = new_rub.libellé, imopsalble = new_rub.imopsalble, montant = new_rub.montant.Value, formule = formu, valeur_ini = new_rub.valeur_initia.GetValueOrDefault()
                    });
                }
                foreach (var item in querry)
                {
                    list_con.Add(item);
                    if (item.Code == null)
                    {
                        dataGridView1.Rows[row].Cells[0].Value = "";
                    }
                    else
                    {
                        dataGridView1.Rows[row].Cells[0].Value = item.Code;
                    }
                    if (item.Intitulé == null)
                    {
                        dataGridView1.Rows[row].Cells[1].Value = "";
                    }
                    else
                    {
                        dataGridView1.Rows[row].Cells[1].Value = item.Intitulé;
                    }
                    if (item.Valeur == null)
                    {
                        dataGridView1.Rows[row].Cells[2].Value = "";
                    }
                    else
                    {
                        dataGridView1.Rows[row].Cells[2].Value = item.Valeur.ToString();
                    }
                }
                data_ajout(list_rub, dataGridView1);
            }
        }
Example #4
0
        private void code_wilaya_Load(object sender, EventArgs e)
        {
            label5.Image = resize(im, s);

            comboBox1.Items.Add("janvier");
            comboBox1.Items.Add("février");
            comboBox1.Items.Add("mars");
            comboBox1.Items.Add("mars");
            comboBox1.Items.Add("mai");
            comboBox1.Items.Add("juin");
            comboBox1.Items.Add("juillet");
            comboBox1.Items.Add("aout");
            comboBox1.Items.Add("septembre");
            comboBox1.Items.Add("octobre");
            comboBox1.Items.Add("novembre");
            comboBox1.Items.Add("décembre");
            comboBox1.SelectedItem = ("mai");
            for (int i = 2011; i < 2020; i++)
            {
                comboBox2.Items.Add(i.ToString());
                comboBox3.Items.Add(i.ToString());
            }
            comboBox2.SelectedItem = ("2017");
            comboBox3.SelectedItem = ("2017");
            comboBox4.Items.Add("janvier");
            comboBox4.Items.Add("février");
            comboBox4.Items.Add("mars");
            comboBox4.Items.Add("mars");
            comboBox4.Items.Add("mai");
            comboBox4.Items.Add("juin");
            comboBox4.Items.Add("juillet");
            comboBox4.Items.Add("aout");
            comboBox4.Items.Add("septembre");
            comboBox4.Items.Add("octobre");
            comboBox4.Items.Add("novembre");
            comboBox4.Items.Add("décembre");
            comboBox4.SelectedItem = ("mai");



            using (paieEntities12 db = new paieEntities12())
            {
                var query    = from it in db.rubriques select it;
                var queryy   = from it in db.formules select it;
                var queryyy  = db.Barém_cnas.SingleOrDefault(b => b.id == 2);
                var queryyyy = from it in db.baréme_IRG select it;
                foreach (var item in queryyyy)
                {
                    baréme_irg.Add(item);
                }

                ss = queryyy.Montant.Value;
                formule formu = new formule();
                foreach (rubrique new_rub in query)
                {
                    foreach (var item in queryy)
                    {
                        if (new_rub.id_rubrique == item.id_rubrique)
                        {
                            formu = item;
                        }
                    }



                    list_rub.Add(new Rubriquee()
                    {
                        id_rubrique = new_rub.id_rubrique, code = new_rub.code, Type = new_rub.sens.GetValueOrDefault(), abrégé = new_rub.abrégé, Libellé = new_rub.libellé, imopsalble = new_rub.imopsalble, montant = new_rub.montant.Value, formule = formu, cotisable = new_rub.cotisable.GetValueOrDefault(), imprimable = new_rub.imopsalblee, Typee = new_rub.Type_val, etat = new_rub.etat.GetValueOrDefault()
                    });
                }
            }
        }