コード例 #1
0
        public AmendFileResponse Action()
        {
            AmendFileResponse response = new AmendFileResponse();

            try
            {
                FileInfo fileInfoTarget  = new FileInfo(_targetPath);
                FileInfo fileInfoCurrent = new FileInfo(_currentPath);

                if (!fileInfoCurrent.Exists)
                {
                    throw new FileNotFoundException("File not Found", _currentFileName);
                }
                if (fileInfoTarget.Exists)
                {
                    throw new FileNotFoundException("File is dupicate", _targetfileName);
                }

                File.Copy(fileInfoCurrent.FullName, fileInfoTarget.FullName);

                response.Code    = "0000";
                response.Message = Resources.infoAmendFile_Success;
            }
            catch (Exception ex)
            {
                throw new ApplicationException(ex.Message);
            }

            return(response);
        }
コード例 #2
0
        public AmendFileResponse AmendFile(AmendFileRequest request)
        {
            AmendFileResponse response = new AmendFileResponse();

            try
            {
                response = FileManagerService.RemoteFileCommand(request).Action();
            }
            catch (Exception ex)
            {
                response.Code    = "0001";
                response.Message = ex.Message;
            }
            return(response);
        }