Ejemplo n.º 1
0
        void Valider()
        {
            var LibGroupe  = lblLibelleGroupe.Text.Trim();
            var CodeGroupe = lblCodeGroupe.Text.Trim().ToUpper();
            var OptActive  = OptActiveGroupe.Checked;
            var TypeGroupe = (TypeGroupe)lstTypeGroupe.SelectedIndex;


            if (LibGroupe.Length == 0)
            {
                MessageBox.Show("Libellé du groupe obligatoire", "Erreur", MessageBoxButtons.OK);
                return;
            }

            if (CodeGroupe.Length == 0)
            {
                MessageBox.Show("Code du groupe obligatoire", "Erreur", MessageBoxButtons.OK);
                return;
            }

            bool ok = false;

            if (Creation)
            {
                ok = Acces.Existe_Element(Acces.type_GROUPE, "CODE", CodeGroupe);
            }
            else
            {
                //ok = fonc.ExisteCode(Acces.type_INDICATEUR, CodeGroupe, groupe.ID);
            }

            if (ok)
            {
                MessageBox.Show("Pb avec le code", "Erreur", MessageBoxButtons.OK); return;
            }

            groupe.Acces      = Acces;
            groupe.Libelle    = LibGroupe;
            groupe.Code       = CodeGroupe;
            groupe.Actif      = OptActive;
            groupe.TypeGroupe = TypeGroupe;

            if (Creation)
            {
                if (!(Acces.Existe_Element(Acces.type_GROUPE, "CODE", CodeGroupe)))
                {
                    Acces.Enregistrer(Acces.type_GROUPE, groupe);
                }
            }
            else
            {
                Acces.Enregistrer(Acces.type_GROUPE, groupe);
            }

            this.DialogResult = DialogResult.OK;
        }
Ejemplo n.º 2
0
        void Valider()
        {
            var Libelle = lblLibelle.Text.Trim();
            var code    = lblEntete.Text + "-" + lblRef.Text.ToUpper();

            if (lblRef.Text.Length == 0)
            {
                MessageBox.Show("Référence obligatoire", "Erreur", MessageBoxButtons.OK);
                return;
            }

            modele_doc.Acces       = Acces;
            modele_doc.Code        = code;
            modele_doc.Libelle     = Libelle;
            modele_doc.Type_Modele = type_modele;
            modele_doc.Actif       = OptActive.Checked;

            if (modele_doc.Type_Modele == Type_Modele.MODELE)
            {
                if (lstTypeModele.SelectedIndex < 0)
                {
                    MessageBox.Show("Type de modèle ?"); return;
                }
                var p_ID = listeTypeModele[lstTypeModele.SelectedIndex].ID;
                modele_doc.Parent_ID = p_ID;
            }

            if (modele_doc.Type_Modele == Type_Modele.ZONE)
            {
                modele_doc.Condition = lblConditionZone.Text;
            }

            if (modele_doc.Type_Modele == Type_Modele.LIGNE)
            {
                modele_doc.Condition = lblConditionLigne.Text;
            }

            if (modele_doc.Type_Modele == Type_Modele.COLONNE)
            {
                modele_doc.Contenu    = lblTexteColonne.Text;
                modele_doc.Taille     = int.Parse(lblPct.Value.ToString());
                modele_doc.Alignement = (Alignement)lstAlignementColonne.SelectedIndex;
                modele_doc.Bordure    = lblBordureColonne.Text;
            }

            if (Creation)
            {
                if (!(Acces.Existe_Element(Acces.type_MODELEDOC, "CODE", code)))
                {
                    Acces.Ajouter_Element(Acces.type_MODELEDOC, modele_doc);
                }
            }
            else
            {
                Acces.Enregistrer(Acces.type_MODELEDOC, modele_doc);
            }

            this.DialogResult = DialogResult.OK;
        }
Ejemplo n.º 3
0
        void Valider()
        {
            if (lstTypeEnveloppe.SelectedIndex < 0)
            {
                MessageBox.Show("Enveloppe ?"); return;
            }
            if (lstPeriode.SelectedIndex < 0)
            {
                MessageBox.Show("Période ?"); return;
            }

            string LibBudget  = lblLibelleBudget.Text.Trim();
            string Codebudget = lblCodeBudget.Text.Trim().ToUpper();
            int    Enveloppe  = listeTypeEnveloppe[lstTypeEnveloppe.SelectedIndex].ID;
            int    Periode    = listeBudgetPeriode[lstPeriode.SelectedIndex].ID;
            bool   OptActive  = OptActiveBudget.Checked;

            if (LibBudget.Length == 0)
            {
                MessageBox.Show("Libellé du budget obligatoire", "Erreur", MessageBoxButtons.OK);
                return;
            }

            if (Codebudget.Length == 0)
            {
                MessageBox.Show("Code du budget obligatoire", "Erreur", MessageBoxButtons.OK);
                return;
            }

            budget.Acces     = Acces;
            budget.Libelle   = LibBudget;
            budget.Code      = Codebudget;
            budget.Enveloppe = Enveloppe;
            budget.Periode   = Periode;
            budget.DateDeb   = string.Format("{0:yyyyMMdd}", lblDateDebut.Value);
            budget.DateFin   = string.Format("{0:yyyyMMdd}", lblDateFin.Value);
            budget.Actif     = OptActive;

            if (Creation)
            {
                if (!(Acces.Existe_Element(Acces.type_BUDGET, "CODE", Codebudget)))
                {
                    budget.ID = Acces.Ajouter_Element(Acces.type_BUDGET, budget);
                }
                else
                {
                    MessageBox.Show("Code existant"); return;
                }
            }
            else
            {
                Acces.Enregistrer(Acces.type_BUDGET, budget);
            }

            this.DialogResult = DialogResult.OK;
        }
