Пример #1
0
        public void Delete(int key)
        {
            Media_Artists item = _items.Find(delegate(Media_Artists d) { return(d.ArtistId == key); });

            if (item != null)
            {
                _items.Remove(item);
            }
        }
Пример #2
0
 public Media_Artists GetDetails(int idx)
 {
     using (MediaEntities dbContext = new MediaEntities())
     {
         dbContext.CommandTimeout = Settings.CommandTimeout;
         Media_Artists artists_obj = dbContext.Media_Artists.Where(x => x.ArtistId == idx).FirstOrDefault();
         return(artists_obj);
     }
 }
Пример #3
0
 public int UpdateSortKey(string UserId, int ArtistId, int ListOrder)
 {
     using (MediaEntities dbContext = new MediaEntities())
     {
         dbContext.CommandTimeout = Settings.CommandTimeout;
         Media_Artists artists_obj = dbContext.Media_Artists.Single(x => x.ArtistId == ArtistId);
         artists_obj.IPLastUpdate         = IP;
         artists_obj.LastModifiedByUserId = new Guid(UserId);
         artists_obj.LastModifiedDate     = System.DateTime.Now;
         artists_obj.ListOrder            = ListOrder;
         int i = dbContext.SaveChanges();
         return(i);
     }
 }
Пример #4
0
        private void LoadData()
        {
            MediaArtists  artist_obj = new MediaArtists();
            Media_Artists entity     = artist_obj.GetDetails(_idx);

            string FrontImage = entity.FrontImage;
            string MainImage  = entity.MainImage;

            imgPhoto.ImageUrl       = upload_front_image_dir + "/" + FrontImage;
            ViewState["FrontImage"] = FrontImage;
            ViewState["MainImage"]  = MainImage;

            txtArtistName.Text  = entity.ArtistName;
            txtDescription.Text = entity.Description;
            string Status = entity.Status;

            PopulateStatus2DDL(Status);
        }
Пример #5
0
 public int Update(int ArtistId, string UserId, string ArtistName, string FrontImage, string MainImage, string Description, string Status)
 {
     using (MediaEntities dbContext = new MediaEntities())
     {
         string Alias = StringUtils.GenerateFriendlyString(ArtistName);
         dbContext.CommandTimeout = Settings.CommandTimeout;
         Media_Artists artists_obj = dbContext.Media_Artists.Single(x => x.ArtistId == ArtistId);
         artists_obj.ArtistName           = ArtistName;
         artists_obj.Alias                = Alias;
         artists_obj.FrontImage           = FrontImage;
         artists_obj.MainImage            = MainImage;
         artists_obj.Description          = Description;
         artists_obj.IPLastUpdate         = IP;
         artists_obj.LastModifiedDate     = System.DateTime.Now;
         artists_obj.LastModifiedByUserId = new Guid(UserId);
         artists_obj.Status               = Status;
         int i = dbContext.SaveChanges();
         return(i);
     }
 }
Пример #6
0
        public List <Media_Artists> LoadDatedItemsByPage(int startRow, int pageSize, string sortBy, bool sortAscending)
        {
            using (MediaEntities dbContext = new MediaEntities())
            {
                //List<Media_Artists> list = (from p in dbContext.Media_Artists select p).Skip(startRow * pageSize).Take(pageSize).ToList();

                SortData(sortBy, sortAscending);
                //copy to an array
                int count = pageSize;
                _items = LoadAll();
                if ((_items.Count - startRow) < count)
                {
                    count = _items.Count - startRow;
                }
                Media_Artists[] pagearray = new Media_Artists[count];

                _items.CopyTo(startRow, pagearray, 0, count);
                //then create a list from array
                List <Media_Artists> page = new List <Media_Artists>(pagearray);
                return(page);
            }
        }
Пример #7
0
        //INSERT- UPDATE - DELETE
        public int Insert(string UserId, string ArtistName, string FrontImage, string MainImage, string Description, string Status)
        {
            using (MediaEntities dbContext = new MediaEntities())
            {
                string Alias = StringUtils.GenerateFriendlyString(ArtistName);
                dbContext.CommandTimeout = Settings.CommandTimeout;
                System.Nullable <Int32> ListOrder = (from u in dbContext.Media_Artists select u.ListOrder).DefaultIfEmpty(0).Max() + 1;

                Media_Artists artists_obj = new Media_Artists();
                artists_obj.ArtistName      = ArtistName;
                artists_obj.Alias           = Alias;
                artists_obj.FrontImage      = FrontImage;
                artists_obj.MainImage       = MainImage;
                artists_obj.Description     = Description;
                artists_obj.ListOrder       = (ListOrder == null ? 1 : ListOrder);
                artists_obj.IPLog           = IP;
                artists_obj.CreatedOnDate   = System.DateTime.Now;
                artists_obj.CreatedByUserId = new Guid(UserId);
                artists_obj.Status          = Status;
                dbContext.AddToMedia_Artists(artists_obj);
                int i = dbContext.SaveChanges();
                return(i);
            }
        }