예제 #1
0
        /// <summary>
        /// Handles the actions for the current working file for encryption and transmission
        /// </summary>
        /// <param name="workingFile"></param>
        private void HandleMovedVendorFile(VendorLite vl, int _count)
        {
            var source             = vl.filePath;
            var file               = Path.GetFileName(source);
            var dest               = String.Format(@"{0}\{1}", Server.MapPath(vl.workingPath), file);
            var PublicKeyFileName  = Server.MapPath(vl.publicKeyPath);
            var PrivateKeyFileName = Server.MapPath(appvars.SignPrivateKey);
            var vt             = (VendorType)Enum.Parse(typeof(VendorType), vl.VendorName, true);
            var EncryptionFile = String.Format("{0}{1}", dest.Replace(Path.GetFileName(dest), ""), appvars.ReturnNewFileName(vt));

            //Get the user info from their session var...
            SetUserInformation();
            vl.UserID = this.CurrentUser.UserObject.LoginID.ToLower();

            if (!File.Exists(dest))
            {
                FileStream fs = File.Create(dest);
                fs.Close();
            }

            File.Copy(source, dest, true);

            PgpEncryptionKeys encryptionKeys = new PgpEncryptionKeys(PublicKeyFileName, PrivateKeyFileName, appvars.SignPassWord);
            PgpEncrypt        encrypter      = new PgpEncrypt(encryptionKeys);

            using (Stream outputStream = File.Create(EncryptionFile))
            {
                //build out the encypted file...
                encrypter.EncryptAndSign(outputStream, new FileInfo(dest));

                //Our file transfer class requires a fully qualified clean-up set...
                CleanUpFiles cuf = new CleanUpFiles();
                cuf.EncryptedFilePath  = EncryptionFile;
                cuf.TxtWorkingFilePath = dest;
                // we'll put in the script path later.... cuf.ClientScriptFilePath = "";
                //set the vL item's cleanupItems for the next routine..
                vl.cleanUpItems = cuf;
            }        //end using statement

            //construct the object and run it...
            FileTransfer fT = new FileTransfer(vl);

            fT.RunUpload();

            //File the report and store the files before clean-up...
            FileReport fr = new FileReport(vl);

            fr.SubmitReport();



            //clean up...
            FileCleanUp.CleanUpFileTransfer(vl.cleanUpItems);
        }    //handle the HandleMovedVendorFile
        /// <summary>
        /// Handles the actions for the current working file for encryption and transmission
        /// </summary>
        /// <param name="workingFile"></param>
        private void HandleMovedVendorFile(VendorLite vl, int _count)
        {
            string source = vl.filePath;
                string file = Path.GetFileName(source);
                string dest = String.Format(@"{0}\{1}", Server.MapPath(vl.workingPath), file);
                string PublicKeyFileName = Server.MapPath(vl.publicKeyPath);
                string PrivateKeyFileName = Server.MapPath(appvars.SignPrivateKey);
                VendorType vt = (VendorType)Enum.Parse(typeof(VendorType), vl.VendorName, true);
                string EncryptionFile = String.Format("{0}{1}", dest.Replace(Path.GetFileName(dest), ""), appvars.ReturnNewFileName(vt));

                //Get the user info from their session var...
                SetUserInformation();
                vl.UserID = this.CurrentUser.UserObject.LoginID.ToLower();

                if (!File.Exists(dest))
                {
                    FileStream fs = File.Create(dest);
                    fs.Close();
                }

                File.Copy(source, dest, true);

                PgpEncryptionKeys encryptionKeys = new PgpEncryptionKeys(PublicKeyFileName, PrivateKeyFileName, appvars.SignPassWord);
                PgpEncrypt encrypter = new PgpEncrypt(encryptionKeys);

                using (Stream outputStream = File.Create(EncryptionFile))
                {
                    //build out the encypted file...
                    encrypter.EncryptAndSign(outputStream, new FileInfo(dest));

                    //Our file transfer class requires a fully qualified clean-up set...
                    CleanUpFiles cuf = new CleanUpFiles();
                    cuf.EncryptedFilePath = EncryptionFile;
                    cuf.TxtWorkingFilePath = dest;
                    // we'll put in the script path later.... cuf.ClientScriptFilePath = "";
                    //set the vL item's cleanupItems for the next routine..
                    vl.cleanUpItems = cuf;
                }//end using statement

                //construct the object and run it...
                FileTransfer fT = new FileTransfer(vl);
                fT.RunUpload();

                //File the report and store the files before clean-up...
                FileReport fr = new FileReport(vl);
                fr.SubmitReport();

                //clean up...
                FileCleanUp.CleanUpFileTransfer(vl.cleanUpItems);
        }
예제 #3
0
 /// <summary>
 /// Our constructor requires a VendorLIte object for an obvious reason...
 /// We can't report with a transfer object....
 /// </summary>
 /// <param name="vl"></param>
 public FileReport(VendorLite vl)
 {
     this.VendorObject = vl;
     this.UserID = vl.UserID;
 }
예제 #4
0
 public FileTransfer(VendorLite vl)
 {
     this.VendorObject = vl;
 }