Ejemplo n.º 4
0
        void Valider()
        {
            string LibEnveloppe  = lblLibelle.Text.Trim();
            string CodeEnveloppe = lblCodeGenere.Text;
            bool   OptActive     = this.OptActive.Checked;
            var    TypeEnveloppe = (TypeEnveloppe)lstTypeEnveloppe.SelectedIndex;

            if (LibEnveloppe.Length == 0)
            {
                MessageBox.Show("Libellé de l'enveloppe obligatoire", "Erreur", MessageBoxButtons.OK);
                return;
            }

            if (CodeEnveloppe.Length == 0)
            {
                MessageBox.Show("Code de l'enveloppe obligatoire", "Erreur", MessageBoxButtons.OK);
                return;
            }

            budget_enveloppe.Acces         = Acces;
            budget_enveloppe.Libelle       = LibEnveloppe;
            budget_enveloppe.Code          = CodeEnveloppe;
            budget_enveloppe.TypeEnveloppe = TypeEnveloppe;
            budget_enveloppe.Actif         = OptActive;

            TypeElement Type_Element = Acces.type_BUDGET_ENVELOPPE;

            if (Creation)
            {
                if (!(Acces.Existe_Element(Type_Element, "CODE", CodeEnveloppe)))
                {
                    budget_enveloppe.ID = Acces.Ajouter_Element(Type_Element, budget_enveloppe);
                }
                else
                {
                    MessageBox.Show("Code existant"); return;
                }
            }
            else
            {
                Acces.Enregistrer(Type_Element, budget_enveloppe);

                //Test du changement de code --> Impact sur les liens
                if (lblCodeGenere.Text != lblCodeGenere.Tag.ToString())
                {
                    Lien l = new Lien()
                    {
                        Acces = Acces,
                    };
                    l.MettreAJourCode(Type_Element, budget_enveloppe.ID, budget_enveloppe.Code);
                }
            }

            this.DialogResult = DialogResult.OK;
        }
Ejemplo n.º 5
0
        void Valider()
        {
            string LibBudget   = lblLibelle.Text.Trim();
            string CodeBudget  = lblCodePeriode.Text;
            bool   OptActive   = this.OptActive.Checked;
            var    TypePeriode = (TypePeriode)lstTypePeriode.SelectedIndex;

            if (LibBudget.Length == 0)
            {
                MessageBox.Show("Libellé de la période obligatoire", "Erreur", MessageBoxButtons.OK);
                return;
            }

            if (CodeBudget.Length == 0)
            {
                MessageBox.Show("Code de la période obligatoire", "Erreur", MessageBoxButtons.OK);
                return;
            }

            budget_periode.Acces       = Acces;
            budget_periode.Libelle     = LibBudget;
            budget_periode.Code        = CodeBudget;
            budget_periode.TypePeriode = TypePeriode;
            budget_periode.DateDeb     = string.Format("{0:yyyyMMdd}", lblDateDebut.Value);
            budget_periode.DateFin     = string.Format("{0:yyyyMMdd}", lblDateFin.Value);
            budget_periode.Actif       = OptActive;

            if (Creation)
            {
                if (!(Acces.Existe_Element(Acces.type_BUDGET_PERIODE, "CODE", CodeBudget)))
                {
                    budget_periode.ID = Acces.Ajouter_Element(Acces.type_BUDGET_PERIODE, budget_periode);
                }
                else
                {
                    MessageBox.Show("Code existant"); return;
                }
            }
            else
            {
                Acces.Enregistrer(Acces.type_BUDGET_PERIODE, budget_periode);

                //Test du changement de code --> Impact sur les liens
                if (lblCodePeriode.Text != lblCodePeriode.Tag.ToString())
                {
                    Lien l = new Lien()
                    {
                        Acces = Acces,
                    };
                    l.MettreAJourCode(Acces.type_BUDGET_PERIODE, budget_periode.ID, budget_periode.Code);
                }
            }

            this.DialogResult = DialogResult.OK;
        }
Ejemplo n.º 6
0
        void Modifier_Modele()
        {
            if (treeModele.SelectedNode == null)
            {
                return;
            }
            string Module = treeModele.SelectedNode.Name.Split('-')[0];
            int    ID     = int.Parse(treeModele.SelectedNode.Name.Split('-')[1]);

            ModeleDoc md = (ModeleDoc)Acces.Trouver_Element(Acces.type_MODELEDOC, ID);

            if (Module == "TYPE")
            {
                string Libelle = Microsoft.VisualBasic.Interaction.InputBox("Saisir le libellé du type de modèle",
                                                                            "Création d'un type de modèle", md.Libelle);

                if (Libelle.Length == 0 || md.Libelle == Libelle)
                {
                    return;
                }

                md.Libelle = Libelle;

                Acces.Enregistrer(Acces.type_MODELEDOC, md);
                treeModele.SelectedNode.Text = Libelle;
            }

            if (Module == "MODELE")
            {
                frmModeleDoc f = new frmModeleDoc();
                f.Acces      = Acces;
                f.Creation   = false;
                f.modele_doc = md;
                f.Parent_ID  = md.Parent_ID;
                f.Initialiser();

                if (f.ShowDialog() == DialogResult.OK)
                {
                    treeModele.SelectedNode.Text = f.modele_doc.Libelle;
                }
            }
        }
Ejemplo n.º 7
0
        void Valider()
        {
            var LibIndicateur  = lblLibelleIndicateur.Text.Trim();
            var CodeIndicateur = lblCodeIndicateur.Text.Trim().ToUpper();
            var OptActive      = OptActiveIndicateur.Checked;
            var TypeIndicateur = (TypeIndicateur)lstTypeIndicateur.SelectedIndex;

            if (LibIndicateur.Length == 0)
            {
                MessageBox.Show("Libellé de l'indicateur obligatoire", "Erreur", MessageBoxButtons.OK);
                return;
            }

            if (CodeIndicateur.Length == 0)
            {
                MessageBox.Show("Code de l'indicateur obligatoire", "Erreur", MessageBoxButtons.OK);
                return;
            }

            indicateur.Acces          = Acces;
            indicateur.Libelle        = LibIndicateur;
            indicateur.Code           = CodeIndicateur;
            indicateur.TypeIndicateur = TypeIndicateur;
            indicateur.Actif          = OptActive;

            indicateur.Type = ListeType[lstType_6PO.SelectedIndex].ID;
            try { indicateur.Genre = ListeGenre[lstGenre_6PO.SelectedIndex].ID; } catch { }
            try { indicateur.Categorie = ListeCategorie[lstCateg_6PO.SelectedIndex].ID; } catch { }
            indicateur.Repartition = ListeRepartition[lstRepartition_6PO.SelectedIndex].ID;

            if (Creation)
            {
                if (!(Acces.Existe_Element(Acces.type_INDICATEUR, "CODE", CodeIndicateur)))
                {
                    indicateur.ID = Acces.Ajouter_Element(Acces.type_INDICATEUR, indicateur);
                }
            }
            else
            {
                Acces.Enregistrer(Acces.type_INDICATEUR, indicateur);

                //Test du changement de code --> Impact sur les liens
                if (lblCodeIndicateur.Text != lblCodeIndicateur.Tag.ToString())
                {
                    Lien l = new Lien()
                    {
                        Acces = Acces,
                    };
                    l.MettreAJourCode(Acces.type_INDICATEUR, indicateur.ID, indicateur.Code);
                }
            }

            this.DialogResult = DialogResult.OK;
        }
