Example #1
0
        public YellowstonePathology.Business.Rules.MethodResult CreateRemoteFolder(string folderName)
        {
            YellowstonePathology.Business.Rules.MethodResult methodResult = new Rules.MethodResult();
            methodResult.Success = true;

            string uploadFolderName = Path.Combine(this.m_RemotePath, folderName);
            uploadFolderName = uploadFolderName.Replace(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar);

            FtpWebRequest request = (FtpWebRequest)WebRequest.Create(uploadFolderName);
            request.Method = WebRequestMethods.Ftp.MakeDirectory;
            request.KeepAlive = false;
            request.UsePassive = false;
            request.Credentials = new NetworkCredential(this.m_UserName, this.m_Password);

            FtpWebResponse response = null;
            try
            {
                response = (FtpWebResponse)request.GetResponse();
                if (response.StatusDescription.Substring(0, 3) != "257") //Indicate Creation Success
                {
                    methodResult.Message = "FTP Directory Creation failed for " + folderName + ".";
                    methodResult.Success = false;
                }

                response.Close();
            }
            catch
            {
                methodResult.Message = "FTP Directory Creation failed for " + folderName + ".";
                methodResult.Success = false;
            }
            return methodResult;
        }
        public override AuditResult IsOkToFinalize(AccessionOrder accessionOrder)
        {
            AuditResult auditResult = base.IsOkToFinalize(accessionOrder);

            if (auditResult.Status == AuditStatusEnum.OK)
            {
                YellowstonePathology.Business.Rules.MethodResult methodResult = this.IsOkToFinalize();
                if (methodResult.Success == false)
                {
                    auditResult.Status  = AuditStatusEnum.Failure;
                    auditResult.Message = methodResult.Message;
                }
            }
            return(auditResult);
        }
Example #3
0
 public YellowstonePathology.Business.Rules.MethodResult CreatePsftpScript(string folderName, Document.CaseDocumentCollection caseDocumentCollection)
 {
     YellowstonePathology.Business.Rules.MethodResult methodResult = new Rules.MethodResult();
     using (StreamWriter streamWriter = new StreamWriter(this.m_BatchFileName))
     {
         streamWriter.WriteLine("mkdir " + folderName);
         streamWriter.WriteLine("cd " + folderName);
         foreach (Document.CaseDocument caseDocument in caseDocumentCollection)
         {
             streamWriter.WriteLine("put " + caseDocument.FullFileName + " " + caseDocument.FileName);
         }
         streamWriter.WriteLine("quit");
     }
     return methodResult;
 }
Example #4
0
 public YellowstonePathology.Business.Rules.MethodResult CreatePsftpScript(string folderName, Document.CaseDocumentCollection caseDocumentCollection)
 {
     YellowstonePathology.Business.Rules.MethodResult methodResult = new Rules.MethodResult();
     using (StreamWriter streamWriter = new StreamWriter(this.m_BatchFileName))
     {
         streamWriter.WriteLine("mkdir " + folderName);
         streamWriter.WriteLine("cd " + folderName);
         foreach (Document.CaseDocument caseDocument in caseDocumentCollection)
         {
             streamWriter.WriteLine("put " + caseDocument.FullFileName + " " + caseDocument.FileName);
         }
         streamWriter.WriteLine("quit");
     }
     return(methodResult);
 }
Example #5
0
        public YellowstonePathology.Business.Rules.MethodResult ExecutePsftpScript(string host, string userName, string password)
        {
            YellowstonePathology.Business.Rules.MethodResult methodResult = new Rules.MethodResult();
            string arguments = host + " -l " + userName + " -pw " + password + " -b \"" + this.m_BatchFileName + "\" -batch";

            System.Diagnostics.ProcessStartInfo processStartInfo = new System.Diagnostics.ProcessStartInfo(this.m_FileToExecute, arguments);
            processStartInfo.RedirectStandardOutput = true;
            processStartInfo.UseShellExecute        = false;
            processStartInfo.CreateNoWindow         = true;

            System.Diagnostics.Process process = new System.Diagnostics.Process();
            process.StartInfo = processStartInfo;
            process.Start();
            string result = process.StandardOutput.ReadToEnd();

            methodResult.Message = result;
            return(methodResult);
        }
