Пример #1
0
        public static string GetPhotoPath(int photoId)
        {
            PhotoGalleryInfo photoGalleryInfo = new PhotoGalleryDao().Get <PhotoGalleryInfo>(photoId);

            if (photoGalleryInfo != null)
            {
                return(photoGalleryInfo.PhotoPath);
            }
            return("");
        }
Пример #2
0
        public static bool DeletePhoto(int photoId)
        {
            string photoPath = GetPhotoPath(photoId);
            bool   flag      = new PhotoGalleryDao().DeletePhoto(photoId);

            if (flag)
            {
                StoreHelper.DeleteImage(photoPath);
            }
            return(flag);
        }
Пример #3
0
        public static int AddPhotoCategory(string name, int supplierId)
        {
            PhotoGalleryDao   photoGalleryDao = new PhotoGalleryDao();
            PhotoCategoryInfo model           = new PhotoCategoryInfo
            {
                CategoryName    = name,
                SupplierId      = supplierId,
                DisplaySequence = photoGalleryDao.GetMaxDisplaySequence <PhotoCategoryInfo>()
            };

            return((int)photoGalleryDao.Add(model, null));
        }
Пример #4
0
        public static bool AddPhote(int categoryId, string photoName, string photoPath, int fileSize, int supplierId)
        {
            PhotoGalleryDao photoGalleryDao = new PhotoGalleryDao();

            if (categoryId <= 0 && supplierId > 0)
            {
                categoryId = photoGalleryDao.GetDefaultPhotoCategoryId(supplierId);
            }
            PhotoGalleryInfo model = new PhotoGalleryInfo
            {
                CategoryId     = categoryId,
                FileSize       = fileSize,
                LastUpdateTime = DateTime.Now,
                PhotoName      = photoName,
                PhotoPath      = photoPath,
                UploadTime     = DateTime.Now,
                SupplierId     = supplierId
            };

            return(photoGalleryDao.Add(model, null) > 0);
        }