示例#1
0
        public DTO.ResponseService <DTO.RegistrationAttatchFile> InsertAttachFileToRegistration
            (DTO.Registration registration, DTO.RegistrationAttatchFile registrationAttachFile)
        {
            DTO.ResponseService <DTO.RegistrationAttatchFile> response = svc.InsertAttachFileToRegistration(registration.ID, registrationAttachFile);

            return(response);
        }
示例#2
0
        //public DTO.PersonAttatchFile SaveToEditAttachFilePath(DTO.PersonAttatchFile newAttachFile, DTO.PersonAttatchFile oldAttachFile, Stream fileSteam)
        //{
        //    DTO.RegistrationAttatchFile _newAttachFile =  new DTO.RegistrationAttatchFile();
        //    DTO.RegistrationAttatchFile _oldAttachFile = new DTO.RegistrationAttatchFile();
        //    newAttachFile.MappingToEntity<DTO.RegistrationAttatchFile>(_newAttachFile);
        //    oldAttachFile.MappingToEntity<DTO.RegistrationAttatchFile>(_oldAttachFile);

        //    using (FileService.FileTransferServiceClient svc = new FileService.FileTransferServiceClient())
        //    {

        //        String findString = "_"+oldAttachFile.ATTACH_FILE_TYPE.ToInt().ToString("00");
        //        String newfileName = oldAttachFile.ATTACH_FILE_PATH.Replace(findString, findString + IAS.BLL.Helpers.GenerateIdHelper.GetGenAutoId());


        //        MoveFileResponse moveResponse = svc.MoveFile("", oldAttachFile.ATTACH_FILE_PATH, "", newfileName);
        //        if (moveResponse.Code != "0000")
        //            throw new IOException(moveResponse.Message);

        //        DeleteFileResponse deleteResponse = svc.DeleteFile(oldAttachFile.ATTACH_FILE_PATH);
        //        if (deleteResponse.Code != "0000")
        //            throw new IOException(deleteResponse.Message);

        //        UploadFileResponse uploadResponse = svc.UploadFile("", oldAttachFile.ATTACH_FILE_PATH, fileSteam);
        //        if (uploadResponse.Code != "0000")
        //            throw new IOException(uploadResponse.Message);



        //        _newAttachFile.ATTACH_FILE_PATH = uploadResponse.TargetFullName;

        //    }
        //    _newAttachFile.MappingToEntity<DTO.RegistrationAttatchFile, DTO.PersonAttatchFile>(newAttachFile);
        //    return newAttachFile;

        //}

        public DTO.RegistrationAttatchFile SaveToAttachFilePath(DTO.RegistrationAttatchFile attachFile, Stream fileSteam)
        {
            using (FileService.FileTransferServiceClient svc = new FileService.FileTransferServiceClient())
            {
                UploadFileResponse response     = new UploadFileResponse();
                String             fs_container = String.Format(@"{0}\{1}", AttachFileContainer, attachFile.TempFilePath);

                //String newFileName = this.ID_CARD_NO + "_"
                //                                    + Convert.ToInt32(attachFile.ATTACH_FILE_TYPE).ToString("00")
                //                                    + "." + GetExtensionFile(attachFile.FileName);

                response = svc.UploadFile(new UploadFileRequest()
                {
                    TargetContainer = fs_container,
                    TargetFileName  = attachFile.FileName,
                    FileStream      = fileSteam
                });
                if (response.Code != "0000")
                {
                    throw new IOException(response.Message);
                }

                attachFile.ATTACH_FILE_PATH = response.TargetFullName;
            }

            return(attachFile);
        }
示例#3
0
        public static void  AttachValidate(this DTO.RegistrationAttatchFile attachFile)
        {
            string fileName = attachFile.FileName;

            validateFileType(fileName);

            if (attachFile.ATTACH_FILE_TYPE == "")
            {
                throw new ApplicationException(SysMessage.PleaseSelectFile);
            }

            if (attachFile.FileName == "")
            {
                throw new ApplicationException(SysMessage.PleaseChooseFile);
            }
        }
示例#4
0
 public static AttachFile ConvertToAttachFileView(this DTO.RegistrationAttatchFile attachFile)
 {
     return(new AttachFile()
     {
         ID = attachFile.ID,
         REGISTRATION_ID = attachFile.REGISTRATION_ID,
         ATTACH_FILE_TYPE = attachFile.ATTACH_FILE_TYPE,
         ATTACH_FILE_PATH = attachFile.ATTACH_FILE_PATH,
         REMARK = attachFile.REMARK,
         CREATED_BY = attachFile.CREATED_BY,
         CREATED_DATE = (attachFile.CREATED_DATE == null)? DateTime.MinValue: (DateTime)attachFile.CREATED_DATE,
         UPDATED_BY = attachFile.UPDATED_BY,
         UPDATED_DATE = (attachFile.UPDATED_DATE == null)? DateTime.MinValue: (DateTime)attachFile.UPDATED_DATE,
         FILE_STATUS = attachFile.FILE_STATUS,
         REQUEST_STATUS = attachFile.REQUEST_STATUS
     });
 }
示例#5
0
        public DTO.RegistrationAttatchFile SaveAttachToTemp(DTO.RegistrationAttatchFile attachFile, Stream fileSteam)
        {
            using (FileService.FileTransferServiceClient svc = new FileService.FileTransferServiceClient())
            {
                UploadFileResponse response     = new UploadFileResponse();
                String             fs_container = String.Format(@"{0}\{1}", TempFileContainer, attachFile.TempFilePath);


                response = svc.UploadFile(new UploadFileRequest()
                {
                    TargetContainer = fs_container,
                    TargetFileName  = attachFile.FileName,
                    FileStream      = fileSteam
                });
                if (response.Code != "0000")
                {
                    throw new IOException(response.Message);
                }

                attachFile.ATTACH_FILE_PATH = response.TargetFullName;
            }

            return(attachFile);
        }
示例#6
0
 public DTO.ResponseService <DTO.RegistrationAttatchFile> UpdateAttachFile(DTO.RegistrationAttatchFile entity)
 {
     DTO.ResponseService <DTO.RegistrationAttatchFile> res = svc.UpdateAttachFile(entity);
     return(res);
 }