示例#1
0
        public FileMessage2 DownloadFile2(FileInfo2 msg)
        {
            try
            {
                SecurityCheckThrow(msg.s1, msg.s2);
                RecordCallHistory("DownloadFile");

                DataAccess da    = new DataAccess();
                var        vinfo = da.SelectVoucherInfo(msg.CountryId, msg.VoucherId);

                ZipFileAccess zipda           = new ZipFileAccess();
                var           voucherFolder   = zipda.CreateDirectoryHerarchy(Strings.FILESERVERFOLDER, msg.CountryId, vinfo.branch_id, msg.VoucherId);
                var           sessionFileName = voucherFolder.CombineFileName(vinfo.session_Id);

                FileMessage2 download = new FileMessage2(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);
            }
        }
示例#2
0
        public void UploadFile2(FileMessage2 msg)
        {
            try
            {
                SecurityCheckThrow(msg.s1, msg.s2);
                RecordCallHistory("UploadFile");

                DataAccess da    = new DataAccess();
                var        vinfo = da.SelectVoucherInfo(msg.CountryId, msg.VoucherId);

                ZipFileAccess zipda           = new ZipFileAccess();
                var           voucherFolder   = zipda.CreateDirectoryHerarchy(Strings.FILESERVERFOLDER, msg.CountryId, vinfo.branch_id, msg.VoucherId);
                var           sessionFileName = voucherFolder.CombineFileName(vinfo.session_Id);

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