Ejemplo n.º 8
0
        void Valider()
        {
            var CodeUser    = lblCodeUser.Text.Trim();
            var NomUser     = lblNomUser.Text.Trim().ToUpper();
            var PrenomUser  = lblPrenomUser.Text.Trim().ToUpper();
            var Mail        = lblMailUser.Text.Trim();
            var OptActive   = OptActiveUser.Checked;
            var TypeLicence = (TypeLicence)lstLicenceUser.SelectedIndex;
            var TypeUser    = (TypeUtilisateur)lstTypeUser.SelectedIndex;

            if (CodeUser.Length == 0)
            {
                MessageBox.Show("Code d'utilisateur obligatoire", "Erreur", MessageBoxButtons.OK);
                return;
            }

            if (NomUser.Length == 0 || PrenomUser.Length == 0)
            {
                MessageBox.Show("Nom et prénom obligatoire", "Erreur", MessageBoxButtons.OK);
                return;
            }

            User.Acces           = Acces;
            User.Code            = CodeUser;
            User.Nom             = NomUser;
            User.Prenom          = PrenomUser;
            User.Mail            = Mail;
            User.TypeUtilisateur = TypeUser;
            User.TypeLicence     = TypeLicence;
            User.Actif           = OptActive;
            User.Direction       = Acces.Trouver_TableValeur_ID("DIRECTION_METIER", lstDirection.Text);

            if (Creation)
            {
                if (!(Acces.Existe_Element(Acces.type_UTILISATEUR, "CODE", CodeUser)))
                {
                    Acces.Ajouter_Element(Acces.type_UTILISATEUR, User);
                }
            }
            else
            {
                Acces.Enregistrer(Acces.type_UTILISATEUR, User);
            }

            this.DialogResult = DialogResult.OK;
        }
Ejemplo n.º 9
0
        void Valider()
        {
            var LibProcessus  = lblLibelleProcessus.Text.Trim();
            var CodeProcessus = lblCodeProcessus.Text.Trim().ToUpper();
            var OptActive     = OptActiveProcessus.Checked;
            var TypeProcessus = (TypeProcessus)lstTypeProcessus.SelectedIndex;


            if (LibProcessus.Length == 0)
            {
                MessageBox.Show("Libellé du processus obligatoire", "Erreur", MessageBoxButtons.OK);
                return;
            }

            if (CodeProcessus.Length == 0)
            {
                MessageBox.Show("Code du processus obligatoire", "Erreur", MessageBoxButtons.OK);
                return;
            }

            bool ok = false;

            if (Creation)
            {
                ok = Acces.Existe_Element(Acces.type_PROCESSUS, "CODE", CodeProcessus);
            }
            else
            {
                //ok = fonc.ExisteCode(Acces.type_INDICATEUR, CodeGroupe, groupe.ID);
            }

            if (ok)
            {
                MessageBox.Show("Pb avec le code", "Erreur", MessageBoxButtons.OK); return;
            }

            processus.Acces          = Acces;
            processus.Libelle        = LibProcessus;
            processus.Code           = CodeProcessus;
            processus.Actif          = OptActive;
            processus.Type_Processus = TypeProcessus;
            processus.DonneeEntrante = ChoixDonneeEntrant.ListeSelectionId;
            processus.DonneeSortante = ChoixDonneeSortant.ListeSelectionId;

            TypeElement Type = Acces.type_PROCESSUS;

            if (Creation)
            {
                if (!(Acces.Existe_Element(Type, "CODE", processus.Code)))
                {
                    processus.ID = Acces.Ajouter_Element(Type, processus);

                    if (processusParent != null)
                    {
                        Lien p = new Lien()
                        {
                            Acces = Acces
                        };
                        p.Element0_Type = Acces.type_PLAN.ID; //SYSTEME
                        p.Element0_ID   = 1;                  //SYSTEME
                        p.Element0_Code = "SYSTEME";          //SYSTEME
                        p.Element1_Type = Acces.type_PROCESSUS.ID;
                        p.Element1_ID   = processusParent.ID;
                        p.Element1_Code = ((Process)Acces.Trouver_Element(Acces.type_PROCESSUS, p.Element1_ID)).Code;
                        p.Element2_Type = Acces.type_PROCESSUS.ID;
                        p.Element2_ID   = processus.ID;
                        p.Element2_Code = ((Process)Acces.Trouver_Element(Acces.type_PROCESSUS, p.Element2_ID)).Code;
                        p.ordre         = p.Donner_Ordre() + 1;

                        p.Ajouter();
                        Acces.Ajouter_Lien(p);
                    }
                }
                else
                {
                    MessageBox.Show("Processus existant (Code)", "Erreur"); return;
                }
            }
            else
            {
                Acces.Enregistrer(Type, processus);
            }

            this.DialogResult = DialogResult.OK;
        }
