コード例 #1
0
        /// <summary>
        /// Process one file for the current EDI Partner
        /// move data from file to database
        /// depending on result move it to save- or error-directory
        /// if no directory specified just remove the file
        /// </summary>
        /// <param name="partner">Partner that sent the file</param>
        /// <param name="filename">Contents of file</param>
        private void ProcessOneFile(EdiPartner partner, String filename)
        {
            // move data from file to database
            string targetDir = partner.ReceiveDirectorySave;

            if (!TreatFile(filename))
            {
                targetDir = partner.ReceiveDirectoryError;
            }

            // if target directory is set, move file otherwise delete it
            if (string.IsNullOrEmpty(targetDir))
            {
                File.Delete(filename);
            }
            else
            {
                string newFile = Path.Combine(targetDir, Path.GetFileName(filename));

                if (File.Exists(newFile))
                {
                    File.Delete(newFile);
                }

                File.Move(filename, newFile);
            }
        }
コード例 #2
0
 /**
  * check if all receive directories are defined and exist
  *		RCVDIR has to be defined and exist
  *		RCVDIRSAV has to exist if it is defined, or not be defined
  *		RCVDIRERR has to exist if it is defined, or not be defined
  */
 public static bool ReceiptDirectoriesOk(EdiPartner partner)
 {
     return(
         (!string.IsNullOrEmpty(partner.ReceiveDirectory) && Directory.Exists(partner.ReceiveDirectory)) &&
         (string.IsNullOrEmpty(partner.ReceiveDirectorySave) || Directory.Exists(partner.ReceiveDirectorySave)) &&
         (string.IsNullOrEmpty(partner.ReceiveDirectoryError) || Directory.Exists(partner.ReceiveDirectoryError)
         )
         );
 }
コード例 #3
0
        public bool Equals(EdiPartner otherPartner)
        {
            // If parameter is null return false:
            if ((object)otherPartner == null)
            {
                return(false);
            }

            return
                (
                (otherPartner.Id == Id) &&
                (otherPartner.Name == Name) &&
                (otherPartner.MessageFrom == MessageFrom) &&
                (otherPartner.MessageId == MessageId) &&
                (otherPartner.MessagePassword == MessagePassword) &&
                (otherPartner.MessageTo == MessageTo) &&
                (otherPartner.MessageTest == MessageTest) &&
                (otherPartner.MessageVersion == MessageVersion) &&
                (otherPartner.ReceiveDirectory == ReceiveDirectory) &&
                (otherPartner.ReceiveDirectoryError == ReceiveDirectoryError) &&
                (otherPartner.ReceiveDirectorySave == ReceiveDirectorySave) &&
                (otherPartner.SendDirectory == SendDirectory)
                );
        }