Example #1
0
 public static Infrastructure.DB.Tag GetTag(int?TagID)
 {
     using (Infrastructure.DB.DOAMEntities db = new Infrastructure.DB.DOAMEntities())
     {
         return(db.Tags.Find(TagID));
     }
 }
        public static void GetAllDetailsAssets(int AssetId)
        {
            using (Infrastructure.DB.DOAMEntities db = new Infrastructure.DB.DOAMEntities())
            {
                var details = from assetMetaData in db.AssetMetaDatas
                              join metaData in db.MetaDatas
                              on assetMetaData.AssetMetaDataID equals metaData.MetaDataID
                              join metaGroup in db.MetaDataGroups on metaData.MetaDataGroupID equals metaGroup.MetaDataGroupID
                              where assetMetaData.AssetID == AssetId
                              select new { metaGroup.MetaDataGroupID,
                                           metaGroup.GroupName,
                                           metaData.Title,
                                           assetMetaData.Value };
                //            select metg.MetaDataGroupID,metg.GroupName ,met.Title, ast.Name,aty.Value from asset ast inner join AssetMetaData aty on ast.AssetID = aty.AssetID

                //inner join MetaData met on aty.MetaDataID = met.MetaDataID

                //inner join MetaDataGroup metg on met.MetaDataGroupID = metg.MetaDataGroupID

                //where ast.AssetID = 1

                //group by metg.MetaDataGroupID,metg.GroupName, met.Title, ast.Name,aty.Value
                //foreach (var totalcomp in total)
                //{

                //    totalAudio = total.Count();
                //}
                //return totalAudio;
            }
        }
Example #3
0
 public static void UpDateAssetCompteur(int AssetID)
 {
     using (Infrastructure.DB.DOAMEntities db = new Infrastructure.DB.DOAMEntities())
     {
         db.SP_UpDateAssetCompteur(AssetID);
     }
 }
Example #4
0
        /// <summary>
        /// effectuer le sorting des données
        /// </summary>
        /// <param name="sortOrder"></param>
        /// <returns>une liste triés</returns>
        public static List <Infrastructure.DB.Asset> SortOrderAsset(string sortOrder)
        {
            using (Infrastructure.DB.DOAMEntities db = new Infrastructure.DB.DOAMEntities())
            {
                var assets = from s in db.Assets
                             select s;

                switch (sortOrder)
                {
                case "name_desc":
                    assets = assets.OrderByDescending(s => s.Name);
                    break;

                case "Date":
                    assets = assets.OrderBy(s => s.DateEncoded);
                    break;

                case "date_desc":
                    assets = assets.OrderByDescending(s => s.DateEncoded);
                    break;

                default:
                    assets = assets.OrderBy(s => s.Name);
                    break;
                }
                return(assets.ToList());
            }
        }
Example #5
0
 /// <summary>
 /// récuperer le nombre total des asssets
 /// </summary>
 /// <returns></returns>
 public static int GetTotalAssets()
 {
     using (Infrastructure.DB.DOAMEntities db = new Infrastructure.DB.DOAMEntities())
     {
         return(db.Assets.Count());
     }
 }
Example #6
0
 /// <summary>
 /// Get asset by assetID
 /// </summary>
 /// <param name="AssetID"></param>
 /// <returns> asset </returns>
 public static Infrastructure.DB.Asset GetAssetID(int?AssetID)
 {
     using (Infrastructure.DB.DOAMEntities db = new Infrastructure.DB.DOAMEntities())
     {
         return(db.Assets.Find(AssetID));
     }
 }
Example #7
0
 // GET: Tags
 public static List <MyApp.Infrastructure.DB.Tag> GetTags()
 {
     using (Infrastructure.DB.DOAMEntities db = new Infrastructure.DB.DOAMEntities())
     {
         var tags = db.Tags;
         return(db.Tags.ToList());
     }
 }
Example #8
0
 public static Infrastructure.DB.Tag GetTagID(int?TagID)
 {
     using (Infrastructure.DB.DOAMEntities db = new Infrastructure.DB.DOAMEntities())
     {
         var tag = db.Tags.Find(TagID);
         return(tag);
     }
 }
