public void GetTransferArchivesByProcess() { try { var archivesByProcess = _transferArchiveControlRepository.GetTransferArchivesByProcess(); foreach (var archive in archivesByProcess) { TransferArchiveResponse checkSum = null; switch (archive.TypeAction) { case (int)TransferArchiveControlEnum.COPY: checkSum = CopyArchive(_mapper.Map <TransferArchive>(JsonConvert.DeserializeObject <TransferArchiveViewModel>(archive.Request))); break; case (int)TransferArchiveControlEnum.MOVE: checkSum = MoveArchive(_mapper.Map <TransferArchive>(JsonConvert.DeserializeObject <TransferArchiveViewModel>(archive.Request))); break; case (int)TransferArchiveControlEnum.DELETE: DeleteArchive(_mapper.Map <TransferArchive>(JsonConvert.DeserializeObject <TransferArchiveViewModel>(archive.Request))); break; case (int)TransferArchiveControlEnum.TRANSFERBYFTP: checkSum = DeliverByFTP(_mapper.Map <TransferArchiveFtp>(JsonConvert.DeserializeObject <TransferArchiveFtpViewModel>(archive.Request))); break; case (int)TransferArchiveControlEnum.GETALL: GetAllArchive(_mapper.Map <FindArchive>(JsonConvert.DeserializeObject <FindArchiveViewModel>(archive.Request))); break; case (int)TransferArchiveControlEnum.GETPARTIALNAME: GetArchivesByPartialName(_mapper.Map <FindArchive>(JsonConvert.DeserializeObject <FindArchiveViewModel>(archive.Request))); break; default: break; } archive.UpdateData(Guid.NewGuid(), (checkSum != null ? checkSum.CheckSum : String.Empty), DateTime.Now); _transferArchiveControlRepository.Update(archive); _unitOfwork.Commit(); } } catch (Exception ex) { throw ex; } }
public TransferArchiveResponse DeliverByFTP(TransferArchiveFtp archive) { try { var cheksum = Checksum(archive.FullNameArchive); TransferArchiveResponse transferArchiveResponse = new TransferArchiveResponse(cheksum); _videoManagementRepository.FtpUploadArchive(archive); return(transferArchiveResponse); } catch (Exception ex) { //_mail.SendEmail(); throw ex; } }
public TransferArchiveResponse CopyArchive(TransferArchive archive) { try { var cheksum = Checksum(archive.FullName); TransferArchiveResponse transferArchiveResponse = new TransferArchiveResponse(cheksum); _videoManagementRepository.CopyArchive(archive); return(transferArchiveResponse); } catch (Exception ex) { //_mail.SendEmail(); throw ex; } }