Ejemplo n.º 10
0
        void Valider()
        {
            if (lstPeriode.SelectedIndex < 0)
            {
                MessageBox.Show("Période ?"); return;
            }
            if (lstTypeVirement.SelectedIndex < 0)
            {
                MessageBox.Show("Type de virement ?"); return;
            }

            if (choixListe_Src.ListeSelection.Count == 0)
            {
                MessageBox.Show("Un compte source doit être sélectionné ?"); return;
            }
            if (lstEnveloppe_Src.SelectedIndex < 0)
            {
                MessageBox.Show("Enveloppe de la source ?"); return;
            }
            if (lstORG_Src.SelectedIndex < 0)
            {
                MessageBox.Show("ORG de la source ?"); return;
            }
            if (lstGEO_Src.SelectedIndex < 0)
            {
                MessageBox.Show("GEO de la source ?"); return;
            }

            if (choixListe_Dest.ListeSelection.Count == 0)
            {
                MessageBox.Show("Un compte destination doit être sélectionné ?"); return;
            }
            if (lstEnveloppe_Dest.SelectedIndex < 0)
            {
                MessageBox.Show("Enveloppe de la destination ?"); return;
            }
            if (lstORG_Dest.SelectedIndex < 0)
            {
                MessageBox.Show("ORG de la destination ?"); return;
            }
            if (lstGEO_Dest.SelectedIndex < 0)
            {
                MessageBox.Show("GEO de la destination ?"); return;
            }

            if (lstTypeMontant.SelectedIndex < 0)
            {
                MessageBox.Show("Type de montant ?"); return;
            }

            string LibelleVirement = "VIREMENT";
            string CodeVirement    = "VIR-" + string.Format("{0:yyyyMMddHHmmss}", DateTime.Now);
            int    Periode         = listePeriode[lstPeriode.SelectedIndex].ID;

            TypeMontant TypeMontant = (TypeMontant)lstTypeMontant.SelectedIndex;


            double Montant = double.Parse(lblMontant.Text);

            budget_virement.Acces = Acces;

            budget_virement.Periode   = Periode;
            budget_virement.Type_Flux = TypeFlux;
            budget_virement.Libelle   = LibelleVirement;
            budget_virement.Code      = CodeVirement;

            int Enveloppe_Src = listeTypeEnveloppe[lstEnveloppe_Src.SelectedIndex].ID;
            int ORG_Src       = listeORG[lstORG_Src.SelectedIndex].ID;
            int GEO_Src       = listeGEO[lstGEO_Src.SelectedIndex].ID;
            int Compte_ID_Src = choixListe_Src.ListeSelection[0].ID;

            budget_virement.Enveloppe_Src  = Enveloppe_Src;
            budget_virement.Compte_ID_Src  = Compte_ID_Src;
            budget_virement.Budget_ORG_Src = ORG_Src;
            budget_virement.Budget_GEO_Src = GEO_Src;

            int Enveloppe_Dest = listeTypeEnveloppe[lstEnveloppe_Dest.SelectedIndex].ID;
            int ORG_Dest       = listeORG[lstORG_Dest.SelectedIndex].ID;
            int GEO_Dest       = listeGEO[lstGEO_Dest.SelectedIndex].ID;
            int Compte_ID_Dest = choixListe_Dest.ListeSelection[0].ID;

            budget_virement.Enveloppe_Dest  = Enveloppe_Dest;
            budget_virement.Compte_ID_Dest  = Compte_ID_Dest;
            budget_virement.Budget_ORG_Dest = ORG_Dest;
            budget_virement.Budget_GEO_Dest = GEO_Dest;

            budget_virement.DateDemande  = string.Format("{0:yyyyMMdd}", lblDateDemande.Value);
            budget_virement.DateEffet    = string.Format("{0:yyyyMMdd}", lblDateEffet.Value);
            budget_virement.Type_Montant = TypeMontant;
            budget_virement.Montant      = Montant;
            budget_virement.Commentaire  = lblCommentaire.Text.Trim();

            TypeElement typeElement = Acces.type_BUDGET_VIREMENT;

            if (Creation)
            {
                if (!(Acces.Existe_Element(typeElement, "CODE", CodeVirement)))
                {
                    budget_virement.ID = Acces.Ajouter_Element(typeElement, budget_virement);
                }
                else
                {
                    MessageBox.Show("Code existant"); return;
                }
            }
            else
            {
                Acces.Enregistrer(typeElement, budget_virement);
            }

            this.DialogResult = DialogResult.OK;
        }
Ejemplo n.º 11
0
        void VirementValider()
        {
            if (budget_virement == null)
            {
                return;
            }

            if (budget_virement.Validé)
            {
                MessageBox.Show("Ce virement est déjà validé.");
                return;
            }

            string message = "Etes-vous sûr de vouloir valider ce virement ?" + (char)Keys.Return +
                             "2 opérations vont être créées correspondant aux flux souhaités";

            if (MessageBox.Show(message, "Confirmation", MessageBoxButtons.YesNo) == DialogResult.No)
            {
                return;
            }

            //Création de l'opération en débit
            Budget_Operation bo1 = new Budget_Operation();

            bo1.Acces         = Acces;
            bo1.Type_Flux     = budget_virement.Type_Flux;
            bo1.Code          = "OPE-" + string.Format("{0:yyyyMMddHHmmss}", DateTime.Now) + "D";
            bo1.Libelle       = "OPERATION - VIREMENT - DEBIT";
            bo1.Periode       = budget_virement.Periode;
            bo1.Enveloppe     = budget_virement.Enveloppe_Src;
            bo1.Budget_ORG    = budget_virement.Budget_ORG_Src;
            bo1.Budget_GEO    = budget_virement.Budget_GEO_Src;
            bo1.Compte_ID     = budget_virement.Compte_ID_Src;
            bo1.Type_Montant  = budget_virement.Type_Montant;
            bo1.Virement_ID   = budget_virement.ID;
            bo1.Type_Element  = (int)TypeVirement.Normal;
            bo1.DateOperation = budget_virement.DateEffet;
            bo1.Montant       = -budget_virement.Montant;
            bo1.Actif         = true;
            int id1 = Acces.Ajouter_Element(Acces.type_BUDGET_OPERATION, bo1);

            Console.Ajouter("Création opération id " + id1.ToString());

            //Création de l'opration en crédit
            Budget_Operation bo2 = new Budget_Operation();

            bo2.Acces         = Acces;
            bo2.Type_Flux     = budget_virement.Type_Flux;
            bo2.Code          = "OPE-" + string.Format("{0:yyyyMMddHHmmss}", DateTime.Now) + "C";
            bo2.Libelle       = "OPERATION - VIREMENT - CREDIT";
            bo2.Periode       = budget_virement.Periode;
            bo2.Enveloppe     = budget_virement.Enveloppe_Dest;
            bo2.Budget_ORG    = budget_virement.Budget_ORG_Dest;
            bo2.Budget_GEO    = budget_virement.Budget_GEO_Dest;
            bo2.Compte_ID     = budget_virement.Compte_ID_Dest;
            bo2.Type_Montant  = budget_virement.Type_Montant;
            bo2.Virement_ID   = budget_virement.ID;
            bo2.Type_Element  = (int)TypeVirement.Normal;
            bo2.DateOperation = budget_virement.DateEffet;
            bo2.Montant       = budget_virement.Montant;
            bo2.Actif         = true;
            int id2 = Acces.Ajouter_Element(Acces.type_BUDGET_OPERATION, bo2);

            Console.Ajouter("Création opération id " + id2.ToString());

            //Enregistrement de la validation
            budget_virement.Validé = true;
            Acces.Enregistrer(Acces.type_BUDGET_VIREMENT, budget_virement);
            Console.Ajouter("Virement id " + budget_virement.ID.ToString() + " mis à jour");

            Afficher_ListeVirement();
            Afficher_ListeOperation();
        }
