示例#1
0
 public bool SupprimerSubSub(SubSub SubSub)
 {
     if (!m_BD.EstConnecte)
     {
         Initialiser();
     }
     SubSub.SupprimerEnCascade(m_BD);
     return(true);
 }
示例#2
0
        private void buttonAttacher_Click(object sender, EventArgs e)
        {
            if ((ficheSubUnity1.SubUnitySelectionne != null) && (ficheSubUnitySlave.SubUnitySelectionne != null))
            {
                SubSub NouveauLien = new SubSub();
                NouveauLien.Master = ficheSubUnity1.SubUnitySelectionne;
                NouveauLien.Slave  = ficheSubUnitySlave.SubUnitySelectionne;

                if (NouveauLien.EstValide && Program.GMBD.AjouterSubSub(NouveauLien))
                {
                    ChargerSubSub(listeDeroulanteFaction1.FactionSelectionnee.Id, listeDeroulanteSousFaction1.SousFactionSelectionnee.Id, listeDeroulanteUnity1.UnitySelectionnee.Id);
                }
            }
        }
示例#3
0
 public IEnumerable <SubSub> EnumererSubSub(MyDB.CodeSql ValeurSouhaitee, MyDB.CodeSql ClauseJoin, MyDB.CodeSql ClauseWhere, MyDB.CodeSql ClauseOrderBy)
 {
     if (ClauseWhere == null)
     {
         ClauseWhere = MyDB.CodeSql.Vide;
     }
     if (ClauseOrderBy == null)
     {
         ClauseOrderBy = MyDB.CodeSql.Vide;
     }
     if (ClauseJoin == null)
     {
         ClauseJoin = MyDB.CodeSql.Vide;
     }
     if (ValeurSouhaitee == null)
     {
         ValeurSouhaitee = new MyDB.CodeSql("*");
     }
     return(SubSub.Enumerer(m_BD, m_BD.Enumerer("SELECT {0} FROM {1} {2} {3} {4}", ValeurSouhaitee, c_NomTable_SubSub, ClauseJoin, ClauseWhere, ClauseOrderBy)));
 }
示例#4
0
 public bool AjouterSubSub(SubSub NouvelleSubSub)
 {
     return(NouvelleSubSub.Enregistrer(m_BD, NouvelleSubSub, NouvelleSubSub.IdDeLaTablePrincipale, false));
 }
示例#5
0
        /// <summary>
        /// Met à jour la listview des SubSubs et y insére les elements
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="Entites"></param>
        /// <returns></returns>
        private bool MettreAJourListe <T>(IEnumerable <T> Entites)
            where T : class, IEntiteMySQL
        {
            bool EstSubSub = typeof(T).Equals(typeof(SubSub));

            if (!EstSubSub)
            {
                return(false);
            }
            listViewSubSub.Items.Clear();
            if (Entites == null)
            {
                return(false);
            }
            if (EstSubSub && (listViewSubSub.Columns.Count != 2))
            {
                listViewSubSub.Columns.Clear();

                listViewSubSub.Columns.Add(new ColumnHeader()
                {
                    Name      = "Master",
                    Text      = "Master",
                    TextAlign = HorizontalAlignment.Center,
                });
                listViewSubSub.Columns.Add(new ColumnHeader()
                {
                    Name      = "Slave",
                    Text      = "Slave",
                    TextAlign = HorizontalAlignment.Center,
                });
            }

            foreach (T Entite in Entites)
            {
                ListViewItem NouvelElement = new ListViewItem()
                {
                    Tag = Entite
                };
                NouvelElement.SubItems.Clear();
                if (EstSubSub)
                {
                    SubSub SubSub = Entite as SubSub;
                    NouvelElement.Text = SubSub.Master.Name;

                    NouvelElement.SubItems.Add(SubSub.Slave.Name);


                    listViewSubSub.Items.Add(NouvelElement);
                }
            }

            listViewSubSub.Visible = false;
            foreach (ColumnHeader Colonne in listViewSubSub.Columns)
            {
                Colonne.AutoResize(ColumnHeaderAutoResizeStyle.HeaderSize);
            }

            listViewSubSub.Visible = true;
            listViewSubSub_SelectedIndexChanged(listViewSubSub, EventArgs.Empty);
            return(true);
        }