Beispiel #1
0
        public FileMessage5 DownloadFile5(FileInfo5 msg)
        {
            try
            {
                SecurityCheckThrow(msg.s1, msg.s2);
                RecordCallHistory("DownloadFile");

                ZipFileAccess da              = new ZipFileAccess();
                var           voucherFolder   = da.CreateDirectoryHerarchy(Strings.FILESERVERFOLDER, msg.CountryId, msg.RetailerId, msg.VoucherId);
                var           sessionFileName = voucherFolder.CombineFileName(msg.SessionId);

                FileMessage5 download = new FileMessage5(msg);

                if (sessionFileName.Exists)
                {
                    Stream fileStream = new FileStream(sessionFileName.FullName, FileMode.Open);
                    download.FileByteStream = fileStream;
                }
                return(download);
            }
            catch (Exception ex)
            {
                throw new FaultException <MyApplicationFault>(new MyApplicationFault(), ex.Message);
            }
        }
Beispiel #2
0
        public void UploadFile5(FileMessage5 msg)
        {
            try
            {
                SecurityCheckThrow(msg.s1, msg.s2);
                RecordCallHistory("UploadFile");

                ZipFileAccess zipda           = new ZipFileAccess();
                var           voucherFolder   = zipda.CreateDirectoryHerarchy(Strings.FILESERVERFOLDER, msg.CountryId, msg.RetailerId, msg.VoucherId);
                var           sessionFileName = voucherFolder.CombineFileName(msg.SessionId);

                using (var file = sessionFileName.Open(FileMode.Create))
                    msg.FileByteStream.CopyTo(file);
            }
            catch (Exception ex)
            {
                throw new FaultException <MyApplicationFault>(new MyApplicationFault(), ex.Message);
            }
        }