Ejemplo n.º 12
0
        void Valider()
        {
            var LibPlan    = lblLibellePlan.Text.Trim();
            var EntetePlan = lblEntete.Text.Trim().ToUpper();
            var CodePlan   = lblCodePlan.Text;
            var Abrege     = lblCodeAbrégé.Text;
            var OptActive  = OptActivePlan.Checked;
            var TypePlan   = (TypePlan)lstTypePlan.SelectedIndex;
            var Niveau     = (NiveauPlan)lstNiveau.SelectedIndex;
            var DDeb       = lblDateDebut.Value;
            var DFin       = lblDateFin.Value;
            var OptAG      = OptAnalyseGlobale.Checked;
            var OptCom     = OptCommentaires.Checked;
            var OptGouv    = OptGouvernance.Checked;
            var OptPR      = OptPrioriteRegionale.Checked;

            int Pilote = -1;

            try { Pilote = ListePilote[lstPilote.SelectedIndex].ID; } catch { }

            if (LibPlan.Length == 0)
            {
                MessageBox.Show("Libellé du plan d'actions obligatoire", "Erreur", MessageBoxButtons.OK);
                return;
            }

            if (CodePlan.Length == 0)
            {
                MessageBox.Show("Code du plan d'actions obligatoire", "Erreur", MessageBoxButtons.OK);
                return;
            }

            plan.Acces    = Acces;
            plan.Libelle  = LibPlan;
            plan.Code     = CodePlan;
            plan.TypePlan = TypePlan;
            plan.Abrege   = Abrege;
            plan.Actif    = OptActive;

            plan.Pilote               = Acces.Trouver_Utilisateur(Pilote);
            plan.NiveauPlan           = Niveau;
            plan.DateDebut            = DDeb;
            plan.DateFin              = DFin;
            plan.OptAnalyseGlobale    = OptAG;
            plan.OptCommentaires      = OptCom;
            plan.OptGouvernance       = OptGouv;
            plan.OptPrioriteRegionale = OptPR;
            plan.Equipe               = ChoixEquipe.ListeSelectionId;
            plan.GroupeExterne        = lblGroupeExterne.Text.Trim();

            plan._type = lblEntete.Text;
            if (lblRef1.Text.Length > 0)
            {
                plan._ref1 = lblRef1.Text.Trim().ToUpper();
            }
            if (lblRef2.Text.Length > 0)
            {
                plan._ref2 = string.Format("{0:00}", int.Parse(lblRef2.Text));
            }
            if (lblOS.Text.Length > 0)
            {
                plan._os = string.Format("{0:00}", int.Parse(lblOS.Text));
            }
            if (lblOG.Text.Length > 0)
            {
                plan._og = string.Format("{0:00}", int.Parse(lblOG.Text));
            }

            if (Creation)
            {
                if (!(Acces.Existe_Element(Acces.type_PLAN, "CODE", plan.Code)))
                {
                    plan.ID = Acces.Ajouter_Element(Acces.type_PLAN, plan);
                }
                else
                {
                    MessageBox.Show("Plan existant (Code)", "Erreur"); return;
                }
            }
            else
            {
                Acces.Enregistrer(Acces.type_PLAN, plan);
            }

            //Test du changement de code --> Impact sur les liens
            if (lblCodePlan.Text != lblCodePlan.Tag.ToString())
            {
                Lien l = new Lien()
                {
                    Acces = Acces,
                };
                l.MettreAJourCode(Acces.type_PLAN, plan.ID, plan.Code);
            }

            this.DialogResult = DialogResult.OK;
        }
