public void SaveAlbum(string Name, string Description, string Location)
 {
     Folder folder = new Folder();
     Int64 result = 0;
     if (_webContext.AlbumID > 0)
     {
         folder = Folder.GetFolderByID(_webContext.AlbumID);
         folder.Description = Description;
         folder.Name = Name;
         folder.Location = Location;
         folder.IsPublicResource = false;
         result = Folder.UpdateFolder(folder);
         _redirector.GoToPhotosAddPhotos(result);
     }
     else
     {
         folder.AccountID = _userSession.CurrentUser.AccountID;
         folder.Description = Description;
         folder.Name = Name;
         folder.Location = Location;
         folder.IsPublicResource = false;
         folder.CreateDate = DateTime.Now;
         result = Folder.SaveFolder(folder);
         _redirector.GoToPhotosAddPhotos(result);
     }
     
 }
Example #2
0
 public void LoadUI(Folder folder)
 {
     txtFolderName.Text = folder.Name;
     txtDescription.Text = folder.Description;
     txtLocation.Text = folder.Location;
     litFolderID.Text = folder.FolderID.ToString();
 }
Example #3
0
        public void LoadAlbumDetails(Folder folder)
        {
            lblAlbumName.Text = folder.Name;
            lblLocation.Text = folder.Location;
            lblDescription.Text = folder.Description;
            lblCreateDate.Text = folder.CreateDate.ToString("dd-MM-yyyy lĂșc HH:mm");

            if (folder.AccountID != _userSession.CurrentUser.AccountID)
            {
                btnEditPhotos.Visible = false;
                btnEditAlbum.Visible = false;
                btnAddPhotos.Visible = false;
            }
            albumID = folder.FolderID;
            comments.SystemObjectRecordID = folder.FolderID;
            Tags1.SystemObjectRecordID = folder.FolderID;
        }
Example #4
0
        public static void DeleteFolder(Folder folder)
        {
            //string cache_key = "GetFoldersByAccountID_" + folder.AccountID;

            //if (_cache.Exists(cache_key))
            //    _cache.Delete(cache_key);

            Delete(folder.FolderID);
        }
Example #5
0
 public static Int64 UpdateFolder(Folder folder)
 {
     Update(folder);
     return folder.FolderID;
 }
Example #6
0
 public static Int64 SaveFolder(Folder folder)
 {
     Add(folder);
     return folder.FolderID;
 }
Example #7
0
        private static void DeleteFileFromFileSystem(Folder folder, File file)
        {
            string path = "";
            switch (file.FileTypeID)
            {
                case 1:
                case 2:
                case 7:
                    path = "Photos\\";
                    break;
                case 3:
                case 4:
                    path = "Audios\\";
                    break;
                case 5:
                case 8:
                case 6:
                    path = "Videos\\";
                    break;
            }

            string fullPath = _webContext.FilePath + "Files\\" + path + folder.CreateDate.Year.ToString() + folder.CreateDate.Month.ToString() + "\\";
            
            if (Directory.Exists(fullPath))
            {
                if (System.IO.File.Exists(fullPath + file.FileSystemName + "__o." + file.Extension))
                    System.IO.File.Delete(fullPath + file.FileSystemName + "__o." + file.Extension);
                if (System.IO.File.Exists(fullPath + file.FileSystemName + "__t." + file.Extension))
                    System.IO.File.Delete(fullPath + file.FileSystemName + "__t." + file.Extension);
                if (System.IO.File.Exists(fullPath + file.FileSystemName + "__s." + file.Extension))
                    System.IO.File.Delete(fullPath + file.FileSystemName + "__s." + file.Extension);
                if (System.IO.File.Exists(fullPath + file.FileSystemName + "__m." + file.Extension))
                    System.IO.File.Delete(fullPath + file.FileSystemName + "__m." + file.Extension);
                if (System.IO.File.Exists(fullPath + file.FileSystemName + "__l." + file.Extension))
                    System.IO.File.Delete(fullPath + file.FileSystemName + "__l." + file.Extension);

                if(Directory.GetFiles(fullPath).Count() == 0)
                    Directory.Delete(fullPath);
            }
        }
Example #8
0
 public static void DeleteFilesInFolder(Folder folder)
 {
         List<File> files = GetFilesByFolderID(folder.FolderID);
         foreach (File file in files)
         {
             DeleteFileFromFileSystem(folder, file);
             File.Delete(file.FileID);
         }
 }