Example #9
0
 /// <summary>
 /// ajouter un asset
 /// </summary>
 /// <param name="asset"></param>
 public static void AddAsset(Infrastructure.DB.Asset asset)
 {
     using (Infrastructure.DB.DOAMEntities db = new Infrastructure.DB.DOAMEntities())
     {
         db.Assets.Add(asset);
         db.SaveChanges();
     }
 }
Example #10
0
 public static List <AssetType> GetAssetTypes()
 {
     using (DOAMEntities db = new Infrastructure.DB.DOAMEntities())
     {
         var assetType = db.AssetTypes;
         return(assetType.ToList());
     }
 }
Example #11
0
 // Assets
 public static List <MyApp.Infrastructure.DB.Asset> GetAssets()
 {
     using (Infrastructure.DB.DOAMEntities db = new Infrastructure.DB.DOAMEntities())
     {
         var assets = db.Assets.Include(a => a.MimeType);
         return(assets.ToList());
     }
 }
Example #12
0
 /// <summary>
 /// mettre à jour l'objet passe en paramétre
 /// </summary>
 /// <param name="asset"></param>
 public static void UpdateAsset(Infrastructure.DB.Asset asset)
 {
     using (Infrastructure.DB.DOAMEntities db = new Infrastructure.DB.DOAMEntities())
     {
         db.Entry(asset).State = System.Data.Entity.EntityState.Modified;
         db.SaveChanges();
     }
 }
Example #13
0
 public static void AddTag(Infrastructure.DB.Tag tag)
 {
     using (Infrastructure.DB.DOAMEntities db = new Infrastructure.DB.DOAMEntities())
     {
         db.Tags.Add(tag);
         db.SaveChanges();
     }
 }
Example #14
0
 /// <summary>
 /// supprimer asset de l'id passe en parametre
 /// </summary>
 /// <param name="AssetID"></param>
 public static void DeleteAsset(int AssetID)
 {
     using (Infrastructure.DB.DOAMEntities db = new Infrastructure.DB.DOAMEntities())
     {
         var asset = db.Assets.Find(AssetID);
         db.Assets.Remove(asset);
         db.SaveChanges();
     }
 }
Example #15
0
 public static void DeleteTag(int TagID)
 {
     using (Infrastructure.DB.DOAMEntities db = new Infrastructure.DB.DOAMEntities())
     {
         var tag = db.Tags.Find(TagID);
         db.Tags.Remove(tag);
         db.SaveChanges();
     }
 }
Example #16
0
 public static List <MyApp.Infrastructure.DB.MimeType> GetMimeTypes()
 {
     using (Infrastructure.DB.DOAMEntities db = new Infrastructure.DB.DOAMEntities())
     {
         IQueryable <MimeType> queryable = db.MimeTypes.Include(m => m.AssetType);
         var mimeTypes = queryable;
         return(mimeTypes.ToList());
     }
 }
Example #17
0
        public static List <Infrastructure.DB.Tag> SearchTagByName(string searchString)
        {
            using (Infrastructure.DB.DOAMEntities db = new Infrastructure.DB.DOAMEntities())
            {
                var tag = from s in db.Tags
                          select s;
                if (!String.IsNullOrEmpty(searchString))
                {
                    tag = tag.Where(s => s.Label.ToUpper().Contains(searchString.ToUpper()));
                }

                return(tag.ToList());
            }
        }
Example #18
0
        /// <summary>
        /// on fait la rechercher d'une chaine passe en paramétre
        /// </summary>
        /// <param name="searchString"></param>
        /// <returns></returns>
        public static List <Infrastructure.DB.Asset> SearchAssetByName(string searchString)
        {
            using (Infrastructure.DB.DOAMEntities db = new Infrastructure.DB.DOAMEntities())
            {
                var assets = from s in db.Assets
                             select s;
                if (!String.IsNullOrEmpty(searchString))
                {
                    assets = assets.Where(s => s.Name.ToUpper().Contains(searchString.ToUpper()));
                }

                return(assets.ToList());
            }
        }