Ejemplo n.º 13
0
        void Valider()
        {
            if (lstBudget.SelectedIndex < 0)
            {
                MessageBox.Show("Budget ?"); return;
            }
            if (lstORG.SelectedIndex < 0)
            {
                MessageBox.Show("ORG ?"); return;
            }
            if (lstGEO.SelectedIndex < 0)
            {
                MessageBox.Show("GEO ?"); return;
            }
            //if (lstPeriode.SelectedIndex < 0) { MessageBox.Show("Période ?"); return; }

            Budget budget = listeBudget[lstBudget.SelectedIndex];

            int    budget_id    = budget.ID;
            string LibBudget    = lblLibelleBudget.Text.Trim();
            string Codebudget   = lblCodeGenere.Text.Trim().ToUpper();
            int    Enveloppe    = budget.Enveloppe;
            int    Periode      = budget.Periode;
            string DateDeb      = budget.DateDeb;
            string DateFin      = budget.DateFin;
            bool   OptActive    = OptActiveBudget.Checked;
            bool   OptLimitatif = optLimitatif.Checked;
            var    TypeMontant  = (TypeMontant)lstTypeMontant.SelectedIndex;
            var    TypeFlux     = (TypeFlux)lstTypeFlux.SelectedIndex;
            int    ORG          = listeORG[lstORG.SelectedIndex].ID;
            int    GEO          = listeGEO[lstGEO.SelectedIndex].ID;

            if (LibBudget.Length == 0)
            {
                MessageBox.Show("Libellé du budget obligatoire", "Erreur", MessageBoxButtons.OK);
                return;
            }

            if (Codebudget.Length == 0)
            {
                MessageBox.Show("Code du budget obligatoire", "Erreur", MessageBoxButtons.OK);
                return;
            }

            budget_ligne.Console     = Console;
            budget_ligne.Acces       = Acces;
            budget_ligne.Budget_ID   = listeBudget[lstBudget.SelectedIndex].ID;
            budget_ligne.Libelle     = LibBudget;
            budget_ligne.Code        = Codebudget;
            budget_ligne.Enveloppe   = Enveloppe;
            budget_ligne.Periode     = Periode;
            budget_ligne.DateDeb     = string.Format("{0:yyyyMMdd}", lblDateDebut.Value);
            budget_ligne.DateFin     = string.Format("{0:yyyyMMdd}", lblDateFin.Value);
            budget_ligne.Actif       = OptActive;
            budget_ligne.Budget_ORG  = ORG;
            budget_ligne.Budget_GEO  = GEO;
            budget_ligne.TypeMontant = TypeMontant;
            budget_ligne.TypeFlux    = TypeFlux;

            List <int> ListeChoix = new List <int>();

            foreach (int i in ChoixCompte.ListeSelectionId)
            {
                ListeChoix.Add(i);
            }
            budget_ligne.ListeCompte = ListeChoix;

            TypeElement typeElement = Acces.type_BUDGET_LIGNE;

            if (Creation)
            {
                if (!(Acces.Existe_Element(typeElement, "CODE", Codebudget)))
                {
                    budget_ligne.ID = Acces.Ajouter_Element(typeElement, budget_ligne);
                }
                else
                {
                    MessageBox.Show("Code existant"); return;
                }
            }
            else
            {
                Acces.Enregistrer(typeElement, budget_ligne);

                //Test du changement de code --> Impact sur les liens
                if (lblCodeGenere.Text != lblCodeGenere.Tag.ToString())
                {
                    Lien l = new Lien()
                    {
                        Acces = Acces,
                    };
                    l.MettreAJourCode(typeElement, budget_ligne.ID, budget_ligne.Code);
                }
            }

            this.DialogResult = DialogResult.OK;
        }
Ejemplo n.º 14
0
        void Valider()
        {
            var LibObjectif  = lblLibelleObjectif.Text.Trim();
            var CodeObjectif = lblCodeObjectif.Text.Trim().ToUpper();
            var OptActive    = OptActiveObjectif.Checked;
            var TypeObjectif = (TypeObjectif)lstTypeObjectif.SelectedIndex;

            string Statut    = lstStatut.Text;
            int    Statut_ID = Acces.Trouver_TableValeur_ID("STATUT", Statut);

            var Meteo = (Meteo)lstMeteo.SelectedIndex;
            var Tx    = (TxAvancement)lstTx.SelectedIndex;

            int Pilote = -1;

            try { Pilote = ListePilote[lstPilote.SelectedIndex].ID; } catch { }
            var DDeb = lblDateDebut.Value;
            var DFin = lblDateFin.Value;

            var Description = lblDescription.Text;
            var Analyse     = lblAnalyseQualitative.Text;

            if (LibObjectif.Length == 0)
            {
                MessageBox.Show("Libellé de l'objectif obligatoire", "Erreur", MessageBoxButtons.OK);
                return;
            }

            if (CodeObjectif.Length == 0)
            {
                MessageBox.Show("Code du plan d'actions obligatoire", "Erreur", MessageBoxButtons.OK);
                return;
            }

            //Vérifie si un utiilisateur n'a pas plusieurs profils
            List <int> ListeChoix = new List <int>();

            foreach (int i in ChoixRole6PO_Copilote.ListeSelectionId)
            {
                ListeChoix.Add(i);
            }
            foreach (int i in ChoixRole6PO_Manager.ListeSelectionId)
            {
                ListeChoix.Add(i);
            }
            foreach (int i in ChoixRole6PO_Consultation.ListeSelectionId)
            {
                ListeChoix.Add(i);
            }

            List <int> distinct = ListeChoix.Distinct().ToList();

            if (ListeChoix.Count() != distinct.Count())
            {
                MessageBox.Show("Un utilisateur ne peut pas posséder 2 rôles dans 6PO pour cet objectif.", "Erreur");
                return;
            }

            objectif.Libelle      = LibObjectif;
            objectif.Code         = CodeObjectif;
            objectif.TypeObjectif = TypeObjectif;
            objectif.Actif        = OptActive;

            objectif.Pilote       = Acces.Trouver_Utilisateur(Pilote);
            objectif.Statut       = Statut_ID;
            objectif.Meteo        = Meteo;
            objectif.TxAvancement = Tx;
            objectif.DateDebut    = DDeb;
            objectif.DateFin      = DFin;

            objectif.Description        = Description;
            objectif.AnalyseQualitative = Analyse;

            objectif.Role_6PO_CoPilote     = ChoixRole6PO_Copilote.ListeSelectionId;
            objectif.Role_6PO_Manager      = ChoixRole6PO_Manager.ListeSelectionId;
            objectif.Role_6PO_Consultation = ChoixRole6PO_Consultation.ListeSelectionId;

            objectif._codeplan = lblPlan.Text;
            if (lblAxe.Text.Length > 0)
            {
                objectif._axe = string.Format("{0:00}", int.Parse(lblAxe.Text));
            }
            if (lblOS.Text.Length > 0)
            {
                objectif._os = string.Format("{0:00}", int.Parse(lblOS.Text));
            }
            if (lblOG.Text.Length > 0)
            {
                objectif._og = string.Format("{0:00}", int.Parse(lblOG.Text));
            }
            if (lblOP.Text.Length > 0)
            {
                objectif._op = string.Format("{0:00}", int.Parse(lblOP.Text));
            }
            objectif._cpl = lblAutre.Text;

            if (Creation)
            {
                if (!(Acces.Existe_Element(Acces.type_OBJECTIF, "CODE", CodeObjectif)))
                {
                    objectif.ID = Acces.Ajouter_Element(Acces.type_OBJECTIF, objectif);

                    //Création du lien avec le parent
                    if (!(objectifParent is null))
                    {
                        Lien l = new Lien()
                        {
                            Acces = Acces,
                        };

                        l.element0_type = Acces.type_PLAN.id;
                        l.element0_id   = 1;
                        l.element0_code = "SYSTEME";
                        l.element1_type = Acces.type_OBJECTIF.id;
                        l.element1_id   = objectifParent.ID;
                        l.element1_code = objectifParent.Code;
                        l.element2_type = Acces.type_OBJECTIF.id;
                        l.element2_id   = objectif.ID;
                        l.element2_code = objectif.Code;
                        l.Ajouter();
                        Acces.Ajouter_Lien(l);
                        Creation = false;
                    }
                }
                else
                {
                    MessageBox.Show("L'objectif existe déjà (code identique).", "Erreur"); return;
                }
            }
            else
            {
                Acces.Enregistrer(Acces.type_OBJECTIF, objectif);
            }

            //Test du changement de code --> Impact sur les liens
            if (lblCodeObjectif.Text != lblCodeObjectif.Tag.ToString())
            {
                Lien l = new Lien();
                l.Acces = Acces;
                l.MettreAJourCode(Acces.type_OBJECTIF, objectif.ID, objectif.Code);
            }

            OnRaise_Evt_Enregistrer(new evt_Enregistrer(this.Tag.ToString()));
            Creation            = false;
            lblEnregistrer.Text = "Enregistré " + string.Format("{0:dd/MM/yyyy HH:mm:ss}", DateTime.Now);
        }
