public CPrintMedia(string title, string author, MediaType media, AccessType access, MediaLocation location, string publisher, string genre, int rating, int year, bool completed) : base(title, author, media, access) { this.location = location; this.meta = new BOOK_METADATA(this, publisher, genre, rating, year, completed); XMLDirectoryLocation = base.Title; }
private void GeneratePdf(HtmlDocument doc, MediaLocation ipResultPdfMediaLocation, Event eventData, Customer customer, TestType testType, string testSourceHtmlPath, IEnumerable <CustomerScreeningEvaluatinPhysicianViewModel> physicians, TestResult testResult, List <ResultMedia> resultMedia) { string testName = testType.ToString(); var testHtmlPath = Path.Combine(ipResultPdfMediaLocation.PhysicalPath, testName + ".html"); var testHtmlUrl = Path.Combine(ipResultPdfMediaLocation.Url, testName + ".html"); var appentAcesIdOrCustomerId = string.IsNullOrEmpty(customer.AcesId) ? "NoAcesId_" + customer.CustomerId : customer.AcesId; var testPdfLocation = ipResultPdfMediaLocation.PhysicalPath + testName + "_" + appentAcesIdOrCustomerId + "_" + customer.Name.LastName + "_" + customer.Name.FirstName + "_" + eventData.EventDate.Year + ".pdf"; _copyMediaResultPdfHelper.CopyOverSupportDirectorytotheDestination(testHtmlPath, testSourceHtmlPath, physicians, copySupportMediaOtherThanPhysician: true); _copyMediaResultPdfHelper.CopyOverMedia(eventData.Id, customer.CustomerId, testHtmlPath, resultMedia); if (testType == TestType.AwvEkg) { _copyMediaResultPdfHelper.CopyOverAwvEkgGraph(eventData.Id, customer.CustomerId, testHtmlPath, testResult as AwvEkgTestResult); } _copyMediaResultPdfHelper.UpdateHTMLWithImages(doc); doc.Save(testHtmlPath); var dob = string.Empty; if (customer.DateOfBirth.HasValue) { dob = " DOB:" + customer.DateOfBirth.Value.ToString("MM/dd/yyyy"); } _pdfGenerator.GeneratePdf(testHtmlUrl, testPdfLocation, true, customer.NameAsString + " [" + customer.CustomerId + "]" + dob + " Testing Date:" + eventData.EventDate.ToShortDateString()); }
private File FileObject(string fileNamePrefix, string fileUploadElementName, MediaLocation fileLocation, long fileId = 0) { if (Request.Files != null && Request.Files.Count > 0 && Request.Files[fileUploadElementName] != null) { var fileUploaded = Request.Files[fileUploadElementName]; if (string.IsNullOrEmpty(fileUploaded.FileName)) { return(fileId > 0 ? _fileRepository.GetById(fileId) : null); } var newFileName = fileNamePrefix.Replace(" ", "") + "_" + DateTime.Now.ToFileTimeUtc() + Path.GetExtension(fileUploaded.FileName); fileUploaded.SaveAs(fileLocation.PhysicalPath + newFileName); return(new File { Id = fileId, FileSize = fileUploaded.ContentLength, Path = newFileName, Type = FileType.Image, UploadedOn = DateTime.Now, UploadedBy = new OrganizationRoleUser(_sessionContext.UserSession.CurrentOrganizationRole.OrganizationRoleUserId) }); } return(fileId > 0 ? _fileRepository.GetById(fileId) : null); }
private void ParseMonarchAttestationForm(IEnumerable <Customer> customers, MediaLocation unlockedParseLocation) { var monarchLocation = _mediaRepository.GetMonarchAttestaionLocation(); foreach (var customer in customers) { if (!string.IsNullOrEmpty(customer.AdditionalField4)) { _logger.Info("CustomerId: " + customer.CustomerId); _logger.Info("GMPI: " + customer.AdditionalField4); try { AttachAttestationForm(monarchLocation.PhysicalPath, customer.AdditionalField4, unlockedParseLocation.PhysicalPath); } catch (Exception ex) { _logger.Error("Message: " + ex.Message); _logger.Error("Stack Trace: " + ex.StackTrace); } } else { _logger.Info("GMPI is not available for Customer ID : " + customer.CustomerId); } } }
public CWebMedia(string title, string author, MediaType media, AccessType access, MediaLocation location, string url, string website, string genre, int rating, int year, bool completed) : base(title, author, media, access) { this.location = location; this.meta = new WEB_METADATA(this, url, website, genre, rating, year, completed); XMLDirectoryLocation = base.Title; }
public IMediaLocation Create(string path) { //Debug.Assert(path != null); (null path okay sometimes) if (path == null) { return(null); } if (Helper.IsShortcut(path)) { path = Helper.ResolveShortcut(path); } IMediaLocation location = null; if (Directory.Exists(path)) { var info = new DirectoryInfo(path).ToFileInfo(); location = new FolderMediaLocation(info, null); } else if (File.Exists(path)) { var info = new System.IO.FileInfo(path).ToFileInfo(); if (path.ToLower().EndsWith(".vf")) { location = new VirtualFolderMediaLocation(info, null); } else { location = new MediaLocation(info, null); } } return(location); }
public IResult <MediaLocation, MediaLocationErrors> AddMediaLocation(MediaLocation mediaLocation) { MediaLocation location = null; var isSuccessful = true; var validationResult = ValidateMediaLocation(mediaLocation); switch (validationResult) { case MediaLocationErrors.AlreadyAdded: _mediaLocatorService.AddLocation(mediaLocation, false); location = mediaLocation; break; case MediaLocationErrors.None: location = _mediaLocationContext.Save(mediaLocation); _mediaLocatorService.AddLocation(location, true); break; default: isSuccessful = false; break; } return(new Result <MediaLocation, MediaLocationErrors>(location, validationResult, isSuccessful)); }
public ResultArchiveParserTester() { DependencyRegistrar.RegisterDependencies(); var mediaRepository = IoC.Resolve <IMediaRepository>(); _archiveLocation = mediaRepository.GetResultArchiveMediaFileLocation(1234); }
private string GetFileName(string sourceFile, MediaLocation mediaLocation) { var fileNameWithoutExtention = Path.GetFileNameWithoutExtension(sourceFile); var archiveFileName = fileNameWithoutExtention + "_" + DateTime.Now.ToString("MMddyyyyHHmmss") + ".txt"; var destinationFile = Path.Combine(mediaLocation.PhysicalPath, archiveFileName); var archiveFilePath = string.Empty; try { var archiveFolderPath = Path.Combine(_memberUploadbyAcesSourceFolderPath, DateTime.Today.ToString("yyyyMMdd"), "Archive"); archiveFilePath = Path.Combine(archiveFolderPath, archiveFileName); DirectoryOperationsHelper.CreateDirectoryIfNotExist(archiveFolderPath); DirectoryOperationsHelper.Copy(sourceFile, archiveFilePath); DirectoryOperationsHelper.Move(sourceFile, destinationFile); _logger.Info("Source Path: " + sourceFile); _logger.Info("Destination Path: " + destinationFile); } catch (Exception ex) { _logger.Error("Error while archiving file."); _logger.Error("Message: " + ex.Message); _logger.Error("Stack trace: " + ex.StackTrace); } _logger.Info("Archive Path: " + archiveFilePath); return(destinationFile); }
public static Tbl_MediaLocation Morf(this Tbl_MediaLocation mediaLocation, MediaLocation location) { mediaLocation.Id = location.Id; mediaLocation.Path = location.Path; mediaLocation.IsToMonitor = location.IsToMonitor; return(mediaLocation); }
public ExportableReportsController(IProspectCustomerService prospectCustomerService, IMediaRepository mediaRepository, IZipHelper zipHelper, ILogManager logManager, ISessionContext sessionContext, ILoginSettingRepository loginSettingRepository, IRoleRepository roleRepository, IOrganizationRoleUserRepository organizationRoleUserRepository, IUserRepository <User> userRepository, ISettings settings) : base(zipHelper, logManager, sessionContext, loginSettingRepository, roleRepository, organizationRoleUserRepository, userRepository, settings) { _prospectCustomerService = prospectCustomerService; _tempMediaLocation = mediaRepository.GetTempMediaFileLocation(); }
public ExportableReportsController(IUsersListModelRepository usersListModelRepository, IMediaRepository mediaRepository, IZipHelper zipHelper, ILogManager logManager, ISessionContext sessionContext, ILoginSettingRepository loginSettingRepository, IRoleRepository roleRepository, IOrganizationRoleUserRepository organizationRoleUserRepository, IUserRepository <User> userRepository, ISettings settings) : base(zipHelper, logManager, sessionContext, loginSettingRepository, roleRepository, organizationRoleUserRepository, userRepository, settings) { _usersListModelRepository = usersListModelRepository; _tempMediaLocation = mediaRepository.GetTempMediaFileLocation(); }
public static async Task <Collection <SimpleProduct> > GetAugmentedSimpleProducts(EcommerceContext ecommerceContext, Collection <SimpleProduct> simpleProducts, IEnumerable <ProductCatalog> catalogs) { if (ecommerceContext == null) { throw new ArgumentNullException(nameof(ecommerceContext)); } HashSet <long> distinctProductIdsIncludingKitComponents = new HashSet <long>(); foreach (SimpleProduct simpleProduct in simpleProducts) { distinctProductIdsIncludingKitComponents.Add((long)simpleProduct.RecordId); if ((ProductType)simpleProduct.ProductTypeValue == ProductType.KitVariant) { foreach (ProductComponent productComponent in simpleProduct.Components) { distinctProductIdsIncludingKitComponents.Add((long)productComponent.ProductId); } } } IDictionary <long, MediaLocation> mediaLocationDictionary = await GetMediaLocationDictionary(ecommerceContext, distinctProductIdsIncludingKitComponents, catalogs); MediaLocation mediaLocation = null; string primaryImageUri = string.Empty; string primaryImageAltText = string.Empty; foreach (SimpleProduct simpleProduct in simpleProducts) { if (mediaLocationDictionary.TryGetValue((long)simpleProduct.RecordId, out mediaLocation)) { primaryImageUri = mediaLocation.Uri; primaryImageAltText = mediaLocation.AltText; } simpleProduct.ExtensionProperties.SetPropertyValue("PrimaryImageUri", ExtensionPropertyTypes.String, primaryImageUri); simpleProduct.ExtensionProperties.SetPropertyValue("PrimaryImageAltText", ExtensionPropertyTypes.String, primaryImageAltText); if ((ProductType)simpleProduct.ProductTypeValue == ProductType.KitVariant) { foreach (ProductComponent productComponent in simpleProduct.Components) { if (mediaLocationDictionary.TryGetValue((long)productComponent.ProductId, out mediaLocation)) { primaryImageUri = mediaLocation.Uri; primaryImageAltText = mediaLocation.AltText; } productComponent.ExtensionProperties.SetPropertyValue("PrimaryImageUri", ExtensionPropertyTypes.String, primaryImageUri); productComponent.ExtensionProperties.SetPropertyValue("PrimaryImageAltText", ExtensionPropertyTypes.String, primaryImageAltText); } } } return(simpleProducts); }
public ExportableReportsController(IOperationsReportingService operationsReportingService, IMediaRepository mediaRepository, IZipHelper zipHelper, ILogManager logManager, ISessionContext sessionContext, ILoginSettingRepository loginSettingRepository, IRoleRepository roleRepository, IOrganizationRoleUserRepository organizationRoleUserRepository, IUserRepository <User> userRepository, ISettings settings, IStaffEventScheduleExportService staffEventScheduleExportService) : base(zipHelper, logManager, sessionContext, loginSettingRepository, roleRepository, organizationRoleUserRepository, userRepository, settings) { _operationsReportingService = operationsReportingService; _staffEventScheduleExportService = staffEventScheduleExportService; _tempMediaLocation = mediaRepository.GetTempMediaFileLocation(); _sessionContext = sessionContext; }
public long FailedCustomerCount(string failedCustomerFilePath, MediaLocation mediaLocation) { var file = mediaLocation.PhysicalPath + failedCustomerFilePath; var customerTable = _csvReader.ReadWithTextQualifier(file); var query = customerTable.AsEnumerable(); return(query.Count()); }
public ExportableReportsController(IHospitalPartnerService hospitalPartnerService, ITestRepository testRepository, IMediaRepository mediaRepository, IZipHelper zipHelper, ILogManager logManager, ISessionContext sessionContext, ILoginSettingRepository loginSettingRepository, IRoleRepository roleRepository, IOrganizationRoleUserRepository organizationRoleUserRepository, IUserRepository <User> userRepository, ISettings settings) : base(zipHelper, logManager, sessionContext, loginSettingRepository, roleRepository, organizationRoleUserRepository, userRepository, settings) { _hospitalPartnerService = hospitalPartnerService; _logger = logManager.GetLogger <ExportableReportsController>(); _testRepository = testRepository; _tempMediaLocation = mediaRepository.GetTempMediaFileLocation(); }
private string SaveFile(string byteData, MediaLocation mediaLocation, string fileName) { var filePath = Path.Combine(mediaLocation.PhysicalPath, fileName); DirectoryOperationsHelper.DeleteFileIfExist(filePath); var dataBytes = Convert.FromBase64String(byteData); File.WriteAllBytes(filePath, dataBytes); return(Path.Combine(mediaLocation.Url, fileName)); }
private string PrintLipidBasicBiometric(long eventCustomerId, MediaLocation mediaLocation) { var guid = Guid.NewGuid().ToString(); var pdfFileName = "Lipid_" + guid + ".pdf"; var htmlFileName = "Lipid_" + guid + ".html"; _generateKynLipidService.GenerateLipidResult(mediaLocation.PhysicalPath + htmlFileName, eventCustomerId); //_pdfGenerator.PaperSize = _configurationSettingRepository.GetConfigurationValue(ConfigurationSettingName.PaperSize); _pdfGenerator.GeneratePdf(mediaLocation.Url + htmlFileName, mediaLocation.PhysicalPath + pdfFileName); return(pdfFileName); }
private void AddLocation(MediaLocation mediaLocation) { var addLocationResult = _collectionManager.AddMediaLocation(mediaLocation); if (addLocationResult.IsSuccessful) { Locations.Add(addLocationResult.Value); } else { _messengerService.ShowMessageBox("Error adding media location!", GetErrorString(addLocationResult.FailureReason), MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void AddLocationCmd(object obj) { var result = _messengerService.ShowSelectFolderDialog("Please select a folder!"); if (result.IsSuccessful) { var mediaLocation = new MediaLocation { Path = result.Value, IsToMonitor = true }; AddLocation(mediaLocation); } }
public string DownloadZipFile(MediaLocation mediaLocation, string csvfileName, long userId, ILogger logger) { var csvFilePath = mediaLocation.PhysicalPath + csvfileName; var fileName = string.Empty; try { var isPinRequired = false; var user = _userRepository.GetUser(userId); var orgRoles = _organizationRoleUserRepository.GetOrganizationRoleUserCollectionforaUser(userId); var defaultRole = orgRoles.FirstOrDefault(oru => oru.RoleId == (long)user.DefaultRole); if (defaultRole != null) { Role role = _roleRepository.GetByRoleId(defaultRole.RoleId); isPinRequired = role.IsPinRequired; } var password = ""; if (isPinRequired) { var userSetting = _loginSettingRepository.Get(userId); if (userSetting != null) { password = userSetting.DownloadFilePin; } } string zipFilePath = _zipHelper.CreateZipOfSingleFile(csvFilePath, password); fileName = Path.GetFileName(zipFilePath); if (fileName == null || fileName.IndexOfAny(Path.GetInvalidFileNameChars()) != -1) { throw new InvalidFileNameException(); } } finally { try { DirectoryOperationsHelper.Delete(csvFilePath); } catch (Exception ex) { logger.Error("exception Message : " + ex.Message + " Stack Trace :" + ex.StackTrace); } } return(fileName); }
public override void AddLocation(MediaLocation mediaLocation, bool beginMediaItemFetching) { mediaLocation = mediaLocation.Clone(); if (mediaLocation.Id < 0) { throw new ArgumentException("Id cannot be undefinned."); } _mediaLocations.Add(mediaLocation.Id, mediaLocation); if (beginMediaItemFetching) { FetchMediaFiles(mediaLocation.Path); } }
public override void RemoveLocation(MediaLocation mediaLocation) { if (_mediaLocations.ContainsKey(mediaLocation.Id)) { _mediaLocations.Remove(mediaLocation.Id); if (_fileSystemWatchers.Value.ContainsKey(mediaLocation.Id)) { var fileSystemWatcher = _fileSystemWatchers.Value[mediaLocation.Id]; _fileSystemWatchers.Value.Remove(mediaLocation.Id); DisposeFileSystemWatcher(ref fileSystemWatcher); } } }
public ExportableReportsController(ICallQueueService callQueueService, IMediaRepository mediaRepository, IZipHelper zipHelper, ILogManager logManager, ISessionContext sessionContext, ILoginSettingRepository loginSettingRepository, IRoleRepository roleRepository, IOrganizationRoleUserRepository organizationRoleUserRepository, IUserRepository <User> userRepository, ISettings settings, ICallCenterReportService callCenterReportService, ICallQueueCustomerReportService callQueueCustomerReportService, IConfirmationReportingService confirmationReportingService, ICallSkippedReportService callSkippedReportService, IGmsExcludedCustomerService gmsExcludedCustomerService, IPreAssessmentReportingService preAssessmentReportingService) : base(zipHelper, logManager, sessionContext, loginSettingRepository, roleRepository, organizationRoleUserRepository, userRepository, settings) { _callQueueService = callQueueService; _callCenterReportService = callCenterReportService; _callQueueCustomerReportService = callQueueCustomerReportService; _confirmationReportingService = confirmationReportingService; _callSkippedReportService = callSkippedReportService; _gmsExcludedCustomerService = gmsExcludedCustomerService; _logger = logManager.GetLogger <ExportableReportsController>(); _tempMediaLocation = mediaRepository.GetTempMediaFileLocation(); _preAssessmentReportingService = preAssessmentReportingService; }
public async Task <Result> SetMediaLocation(string downloadLink, MediaLocation mediaLocation) { if (!IsConnected()) { return(Result.Failure("Could not connect to VidloadCache")); } try { var db = _connectionMultiplexer.GetDatabase(); var serialized = JsonConvert.SerializeObject(mediaLocation); await db.HashSetAsync(_cacheConfiguration.MediaLocationKey, downloadLink, serialized); return(Result.Success()); } catch (Exception exc) { return(Result.Failure(exc.Message)); } }
public override void UpdateLocation(MediaLocation updatedMediaLocation) { if (_mediaLocations.ContainsKey(updatedMediaLocation.Id)) { var storedLocation = _mediaLocations[updatedMediaLocation.Id]; if (!updatedMediaLocation.Equals(storedLocation)) { RemoveLocation(storedLocation); AddLocation(updatedMediaLocation, false); } } else { throw new InvalidOperationException("Cannot update media location which is not added."); } }
public string CheckIsFileContainsRecord(MediaLocation mediaLocation, string filePath) { try { var customerTable = _csvReader.ReadWithTextQualifier(mediaLocation.PhysicalPath + filePath); if (customerTable.Rows.Count > 0) { return(mediaLocation.Url + filePath); } DirectoryOperationsHelper.Delete(filePath); } catch (Exception) { } return(string.Empty); }
private void CreateFailedUploadFile(string file, MediaLocation mediaLocation, List <MemberUploadbyAcesFailedCustomerModel> failedRecords, CorporateUpload corportateUpload) { if (failedRecords.Any()) { try { var nameWithoutExt = Path.GetFileNameWithoutExtension(file); var fileName = nameWithoutExt + "_Failed_" + DateTime.Now.ToString("MMddyyyyHHmmss") + ".txt"; var sourceFailedLocation = Path.Combine(mediaLocation.PhysicalPath, fileName); DirectoryOperationsHelper.DeleteFileIfExist(sourceFailedLocation); _logger.Info("Number of failed Records: " + failedRecords.Count); _logger.Info("Creating file for failed records..."); _pipeDelimitedReportHelper.Write(failedRecords.OrderBy(x => x.CustomerId), mediaLocation.PhysicalPath, fileName); _logger.Info("failed records file created."); _logger.Info("Failed file Coping in Client Location."); var targetFailedFoler = Path.Combine(_memberUploadbyAcesSourceFolderPath, DateTime.Today.ToString("yyyyMMdd"), "Failed"); DirectoryOperationsHelper.CreateDirectoryIfNotExist(targetFailedFoler); var targetFailedLocation = Path.Combine(targetFailedFoler, fileName); DirectoryOperationsHelper.CopyWithReplace(sourceFailedLocation, targetFailedLocation); _memberUploadByAcesHelper.UploadFailedFile(sourceFailedLocation, corportateUpload); _logger.Info("Failed Record Path:" + sourceFailedLocation); _logger.Info("Client Failed Record Path:" + targetFailedLocation); _logger.Info("Failed file Copied in Client Location."); } catch (Exception ex) { _logger.Error(string.Format("Error occurred while creating failed records file. \nException Message: {0}\n\tStackTrace: {1}", ex.Message, ex.StackTrace)); } } }
private void ParseNammAttestationForm(IEnumerable <Customer> customers, MediaLocation unlockedParseLocation, CorporateAccount account, long eventId) { if (!customers.IsNullOrEmpty() && _settings.IsSftpEnableforNaamAccount) { _logger.Info("Total no. of Customers found " + customers.Count()); try { if (!string.IsNullOrWhiteSpace(_settings.NammSourceDirectory) && !string.IsNullOrWhiteSpace(_settings.NammSftpHost) && !string.IsNullOrWhiteSpace(_settings.NammSftpUserName) && !string.IsNullOrWhiteSpace(_settings.NammSftpPassword)) { DowloadFilesFromSftp(customers.Select(x => x.CustomerId.ToString()).ToList(), Path.Combine(_settings.NammSourceDirectory, eventId.ToString()), unlockedParseLocation.PhysicalPath, _settings.NammSftpHost, _settings.NammSftpUserName, _settings.NammSftpPassword, "", ""); } else { _logger.Info("FTP Setting missing."); } } catch (Exception ex) { _logger.Error("Message: " + ex.Message); _logger.Error("Stack Trace: " + ex.StackTrace); } } else { var nammLocation = _settings.NammAttestationFormsPath; foreach (var customer in customers) { _logger.Info("CustomerId: " + customer.CustomerId); try { AttachAttestationForm(nammLocation, customer.CustomerId.ToString(), unlockedParseLocation.PhysicalPath); } catch (Exception ex) { _logger.Error("Message: " + ex.Message); _logger.Error("Stack Trace: " + ex.StackTrace); } } } }
private void MoveFileMediaLocation(List <string> sourceFiles, MediaLocation mediaLocation) { var dateWiseFolder = Path.Combine(mediaLocation.PhysicalPath, DateTime.Today.ToString("yyyyMMdd")); _logger.Info("Files moved in this location :" + dateWiseFolder); try { DirectoryOperationsHelper.CreateDirectoryIfNotExist(dateWiseFolder); foreach (var file in sourceFiles) { DirectoryOperationsHelper.Move(file, Path.Combine(dateWiseFolder, Path.GetFileName(file))); } } catch (Exception ex) { _logger.Error("Error while archiving file."); _logger.Error("Message: " + ex.Message); _logger.Error("Stack trace: " + ex.StackTrace); } _logger.Info("Date Path: " + dateWiseFolder); }