Esempio n. 1
0
        void Afficher_ListeNomenclature(ctrlChoixListe ctrl, ComboBox lstTypeEnveloppe, int Compte_ID)
        {
            ctrl.Initialiser();;

            if (lstTypeEnveloppe.SelectedIndex < 0)
            {
                return;
            }
            if (lstPeriode.SelectedIndex < 0)
            {
                return;
            }

            int      periode   = listePeriode[lstPeriode.SelectedIndex].ID;
            int      enveloppe = listeTypeEnveloppe[lstTypeEnveloppe.SelectedIndex].ID;
            TypeFlux typeflux  = TypeFlux.Dépenses;

            List <Budget_Nomenclature> ListeCompte = Acces.clsOMEGA.Remplir_ListeBudgetNomenclature(enveloppe, periode, typeflux);

            foreach (Budget_Nomenclature tv in ListeCompte)
            {
                if (tv.ID == Compte_ID)
                {
                    ctrl.ListeSelection.Add(new Parametre(tv.ID, tv.Code, tv.Code + " : " + tv.Libelle));
                }
                else
                {
                    ctrl.ListeChoix.Add(new Parametre(tv.ID, tv.Code, tv.Code + " : " + tv.Libelle));
                }
            }
            ctrl.Afficher_Liste();
        }
        public override bool Construire(Element e)
        {
            ID           = e.ID;
            Code         = e.Code;
            Libelle      = e.Libelle.Replace("''", "'");
            Element_Type = e.Element_Type;
            Type_Element = e.Type_Element;
            Actif        = e.Actif;
            Enveloppe    = e.Type_Element;

            foreach (dElement d in e.Liste)
            {
                if (d.Element_ID == ID)
                {
                    if (d.Attribut_Code == "PERIODE")
                    {
                        Periode = int.Parse(d.Valeur);
                    }
                    if (d.Attribut_Code == "TYPE_FLUX")
                    {
                        TypeFlux = (TypeFlux)int.Parse(d.Valeur);
                    }
                }
            }

            return(true);
        }