Ejemplo n.º 15
0
        void Valider()
        {
            if (action == null)
            {
                MessageBox.Show("Action ?"); return;
            }
            if (lstTypeProjet.SelectedIndex < 0)
            {
                MessageBox.Show("Type de projet ?"); return;
            }
            if (lstPilote.SelectedIndex < 0)
            {
                MessageBox.Show("Pilote du projet ?"); return;
            }
            if (lstStatut.SelectedIndex < 0)
            {
                MessageBox.Show("Statut du projet ?"); return;
            }

            var LibProjet    = lblLibelleProjet.Text.Trim();
            var EnteteProjet = lblEntete.Text.Trim().ToUpper();
            var CodeProjet   = lblCodeProjet.Text;
            var OptActive    = OptActiveProjet.Checked;
            var TypeProjet   = ListeTypeProjet[lstTypeProjet.SelectedIndex].ID;
            var Statut       = ListeStatut[lstStatut.SelectedIndex].ID;

            int Pilote = -1;

            try { Pilote = ListePilote[lstPilote.SelectedIndex].ID; } catch { }

            if (CodeProjet.Length == 0)
            {
                MessageBox.Show("Code du projet obligatoire", "Erreur", MessageBoxButtons.OK);
                return;
            }

            projet.Acces           = Acces;
            projet.Libelle         = LibProjet;
            projet.Code            = CodeProjet;
            projet.TypeProjet      = TypeProjet;
            projet.Statut          = Statut;
            projet.Actif           = OptActive;
            projet.EnveloppeBudget = ChoixEnveloppe.ListeSelectionId;

            projet.Pilote = Acces.Trouver_Utilisateur(Pilote);

            TypeElement type = Acces.type_PROJET;

            if (Creation)
            {
                if (!(Acces.Existe_Element(type, "CODE", projet.Code)))
                {
                    projet.ID = Acces.Ajouter_Element(type, projet);

                    //Création du lien
                    if (action != null)
                    {
                        //Création du lien avec le parent
                        Lien l = new Lien()
                        {
                            Acces = Acces,
                        };
                        l.Element0_Type = Acces.type_PLAN.ID;
                        l.Element0_ID   = 1;
                        l.Element0_Code = "SYSTEME";
                        l.Element1_Type = Acces.type_ACTION.ID;
                        l.Element1_ID   = action.ID;
                        l.Element1_Code = action.Code;
                        l.Element2_Type = Acces.type_PROJET.ID;
                        l.Element2_ID   = projet.ID;
                        l.Element2_Code = projet.Code;
                        l.Ajouter();
                        Acces.Ajouter_Lien(l);
                        Creation = false;
                    }

                    Acces.Enregistrer(Acces.type_ACTION, action);
                }
                else
                {
                    MessageBox.Show("Projet existant (Code)", "Erreur"); return;
                }
            }
            else
            {
                Acces.Enregistrer(type, projet);
            }

            //Test du changement de code --> Impact sur les liens

            /*if (lblCodePlan.Text != lblCodePlan.Tag.ToString())
             * {
             *  Lien l = new Lien() { Acces = Acces, };
             *  l.MettreAJourCode(Acces.type_PLAN, plan.ID, plan.Code);
             * }*/

            this.DialogResult = DialogResult.OK;
        }
