Exemple #1
0
        static public void Delete(System.Int32 id, esSqlAccessType sqlAccessType)
        {
            var obj = new ProductPhoto();

            obj.Id = id;
            obj.AcceptChanges();
            obj.MarkAsDeleted();
            obj.Save(sqlAccessType);
        }
Exemple #2
0
        public ProductPhoto GetMainPhoto()
        {
            ProductPhotoQuery q = new ProductPhotoQuery();

            q.es.Top = 1;
            q.Where(q.ProductId == this.Id.Value);
            q.OrderBy(q.SortOrder.Ascending, q.DisplayName.Ascending);

            ProductPhoto mainPhoto = new ProductPhoto();

            if (mainPhoto.Load(q))
            {
                return(mainPhoto);
            }
            return(new ProductPhoto());
        }
Exemple #3
0
        public static bool DeletePhoto(int photoId)
        {
            ProductPhoto toDelete = new ProductPhoto();

            if (toDelete.LoadByPrimaryKey(photoId))
            {
                string filename = toDelete.Filename;

                toDelete.MarkAsDeleted();
                toDelete.Save();

                string deletePath = StoreUrls.GetProductPhotoFolderFileRoot() + filename;
                File.Delete(deletePath);

                return(true);
            }
            return(false);
        }