Esempio n. 3
0
        void Afficher_ListeNomenclature()
        {
            DG_Nomenclature.DataSource = null;

            if (lstTypeEnveloppe.SelectedIndex < 0)
            {
                return;
            }
            if (lstPeriode.SelectedIndex < 0)
            {
                return;
            }
            if (lstTypeFlux.SelectedIndex < 0)
            {
                return;
            }

            int      periode   = listePeriode[lstPeriode.SelectedIndex].ID;
            int      enveloppe = listeTypeEnveloppe[lstTypeEnveloppe.SelectedIndex].ID;
            TypeFlux typeflux  = (TypeFlux)lstTypeFlux.SelectedIndex;

            List <Budget_Nomenclature> Liste = Acces.clsOMEGA.Remplir_ListeBudgetNomenclature(enveloppe, periode, typeflux);

            DG_Nomenclature.DataSource                      = Liste;
            DG_Nomenclature.Columns["id"].Visible           = false;
            DG_Nomenclature.Columns["enveloppe"].Visible    = false;
            DG_Nomenclature.Columns["periode"].Visible      = false;
            DG_Nomenclature.Columns["typeflux"].Visible     = false;
            DG_Nomenclature.Columns["Actif"].Visible        = false;
            DG_Nomenclature.Columns["Element_Type"].Visible = false;
            DG_Nomenclature.Columns["Type_Element"].Visible = false;

            DG_Nomenclature.Columns["code"].AutoSizeMode    = DataGridViewAutoSizeColumnMode.AllCells;
            DG_Nomenclature.Columns["libelle"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
        }
Esempio n. 4
0
        private void treeSelectionEnvFlux_AfterSelect(object sender, TreeViewEventArgs e)
        {
            TreeNode nd = treeSelectionEnvFlux.SelectedNode;

            if (nd.Parent == null)
            {
                return;
            }                                  //Noeud sans parent
            if (nd.Nodes.Count > 0)
            {
                return;
            }                                   //Noeud avec enfant

            foreach (TreeNode ndd in nd.Parent.Nodes)
            {
                ndd.ForeColor = Color.Black;
            }

            nd.ForeColor = (nd.ForeColor == Color.Black? Color.Red : Color.Black);

            if (nd.Parent.Tag.ToString() == "ENVELOPPE")
            {
                Enveloppe_Select = (nd.ForeColor == Color.Black ? -1 : int.Parse(nd.Name));
            }

            if (nd.Parent.Tag.ToString() == "FLUX")
            {
                Flux_Select = (nd.ForeColor == Color.Black ? TypeFlux.Dépenses : (TypeFlux)nd.Tag);
            }

            if (nd.Parent.Tag.ToString() == "MONTANT")
            {
                Montant_Select = (nd.ForeColor == Color.Black ? TypeMontant.CP : (TypeMontant)nd.Tag);
            }

            if (nd.Parent.Tag.ToString() == "ORG")
            {
                budget_org_Select = (nd.ForeColor == Color.Black ? 0: int.Parse(nd.Name));
            }

            if (nd.Parent.Tag.ToString() == "GEO")
            {
                budget_geo_Select = (nd.ForeColor == Color.Black ? 0 : int.Parse(nd.Name));
            }

            Afficher_ListeOperation();
            Afficher_ListeVirement();
        }
Esempio n. 5
0
        public static TypeFlux GetTypeFlux(int idS)
        {
            int    id;
            string libelle;

            TypeFlux typeFlux = new TypeFlux();

            SqlConnection maConnexion = ConnexionBD.GetConnexionBD().GetSqlConnection();

            SqlCommand cmd = new SqlCommand();

            cmd.Connection  = maConnexion;
            cmd.CommandText = "SELECT * FROM type_flux WHERE id = @id";

            cmd.Parameters.Add(new SqlParameter("@id", SqlDbType.Int));
            cmd.Parameters["@id"].Value = idS;

            SqlDataReader monReader = cmd.ExecuteReader();

            while (monReader.Read())
            {
                id = Int32.Parse(monReader["id"].ToString());

                if (monReader["id"] == DBNull.Value)
                {
                    libelle = default(string);
                }
                else
                {
                    libelle = monReader["libelle"].ToString();
                }
                typeFlux = new TypeFlux(id, libelle);
            }
            // Fermeture de la connexion
            maConnexion.Close();

            return(typeFlux);
        }
Esempio n. 6
0
        // Cette méthode permet de recupère l'ensemble des types de flux
        // retourne une liste de flux
        public static List <TypeFlux> GetLesTypeFlux()
        {
            int    id;
            string libelle;

            List <TypeFlux> lesTypeFlux = new List <TypeFlux>();

            SqlConnection maConnexion = ConnexionBD.GetConnexionBD().GetSqlConnection();

            SqlCommand cmd = new SqlCommand();

            cmd.Connection  = maConnexion;
            cmd.CommandText = "SELECT * FROM type_flux";

            SqlDataReader monReader = cmd.ExecuteReader();

            while (monReader.Read())
            {
                id = Int32.Parse(monReader["id"].ToString());

                if (monReader["id"] == DBNull.Value)
                {
                    libelle = default(string);
                }
                else
                {
                    libelle = monReader["libelle"].ToString();
                }
                TypeFlux typeFlux = new TypeFlux(id, libelle);
                lesTypeFlux.Add(typeFlux);
            }
            // Fermeture de la connexion
            maConnexion.Close();

            return(lesTypeFlux);
        }
Esempio n. 7
0
        void Afficher_ListeNomenclature()
        {
            ChoixCompte.Initialiser();;

            if (lstTypeEnveloppe.SelectedIndex < 0)
            {
                return;
            }
            if (lstPeriode.SelectedIndex < 0)
            {
                return;
            }
            if (lstTypeFlux.SelectedIndex < 0)
            {
                return;
            }

            int      periode   = listePeriode[lstPeriode.SelectedIndex].ID;
            int      enveloppe = listeTypeEnveloppe[lstTypeEnveloppe.SelectedIndex].ID;
            TypeFlux typeflux  = (TypeFlux)lstTypeFlux.SelectedIndex;

            List <Budget_Nomenclature> ListeCompte = Acces.clsOMEGA.Remplir_ListeBudgetNomenclature(enveloppe, periode, typeflux);

            foreach (Budget_Nomenclature tv in ListeCompte)
            {
                if (tv.ID == budget_operation.Compte_ID)
                {
                    ChoixCompte.ListeSelection.Add(new Parametre(tv.ID, tv.Code, tv.Code + " : " + tv.Libelle));
                }
                else
                {
                    ChoixCompte.ListeChoix.Add(new Parametre(tv.ID, tv.Code, tv.Code + " : " + tv.Libelle));
                }
            }
            ChoixCompte.Afficher_Liste();
        }
Esempio n. 8
0
        public static List <Flux> GetLesFluxById(int idFlux)
        {
            int      id;
            string   libelle;
            DateTime date;
            Decimal  montant;
            bool     prelevement;
            Adherent adherent;
            Budget   budget;
            TypeFlux typeFlux;

            List <Flux> lesFlux = new List <Flux>();

            SqlConnection maConnexion = ConnexionBD.GetConnexionBD().GetSqlConnection();

            SqlCommand cmd = new SqlCommand();

            cmd.Connection  = maConnexion;
            cmd.CommandText = "SELECT * FROM flux WHERE adherent = @id";

            cmd.Parameters.Add(new SqlParameter("@id", SqlDbType.Int));
            cmd.Parameters["@id"].Value = idFlux;

            SqlDataReader monReader = cmd.ExecuteReader();

            while (monReader.Read())
            {
                id = Int32.Parse(monReader["id"].ToString());

                if (monReader["id"] == DBNull.Value)
                {
                    libelle     = default(string);
                    date        = default(DateTime);
                    montant     = default(Decimal);
                    prelevement = default(bool);
                    adherent    = default(Adherent);
                    budget      = default(Budget);
                    typeFlux    = default(TypeFlux);
                }
                else
                {
                    libelle     = monReader["libelle"].ToString();
                    date        = (DateTime)monReader["date"];
                    montant     = (Decimal)monReader["montant"];
                    prelevement = (bool)monReader["prelevement"];
                    adherent    = new Adherent((int)monReader["adherent"]);
                    budget      = new Budget((int)monReader["budget"]);
                    typeFlux    = new TypeFlux((int)monReader["type_flux"]);
                }
                Flux flux = new Flux(id, libelle, date, montant, prelevement, adherent, budget, typeFlux);
                lesFlux.Add(flux);
            }
            // Fermeture de la connexion
            maConnexion.Close();

            foreach (Flux flux in lesFlux)
            {
                flux.Adherent = AdherentDAO.GetOnceAdherent(flux.Adherent.Id);
                flux.Budget   = BudgetDAO.GetBudget(flux.Budget.Id);
                flux.TypeFlux = TypeFluxDAO.GetTypeFlux(flux.TypeFlux.Id);
            }

            return(lesFlux);
        }
Esempio n. 9
0
        void Importer_Nomenclature()
        {
            if (lstTypeEnveloppe.SelectedIndex < 0)
            {
                return;
            }
            if (lstPeriode.SelectedIndex < 0)
            {
                return;
            }
            if (lstTypeFlux.SelectedIndex < 0)
            {
                return;
            }

            int      periode   = listePeriode[lstPeriode.SelectedIndex].ID;
            int      enveloppe = listeTypeEnveloppe[lstTypeEnveloppe.SelectedIndex].ID;
            TypeFlux typeflux  = (TypeFlux)lstTypeFlux.SelectedIndex;

            string fichier;

            OpenFileDialog f = new OpenFileDialog();

            f.Title = "Choix d'un fichier d'importation";
            if (f.ShowDialog() == DialogResult.OK)
            {
                fichier = f.FileName;
                if (fichier.Length == 0)
                {
                    return;
                }


                //Suppression des éléments existants
                List <Budget_Nomenclature> Liste = Acces.clsOMEGA.Remplir_ListeBudgetNomenclature(enveloppe, periode, typeflux);
                if (Liste.Count > 0)
                {
                    if (MessageBox.Show("Les données vont être remplacées. Continuez ?", "Confirmation", MessageBoxButtons.YesNo) == DialogResult.No)
                    {
                        MessageBox.Show("Procédure arrêtée.");
                        return;
                    }
                    foreach (Budget_Nomenclature bg in Liste)
                    {
                        Acces.Supprimer_Element(Acces.type_BUDGET_NOMENCLATURE, bg);
                    }
                }

                string texte = fct.readFileAsUtf8(fichier);

                int n = 0;
                foreach (string txt in texte.Split((char)Keys.Return))
                {
                    string txt1 = txt.Replace("\n", "");
                    if (txt1.Length > 0)
                    {
                        string code    = txt1.Split(';')[0];
                        string libelle = txt1.Split(';')[1];

                        //Traitement du libellé

                        Budget_Nomenclature nmcl = new Budget_Nomenclature();
                        nmcl.Acces     = Acces;
                        nmcl.Code      = code;
                        nmcl.Libelle   = libelle;
                        nmcl.Enveloppe = enveloppe;
                        nmcl.Periode   = periode;
                        nmcl.TypeFlux  = typeflux;
                        Acces.Ajouter_Element(Acces.type_BUDGET_NOMENCLATURE, nmcl);

                        n++;
                    }
                }
                MessageBox.Show("Importation " + n + " lignes");
                Afficher_ListeNomenclature();
            }
        }
Esempio n. 10
0
        /// <summary>
        /// Renvoie la liste des lignes budgétaires pour un exercice
        /// </summary>
        /// <param name="Enveloppe"></param>
        /// <param name="Periode"></param>
        /// <param name="typeFlux"></param>
        public List <Budget_Nomenclature> Remplir_ListeBudgetNomenclature(int Enveloppe, int Periode, TypeFlux typeflux)
        {
            List <Budget_Nomenclature> listeBudgetNomenclature = (List <Budget_Nomenclature>)Acces.Remplir_ListeElement(Acces.type_BUDGET_NOMENCLATURE, "");

            listeBudgetNomenclature.Sort();

            List <Budget_Nomenclature> lstBudgetNomenclature = new List <Budget_Nomenclature>();

            foreach (Budget_Nomenclature bgl in listeBudgetNomenclature)
            {
                if (bgl.Enveloppe == Enveloppe &&
                    bgl.Periode == Periode &&
                    (int)bgl.TypeFlux == (int)typeflux)
                {
                    lstBudgetNomenclature.Add(bgl);
                }
            }

            return(lstBudgetNomenclature);
        }