public static List <File> GetFiles(Guid organizationId, Guid instanceId, int ticketId) { MetaDataSet.FileDataTable tktFiles = null; FileTableAdapter fta = new FileTableAdapter(bigWebApps.bigWebDesk.Data.DBAccess.GetConnectionString(organizationId)); tktFiles = fta.GetFiles(instanceId, instanceId, "tickets-tickets-files", ticketId.ToString(), false); if (tktFiles != null && tktFiles.Count > 0) { List <File> files = new Files(tktFiles).List; foreach (File file in files) { string fileUrl = Micajah.FileService.Client.Access.GetFileUrl(file.FileUniqueId, file.OrganizationId, file.DepartmentId); if (!string.IsNullOrEmpty(fileUrl)) { //fileUrl = "https://files.bigwebapps.com" + fileUrl.Substring(fileUrl.IndexOf("/File.ashx")); file.Url = fileUrl; } } return(files); } return(null); }
protected FileItem[] GetChildFiles(MainDataSet.ArticleRow articleRow) { if (articleRow != null && articleRow.DepartmentGuid != Guid.Empty) { MetaDataSet.FileDataTable dtFiles = (new Micajah.FileService.Client.Dal.MetaDataSetTableAdapters.FileTableAdapter()).GetFiles( Micajah.Common.Bll.Providers.InstanceProvider.GetInstance(articleRow.DepartmentGuid).OrganizationId, articleRow.DepartmentGuid, "Article", articleRow.ArticleGuid.ToString("N"), false); ArrayList files = new ArrayList(); foreach (MetaDataSet.FileRow frow in dtFiles) { string path = string.Empty; string ext = Path.GetExtension(frow.Name); string mimeType = MimeType.GetMimeType(ext); switch (FileType) { case "Image": path = Access.GetThumbnailUrl(frow.FileUniqueId, frow.OrganizationId, frow.DepartmentId, 640, 0, 0); if (MimeType.IsImageType(mimeType)) { files.Add( new FileItem( frow.Name, ext, frow.SizeInBytes, string.Empty, path, string.Format("{0}/{1}/", articleRow.Subject, frow.Name), fullPermissions)); } break; case "Video": path = Access.GetFileUrl(frow.FileUniqueId, frow.OrganizationId, frow.DepartmentId); if (MimeType.IsVideoType(mimeType)) { files.Add(new FileItem( frow.Name, ext, frow.SizeInBytes, string.Empty, path, string.Format("{0}/{1}/", articleRow.Subject, frow.Name), fullPermissions)); } break; case "Flash": path = Access.GetFlashUrl(frow.FileUniqueId, frow.OrganizationId, frow.DepartmentId); if (MimeType.IsFlash(mimeType)) { files.Add(new FileItem( frow.Name, ext, frow.SizeInBytes, string.Empty, path, string.Format("{0}/{1}/", articleRow.Subject, frow.Name), fullPermissions)); } break; default: path = Access.GetFileUrl(frow.FileUniqueId, frow.OrganizationId, frow.DepartmentId); files.Add(new FileItem( frow.Name, ext, frow.SizeInBytes, string.Empty, path, string.Format("{0}/{1}/", articleRow.Subject, frow.Name), fullPermissions)); break; } } return((FileItem[])files.ToArray(typeof(FileItem))); } return(new FileItem[] { }); }