Example #6
0
        public YellowstonePathology.Business.Rules.MethodResult Upload(string localFileFullName)
        {
            YellowstonePathology.Business.Rules.MethodResult methodResult = new Rules.MethodResult();
            methodResult.Success = true;

            string fileName       = Path.GetFileName(localFileFullName);
            string uploadFileName = Path.Combine(this.m_RemotePath, fileName);

            uploadFileName = uploadFileName.Replace(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar);

            FtpWebRequest request = (FtpWebRequest)WebRequest.Create(uploadFileName);

            request.Method      = WebRequestMethods.Ftp.UploadFile;
            request.KeepAlive   = false;
            request.UseBinary   = true;
            request.UsePassive  = false;
            request.Credentials = new NetworkCredential(this.m_UserName, this.m_Password);


            byte[] fileContents = File.ReadAllBytes(localFileFullName);

            Stream requestStream = request.GetRequestStream();

            requestStream.Write(fileContents, 0, fileContents.Length);
            requestStream.Close();

            try
            {
                FtpWebResponse response = (FtpWebResponse)request.GetResponse();
                if (response.StatusDescription.Substring(0, 3) != "226")                 //Indicate Transfer Complete
                {
                    methodResult.Message = "FTP Upload failed for " + localFileFullName + ".";
                    methodResult.Success = false;
                }

                response.Close();
            }
            catch
            {
                methodResult.Message = "FTP Upload failed for " + localFileFullName + ".";
                methodResult.Success = false;
            }
            return(methodResult);
        }
Example #7
0
        public YellowstonePathology.Business.Rules.MethodResult SetFill()
        {
            YellowstonePathology.Business.Rules.MethodResult methodResult = new Rules.MethodResult();
            switch (this.m_SearchType.ToUpper())
            {
            case "PN":
                this.SetFillByPatientName();
                this.Fill();
                break;

            case "RN":
                this.SetFillByAccessionNo();
                this.Fill();
                break;

            case "BD":
                this.DateIsValid(methodResult);
                if (methodResult.Success == true)
                {
                    this.SetFillByBirthdate();
                    this.Fill();
                }
                break;

            case "SN":
                this.SetFillBySSN();
                this.Fill();
                break;

            case "PH":
                this.SetFillByPhysicianClientId();
                this.Fill();
                break;

            case "MA":
                this.SetFillByMasterAccessionNo();
                this.Fill();
                break;
            }
            return(methodResult);
        }
        public YellowstonePathology.Business.Rules.MethodResult IsOkToSetResults()
        {
            YellowstonePathology.Business.Rules.MethodResult result = new YellowstonePathology.Business.Rules.MethodResult();
            if (this.m_Accepted == true)
            {
                result.Success = false;
                result.Message = "Results may not be set because the results already have been accepted.";
            }
            else if (string.IsNullOrEmpty(this.m_ErResult) == true)
            {
                result.Success = false;
                result.Message = "Results may not be set because the ER Result has not been set.";
            }
            else if (string.IsNullOrEmpty(this.m_PrResult) == true)
            {
                result.Success = false;
                result.Message = "Results may not be set because the PR Result has not been set.";
            }

            return(result);
        }