Ejemplo n.º 16
0
        void Valider()
        {
            if (lstTypeEnveloppe.SelectedIndex < 0)
            {
                MessageBox.Show("Enveloppe ?"); return;
            }
            if (lstPeriode.SelectedIndex < 0)
            {
                MessageBox.Show("Période ?"); return;
            }
            if (lstTypeFlux.SelectedIndex < 0)
            {
                MessageBox.Show("Flux ?"); return;
            }
            if (ChoixCompte.ListeSelection.Count == 0)
            {
                MessageBox.Show("Un compte doit être sélectionné  ?"); return;
            }
            if (ChoixCompte.ListeSelection.Count > 1)
            {
                MessageBox.Show("Un seul compte doit être sélectionné  ?"); return;
            }
            if (lstORG.SelectedIndex < 0)
            {
                MessageBox.Show("ORG ?"); return;
            }
            if (lstGEO.SelectedIndex < 0)
            {
                MessageBox.Show("GEO ?"); return;
            }
            if (lstTypeMontant.SelectedIndex < 0)
            {
                MessageBox.Show("Type de montant ?"); return;
            }
            if (lstTypeOperation.SelectedIndex < 0)
            {
                MessageBox.Show("Type d'opération ?"); return;
            }

            string LibelleOpe = "OPERATION";
            string CodeOpe    = "OPE-" + string.Format("{0:yyyyMMddHHmmss}", DateTime.Now);
            int    Enveloppe  = listeTypeEnveloppe[lstTypeEnveloppe.SelectedIndex].ID;
            int    Periode    = listePeriode[lstPeriode.SelectedIndex].ID;
            var    TypeFlux   = (TypeFlux)lstTypeFlux.SelectedIndex;

            int Compte_ID = ChoixCompte.ListeSelection[0].ID;

            TypeMontant TypeMontant = (TypeMontant)lstTypeMontant.SelectedIndex;
            int         ORG         = listeORG[lstORG.SelectedIndex].ID;
            int         GEO         = listeGEO[lstGEO.SelectedIndex].ID;

            double Montant = double.Parse(lblMontant.Text);

            budget_operation.Acces = Acces;

            budget_operation.Libelle = LibelleOpe;
            budget_operation.Code    = CodeOpe;

            budget_operation.Enveloppe = Enveloppe;
            budget_operation.Periode   = Periode;
            budget_operation.Type_Flux = TypeFlux;

            budget_operation.Compte_ID  = Compte_ID;
            budget_operation.Budget_ORG = ORG;
            budget_operation.Budget_GEO = GEO;

            budget_operation.DateOperation  = string.Format("{0:yyyyMMdd}", lblDateOpe.Value);
            budget_operation.Type_Operation = listeTypeOperation[lstTypeOperation.SelectedIndex].ID;
            budget_operation.Type_Montant   = TypeMontant;
            budget_operation.Montant        = Montant;
            budget_operation.Commentaire    = lblCommentaire.Text.Trim();

            TypeElement typeElement = Acces.type_BUDGET_OPERATION;

            if (Creation)
            {
                if (!(Acces.Existe_Element(typeElement, "CODE", CodeOpe)))
                {
                    budget_operation.ID = Acces.Ajouter_Element(typeElement, budget_operation);

                    if (TypeMontant == TypeMontant.AE)
                    {
                        if (MessageBox.Show("Créer une opération en CP correspondante ?", "Confirmation", MessageBoxButtons.YesNo) == DialogResult.Yes)
                        {
                            string mt = Microsoft.VisualBasic.Interaction.InputBox("Saisir le montant des CP", "Montant des CP", string.Format("{0:# ### ###.00}", budget_operation.Montant));
                            if (mt.Length > 0)
                            {
                                budget_operation.ID           = 0;
                                budget_operation.Type_Montant = TypeMontant.CP;
                                budget_operation.Montant      = double.Parse(mt);
                                budget_operation.ID           = Acces.Ajouter_Element(typeElement, budget_operation);
                            }
                        }
                    }
                }
                else
                {
                    MessageBox.Show("Code existant"); return;
                }
            }
            else
            {
                Acces.Enregistrer(typeElement, budget_operation);
            }

            this.DialogResult = DialogResult.OK;
        }
Ejemplo n.º 17
0
        void Valider()
        {
            string LibVersion  = lblLibelleVersion.Text;//= lblLibelle.Text.Trim();
            string CodeVersion = lblCodeGenere.Text;
            var    TypeBudget  = (TypeBudget)lstTypeBudget.SelectedIndex;

            if (LibVersion.Length == 0)
            {
                MessageBox.Show("Libellé de la version obligatoire", "Erreur", MessageBoxButtons.OK);
                return;
            }

            if (lstTypeBudget.SelectedIndex < 0)
            {
                MessageBox.Show("Type de budget obligatoire", "Erreur", MessageBoxButtons.OK);
                return;
            }

            if (lstBudget.SelectedIndex < 0)
            {
                MessageBox.Show("Budget obligatoire", "Erreur", MessageBoxButtons.OK);
                return;
            }

            if (lblRef2.Text.Length == 0)
            {
                MessageBox.Show("Référence de la version obligatoire", "Erreur", MessageBoxButtons.OK);
                return;
            }

            Budget budget = listeBudget[lstBudget.SelectedIndex];

            budget_version.Acces      = Acces;
            budget_version.Libelle    = LibVersion;
            budget_version.Code       = CodeVersion;
            budget_version.TypeBudget = (int)TypeBudget;

            budget_version.Budget_ID       = listeBudget[lstBudget.SelectedIndex].ID;
            budget_version.DateDeb         = string.Format("{0:yyyyMMdd}", lblDateDebut.Value);
            budget_version.DateFin         = string.Format("{0:yyyyMMdd}", lblDateFin.Value);
            budget_version.Enveloppe       = budget.Enveloppe;
            budget_version.Periode         = budget.Periode;
            budget_version.DateDeb         = fct.ConvertiDateToString(lblDateDebut.Value);
            budget_version.DateFin         = fct.ConvertiDateToString(lblDateFin.Value);
            budget_version.Actif           = OptActive.Checked;
            budget_version.VersionTravail  = optVersionTravail.Checked;
            budget_version.ReferenceBudget = optReference.Checked;

            TypeElement typeElement = Acces.type_BUDGET_VERSION;

            if (Creation)
            {
                if (!(Acces.Existe_Element(typeElement, "CODE", CodeVersion)))
                {
                    budget_version.ID = Acces.Ajouter_Element(typeElement, budget_version);
                }
                else
                {
                    MessageBox.Show("Code existant"); return;
                }
            }
            else
            {
                Acces.Enregistrer(typeElement, budget_version);

                //Test du changement de code --> Impact sur les liens
                if (lblCodeGenere.Text != lblCodeGenere.Tag.ToString())
                {
                    Lien l = new Lien()
                    {
                        Acces = Acces,
                    };
                    l.MettreAJourCode(typeElement, budget_version.ID, budget_version.Code);
                }
            }

            this.DialogResult = DialogResult.OK;
        }