Example #19
0
        public static List <Infrastructure.DB.MimeType> SearchMimeTypeByName(string searchString)
        {
            using (Infrastructure.DB.DOAMEntities db = new Infrastructure.DB.DOAMEntities())
            {
                var mime = from s in db.MimeTypes
                           select s;
                if (!String.IsNullOrEmpty(searchString))
                {
                    mime = mime.Where(s => s.Mime.ToUpper().Contains(searchString.ToUpper()));
                }

                return(mime.ToList());
            }
        }
Example #20
0
        public static List <Infrastructure.DB.MetaData> SearchMetaDataByName(string searchString)
        {
            using (Infrastructure.DB.DOAMEntities db = new Infrastructure.DB.DOAMEntities())
            {
                var metaData = from s in db.MetaDatas
                               select s;
                if (!String.IsNullOrEmpty(searchString))
                {
                    metaData = metaData.Where(s => s.Title.ToUpper().Contains(searchString.ToUpper()));
                }

                return(metaData.ToList());
            }
        }
Example #21
0
        public static List <Infrastructure.DB.AssetMetaData> SearchAssetMetaData(string searchString)
        {
            using (Infrastructure.DB.DOAMEntities db = new Infrastructure.DB.DOAMEntities())
            {
                var asssetMetada = from s in db.AssetMetaDatas
                                   select s;
                if (!String.IsNullOrEmpty(searchString))
                {
                    asssetMetada = asssetMetada.Where(s => s.Value.ToUpper().Contains(searchString.ToUpper()) ||
                                                      s.AssetID.ToString().Contains(searchString));
                }

                return(asssetMetada.ToList());
            }
        }
Example #22
0
        /// <summary>
        /// à partir de l'identifiant d'une asset on calcul le total
        /// </summary>
        /// <param name="AssetTypeID"></param>
        /// <returns> le nombre total </returns>
        public static int GetTotalAssetParTypeId(int AssetTypeID)
        {
            using (Infrastructure.DB.DOAMEntities db = new Infrastructure.DB.DOAMEntities())
            {
                int totalAudio = 0;
                var total      = from asset in db.Assets
                                 join mime in db.MimeTypes
                                 on asset.MimeTypeID equals mime.MimeTypeID
                                 where mime.AssetTypeID == AssetTypeID
                                 select new { mime.AssetTypeID };

                foreach (var totalcomp in total)
                {
                    totalAudio = total.Count();
                }
                return(totalAudio);
            }
        }
Example #23
0
        public static List <Infrastructure.DB.MimeType> SortOrderMimeType(string sortOrder)
        {
            using (Infrastructure.DB.DOAMEntities db = new Infrastructure.DB.DOAMEntities())
            {
                var mime = from s in db.MimeTypes
                           select s;

                switch (sortOrder)
                {
                case "name_desc":
                    mime = mime.OrderByDescending(s => s.Mime);
                    break;

                default:
                    mime = mime.OrderBy(s => s.Mime);
                    break;
                }
                return(mime.ToList());
            }
        }
Example #24
0
        public static List <Infrastructure.DB.AssetMetaData> SortOrderAssetMetaData(string sortOrder)
        {
            using (Infrastructure.DB.DOAMEntities db = new Infrastructure.DB.DOAMEntities())
            {
                var assetMetaData = from s in db.AssetMetaDatas
                                    select s;

                switch (sortOrder)
                {
                case "name_desc":
                    assetMetaData = assetMetaData.OrderByDescending(s => s.Value);
                    break;

                default:
                    assetMetaData = assetMetaData.OrderBy(s => s.AssetID);
                    break;
                }
                return(assetMetaData.ToList());
            }
        }
Example #25
0
        public static List <Infrastructure.DB.Tag> SortOrderAsset(string sortOrder)
        {
            using (Infrastructure.DB.DOAMEntities db = new Infrastructure.DB.DOAMEntities())
            {
                var tag = from s in db.Tags
                          select s;

                switch (sortOrder)
                {
                case "name_desc":
                    tag = tag.OrderByDescending(s => s.Label);
                    break;

                default:
                    tag = tag.OrderBy(s => s.Label);
                    break;
                }
                return(tag.ToList());
            }
        }