Example #9
0
        public YellowstonePathology.Business.Rules.MethodResult CreateRemoteFolder(string folderName)
        {
            YellowstonePathology.Business.Rules.MethodResult methodResult = new Rules.MethodResult();
            methodResult.Success = true;

            string uploadFolderName = Path.Combine(this.m_RemotePath, folderName);

            uploadFolderName = uploadFolderName.Replace(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar);

            FtpWebRequest request = (FtpWebRequest)WebRequest.Create(uploadFolderName);

            request.Method      = WebRequestMethods.Ftp.MakeDirectory;
            request.KeepAlive   = false;
            request.UsePassive  = false;
            request.Credentials = new NetworkCredential(this.m_UserName, this.m_Password);

            FtpWebResponse response = null;

            try
            {
                response = (FtpWebResponse)request.GetResponse();
                if (response.StatusDescription.Substring(0, 3) != "257")                 //Indicate Creation Success
                {
                    methodResult.Message = "FTP Directory Creation failed for " + folderName + ".";
                    methodResult.Success = false;
                }

                response.Close();
            }
            catch
            {
                methodResult.Message = "FTP Directory Creation failed for " + folderName + ".";
                methodResult.Success = false;
            }
            return(methodResult);
        }
        public YellowstonePathology.Business.Rules.MethodResult IsOkToSetResults()
        {
            YellowstonePathology.Business.Rules.MethodResult result = new YellowstonePathology.Business.Rules.MethodResult();
            if (this.m_Accepted == true)
            {
                result.Success = false;
                result.Message = "Results may not be set because the results already have been accepted.";
            }
            else if (string.IsNullOrEmpty(this.m_ErResult) == true)
            {
                result.Success = false;
                result.Message = "Results may not be set because the ER Result has not been set.";
            }
            else if (string.IsNullOrEmpty(this.m_PrResult) == true)
            {
                result.Success = false;
                result.Message = "Results may not be set because the PR Result has not been set.";
            }

            return result;
        }
Example #11
0
        public YellowstonePathology.Business.Rules.MethodResult Upload(string localFileFullName)
        {
            YellowstonePathology.Business.Rules.MethodResult methodResult = new Rules.MethodResult();
            methodResult.Success = true;

            string fileName = Path.GetFileName(localFileFullName);
            string uploadFileName = Path.Combine(this.m_RemotePath, fileName);
            uploadFileName = uploadFileName.Replace(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar);

            FtpWebRequest request = (FtpWebRequest)WebRequest.Create(uploadFileName);
            request.Method = WebRequestMethods.Ftp.UploadFile;
            request.KeepAlive = false;
            request.UseBinary = true;
            request.UsePassive = false;
            request.Credentials = new NetworkCredential(this.m_UserName, this.m_Password);

            byte[] fileContents = File.ReadAllBytes(localFileFullName);

            Stream requestStream = request.GetRequestStream();
            requestStream.Write(fileContents, 0, fileContents.Length);
            requestStream.Close();

            try
            {
                FtpWebResponse response = (FtpWebResponse)request.GetResponse();
                if (response.StatusDescription.Substring(0, 3) != "226") //Indicate Transfer Complete
                {
                    methodResult.Message = "FTP Upload failed for " + localFileFullName + ".";
                    methodResult.Success = false;
                }

                response.Close();
            }
            catch
            {
                methodResult.Message = "FTP Upload failed for " + localFileFullName + ".";
                methodResult.Success = false;
            }
            return methodResult;
        }
Example #12
0
        public YellowstonePathology.Business.Rules.MethodResult ExecutePsftpScript(string host, string userName, string password)
        {
            YellowstonePathology.Business.Rules.MethodResult methodResult = new Rules.MethodResult();
            string arguments = host + " -l " + userName + " -pw " + password + " -b \"" + this.m_BatchFileName + "\" -batch";
            System.Diagnostics.ProcessStartInfo processStartInfo = new System.Diagnostics.ProcessStartInfo(this.m_FileToExecute, arguments);
            processStartInfo.RedirectStandardOutput = true;
            processStartInfo.UseShellExecute = false;
            processStartInfo.CreateNoWindow = true;

            System.Diagnostics.Process process = new System.Diagnostics.Process();
            process.StartInfo = processStartInfo;
            process.Start();
            string result = process.StandardOutput.ReadToEnd();
            methodResult.Message = result;
            return methodResult;
        }