Exemplo n.º 1
0
        //---------------------------------------------------------------------
        private void FillArray(ref string[] pCols, ref string[] pValues, Catégorie pCatégorie, bool pIsInsertID)
        {
            int liCpt = 0;


            int liNombre = 2 + 0;


            if (pIsInsertID)
            {
                pCols            = new string[liNombre + 1];
                pValues          = new string[liNombre + 1];
                pCols[liCpt]     = "ID";
                pValues[liCpt++] = "'" + pCatégorie.ID.ToString() + "'";
            }
            else
            {
                pCols   = new string[liNombre];
                pValues = new string[liNombre];
            }

            pCols[liCpt] = "Numéro";

            pValues[liCpt++] = "'" + Util.DoubleQuote(pCatégorie.Numéro) + "'";

            pCols[liCpt] = "Description";

            pValues[liCpt++] = "'" + Util.DoubleQuote(pCatégorie.Description) + "'";
        }
Exemplo n.º 2
0
        public static CatégorieDeCatalogue SansDate(Catégorie catégorie)
        {
            CatégorieDeCatalogue catégorieDeCatalogue = new CatégorieDeCatalogue(catégorie.Id);

            Catégorie.CopieData(catégorie, catégorieDeCatalogue);
            return(catégorieDeCatalogue);
        }
Exemplo n.º 3
0
        //--------------------------------------------------------------------

        public int Insert(Catégorie pCatégorie)
        {
            string[] lsCols   = null;
            string[] lsValues = null;
            this.FillArray(ref lsCols, ref lsValues, pCatégorie, true);
            return(DataBase.Insert("[tblCatégorie]", lsCols, lsValues));
        }
Exemplo n.º 4
0
        //---------------------------------------------------------------------
        public int Update(Catégorie pCatégorie)
        {
            string[] lsCols   = null;
            string[] lsValues = null;

            this.FillArray(ref lsCols, ref lsValues, pCatégorie, false);
            return(DataBase.UpdateID("tblCatégorie", lsCols, lsValues, pCatégorie.ID));
        }
Exemplo n.º 5
0
        /// <summary>
        /// Retrouve l'état d'une catégorie à une date passée.
        /// </summary>
        /// <param name="archives">archives d'une catégorie</param>
        /// <param name="date">date d'une fin de modification de catalogue passée</param>
        /// <returns></returns>
        public static CatégorieDeCatalogue ALaDate(IEnumerable <ArchiveCatégorie> archives, DateTime date)
        {
            ArchiveCatégorie[]   archivesAvantDate    = archives.Where(a => a.Date < date).OrderBy(a => a.Date).ToArray();
            CatégorieDeCatalogue catégorieDeCatalogue = new CatégorieDeCatalogue(archivesAvantDate.First().Id)
            {
                Date = date
            };

            foreach (ArchiveCatégorie archive in archivesAvantDate)
            {
                Catégorie.CopieDataSiPasNull(archive, catégorieDeCatalogue);
            }
            return(catégorieDeCatalogue);
        }
Exemplo n.º 6
0
        //--------------------------------------------------------------------
        private Catégorie FillFields(DataRow pDataRow)
        {
            Catégorie lCatégorie = new Catégorie();


            lCatégorie.Numéro = (string)pDataRow["Numéro"];

            lCatégorie.Description = (string)pDataRow["Description"];


            lCatégorie.ID = new Guid(pDataRow["ID"].ToString());



            return(lCatégorie);
        }
Exemplo n.º 7
0
        //--------------------------------------------------------------------
        public Catégorie Find(Guid ID)
        {
            Catégorie lCatégorie = (Catégorie)AbstractFind(ID);

            if (Util.isNULL(lCatégorie))
            {
                DataRow row = DataBase.SelectID(ID, "[tblCatégorie]");
                if (Util.isNULL(row))
                {
                    return(null);
                }
                lCatégorie = this.FillFields(row);
                LoadedMap.Add(lCatégorie.ID, lCatégorie);
            }
            return(lCatégorie);
        }
Exemplo n.º 8
0
        //----------------------------------------------------------------------------------------
        public int Delete(Catégorie pCatégorie)
        {
            int liErreur = int.MinValue;
            int liTemp;
            int liI = 0;

            liTemp = DataBase.DeleteID(pCatégorie.ID, "[tblCatégorie]");
            if (liTemp == liErreur)
            {
                liI = liErreur;
            }
            if (liI != liErreur)
            {
                liI += liTemp;
            }

            return(liI);
        }
Exemplo n.º 9
0
 void ICategorieService.UpdateCategory(Catégorie category)
 {
     utOfWork.CategorieRepository.Update(category);
 }
Exemplo n.º 10
0
 void ICategorieService.UpdateCategoryDetached(Catégorie c)
 {
     utOfWork.CategorieRepository.UpdateCatégorieDetached(c);
 }
Exemplo n.º 11
0
 void ICategorieService.CreateCategory(Catégorie category)
 {
     utOfWork.CategorieRepository.Add(category);
 }