Example #26
0
        public static List <Infrastructure.DB.MetaData> SortOrderMetaData(string sortOrder)
        {
            using (Infrastructure.DB.DOAMEntities db = new Infrastructure.DB.DOAMEntities())
            {
                var metaData = from s in db.MetaDatas
                               select s;

                switch (sortOrder)
                {
                case "name_desc":
                    metaData = metaData.OrderByDescending(s => s.Title);
                    break;

                default:
                    metaData = metaData.OrderBy(s => s.Title);
                    break;
                }
                return(metaData.ToList());
            }
        }
Example #27
0
        private static string GetNameAssetParTypeId(int AssetID)
        {
            using (Infrastructure.DB.DOAMEntities db = new Infrastructure.DB.DOAMEntities())
            {
                string typeName = "";
                var    name     = from asset in db.Assets
                                  join mime in db.MimeTypes
                                  on asset.MimeTypeID equals mime.MimeTypeID
                                  join tpye in db.AssetTypes
                                  on mime.AssetTypeID equals tpye.AssetTypeID
                                  where asset.AssetID == AssetID

                                  select new { tpye.TypeLabel };

                foreach (var typeAsset in name)
                {
                    typeName = typeAsset.TypeLabel;
                }
                return(typeName);
            }
        }
Example #28
0
        /// <summary>
        /// on determine le type de l'asset dont l'identifian passe en paramétre
        /// </summary>
        /// <param name="AssetID"></param>
        /// <returns> le nom de type de l'asset </returns>
        public static string GetNameAssetParTypeId(int AssetID)
        {
            using (Infrastructure.DB.DOAMEntities db = new Infrastructure.DB.DOAMEntities())
            {
                string totalAudio = "";
                var    total      = from asset in db.Assets
                                    join mime in db.MimeTypes
                                    on asset.MimeTypeID equals mime.MimeTypeID
                                    join tpye in db.AssetTypes
                                    on mime.AssetTypeID equals tpye.AssetTypeID
                                    where asset.AssetID == AssetID

                                    select new { tpye.TypeLabel };

                foreach (var totalcomp in total)
                {
                    totalAudio = totalcomp.TypeLabel;
                }
                return(totalAudio);
            }
        }
        public static List <ViewModels.TableOfAssetDetailsViewModel> GetAllDetailsAssets(int AssetId)
        {
            List <ViewModels.TableOfAssetDetailsViewModel> AssetListe = new List <ViewModels.TableOfAssetDetailsViewModel>();

            using (Infrastructure.DB.DOAMEntities db = new Infrastructure.DB.DOAMEntities())
            {
                var details = (from asset in db.Assets
                               join assetMetaData in db.AssetMetaDatas
                               on asset.AssetID equals assetMetaData.AssetID
                               join metaData in db.MetaDatas
                               on assetMetaData.MetaDataID equals metaData.MetaDataID
                               join metaGroup in db.MetaDataGroups on metaData.MetaDataGroupID equals metaGroup.MetaDataGroupID
                               where assetMetaData.AssetID == AssetId
                               select new
                {
                    asset.AssetID,
                    asset.Name,
                    metaGroup.MetaDataGroupID,
                    metaGroup.GroupName,
                    metaData.Title,
                    assetMetaData.Value,
                });

                foreach (var totalcomp in details)
                {
                    ViewModels.TableOfAssetDetailsViewModel vm = new ViewModels.TableOfAssetDetailsViewModel()
                    {
                        MetaDataGroupID    = totalcomp.MetaDataGroupID,
                        MetaGroupName      = totalcomp.GroupName,
                        MetaDataTitle      = totalcomp.Title,
                        AssetMetaDataValue = totalcomp.Value,
                        AssetID            = totalcomp.AssetID,
                        Name = totalcomp.Name,
                    };
                    AssetListe.Add(vm);
                }
                ;
                return(AssetListe);
            }
        }