public void PutDocumentsDocumentIdTest()
 {
     // TODO: add unit test for the method 'PutDocumentsDocumentId'
     string documentId = null; // TODO: replace null with proper value
     FaxDocument body = null; // TODO: replace null with proper value
     var response = instance.PutDocumentsDocumentId(documentId, body);
     Assert.IsInstanceOf<FaxDocument> (response, "response is FaxDocument");
 }
Пример #2
0
        private void FaxDocumentSetup()
        {
            faxDoc                    = new FaxDocument();
            faxDoc.Priority           = FAX_PRIORITY_TYPE_ENUM.fptHIGH;
            faxDoc.ReceiptType        = FAX_RECEIPT_TYPE_ENUM.frtNONE;
            faxDoc.AttachFaxToReceipt = true;

            faxDoc.Sender.Name    = "Md. Faroque Hossain";
            faxDoc.Sender.Company = "Aprosoft, Bangladesh";
            faxDoc.Body           = @"E:\Aprosoft\WPF\Codes\FaxTest\FaxTest\TestPDFFilewithMultiPage.pdf";
            faxDoc.Subject        = "Send Test Fax from Windows";
            faxDoc.DocumentName   = "TestPDFFilewithMultiPage";
            faxDoc.Recipients.Add("12345678912", "TestReceipent-001");
        }
Пример #3
0
 public void SendFax()
 {
     try
     {
         FaxDocumentSetup();
         object submitReturnValue = faxDoc.Submit(faxServer.ServerName);
         faxDoc = null;
     }
     catch (System.Runtime.InteropServices.COMException comException)
     {
         Console.WriteLine("Error connecting to fax server. Error Message: " + comException.Message);
         Console.WriteLine("StackTrace: " + comException.StackTrace);
     }
 }
Пример #4
0
        private void FaxDocumentSetup()
        {
            faxDoc                    = new FaxDocument();
            faxDoc.Priority           = FAX_PRIORITY_TYPE_ENUM.fptHIGH;
            faxDoc.ReceiptType        = FAX_RECEIPT_TYPE_ENUM.frtNONE;
            faxDoc.AttachFaxToReceipt = true;

            faxDoc.Sender.Name    = "Md. Faroque Hossain";
            faxDoc.Sender.Company = "Aprosoft, Bangladesh";
            faxDoc.Body           = @"C:\Users\newlife2018\Desktop\SendFax.docx";
            faxDoc.Subject        = "Send Test Fax from Windows";
            faxDoc.DocumentName   = "TestDOCFilewithMultiPage";
            faxDoc.Recipients.Add("0524859018", "TestReceipent-001");
        }
Пример #5
0
        private void FaxDocumentSetup(string F_Name, string F_Company, string F_text, string Subject, string DocumentName, string faxnumber)
        {
            faxDoc                    = new FaxDocument();
            faxDoc.Priority           = FAX_PRIORITY_TYPE_ENUM.fptHIGH;
            faxDoc.ReceiptType        = FAX_RECEIPT_TYPE_ENUM.frtNONE;
            faxDoc.AttachFaxToReceipt = true;

            faxDoc.Sender.Name    = F_Name;
            faxDoc.Sender.Company = F_Company;
            faxDoc.Body           = F_text;
            faxDoc.Subject        = Subject;
            faxDoc.DocumentName   = DocumentName;
            faxDoc.Recipients.Add(faxnumber);
        }
 private void FaxDocumentSetup()
 {
     faxDoc                    = new FaxDocument();
     faxDoc.Priority           = FAX_PRIORITY_TYPE_ENUM.fptHIGH;
     faxDoc.ReceiptType        = FAX_RECEIPT_TYPE_ENUM.frtNONE;
     faxDoc.AttachFaxToReceipt = true;
     CheckFileIsNotInUse();
     faxDoc.Sender.Name    = FaxObj.SenderName;
     faxDoc.Sender.Company = FaxObj.SenderCompany;
     faxDoc.Body           = FaxObj.FaxBodyPath;
     faxDoc.Subject        = FaxObj.FaxSubject;
     faxDoc.DocumentName   = FaxObj.FaxDocumentName;
     faxDoc.Recipients.Add(FaxObj.RecipientFaxNumber, FaxObj.RecipientName);
 }
Пример #7
0
 public void SendFax()
 {
     try
     {
         FaxDocumentSetup("Tuan", "THCOMPANY", txt_file.Text, "Send Test Fax from Windows", "Test file", txt_faxnum.Text);
         object submitReturnValue = faxDoc.Submit(faxServer.ServerName);
         faxDoc        = null;
         rtd_log.Text += "Activity:   " + faxServer.Activity + Environment.NewLine + "Configuration:   " + faxServer.Configuration + Environment.NewLine
                         + "CurrentAccount:   " + faxServer.CurrentAccount + Environment.NewLine
                         + "FaxAccountSet:   " + faxServer.FaxAccountSet + Environment.NewLine
                         + "GetDeviceProviders:   " + faxServer.GetDeviceProviders().Count + Environment.NewLine
                         + "GetDevices:   " + faxServer.GetDevices().Count + Environment.NewLine
                         + "LoggingOptions.ActivityLogging:   " + faxServer.LoggingOptions.ActivityLogging + Environment.NewLine
                         + "LoggingOptions.ActivityLogging:   " + faxServer.ServerName + Environment.NewLine
                         + faxServer.Activity.IncomingMessages.ToString()
                         + " \n" + faxServer.Activity.OutgoingMessages.ToString()
                         + " \n" + faxServer.Activity.QueuedMessages.ToString()
                         + " \n" + faxServer.Activity.RoutingMessages.ToString();
     }
     catch (Exception comException)
     {
         MessageBox.Show("Data: " + comException.Data + "\n" + "HelpLink: " + comException.HelpLink + "\n" + "HResult: " + comException.HResult + "\n" + "InnerException: " + comException.InnerException + "\n" + "Message: " + comException.Message + "\n" + "Source: " + comException.Source + "\n" + "StackTrace: " + comException.StackTrace + "\n" + "TargetSite: " + comException.TargetSite);
     }
 }
        public void Fax(Public.Faxing.FaxServerConfiguration forFaxServerConfiguration, FaxSender forSender, FaxRecipient forRecipient, FaxDocument forDocument, Dictionary <String, String> extendedProperties)
        {
            faxServerConfiguration = forFaxServerConfiguration;

            sender = forSender;

            recipient = forRecipient;

            document = forDocument;


            String controlFileName = document.UniqueId + ".xml";

            String attachmentFileName = document.UniqueId + "." + document.Attachment.Extension;

            String statusFileName = controlFileName + ".status";


            System.Diagnostics.Debug.WriteLine("Source ID:" + document.UniqueId);


            // CREATE FAX CONTROL FILE


            System.Xml.XmlDocument controlDocument = new System.Xml.XmlDocument();

            System.Xml.XmlDeclaration xmlDeclaration = controlDocument.CreateXmlDeclaration("1.0", "utf-8", String.Empty);

            System.Xml.XmlElement controlElementNode = controlDocument.CreateElement("faxmakerdata");

            System.Xml.XmlElement fieldsElementNode = controlDocument.CreateElement("fields");

            System.Xml.XmlElement senderElementNode = controlDocument.CreateElement("sender");

            System.Xml.XmlElement recipientsElementNode = controlDocument.CreateElement("recipients");

            System.Xml.XmlElement recipientsFaxElementNode = controlDocument.CreateElement("fax");

            System.Xml.XmlElement recipientElementNode = controlDocument.CreateElement("recipient");


            #region Initialize Document Structure

            controlDocument.InsertBefore(xmlDeclaration, controlDocument.DocumentElement);

            controlDocument.AppendChild(controlElementNode);

            controlElementNode.AppendChild(fieldsElementNode);

            controlElementNode.AppendChild(senderElementNode);

            controlElementNode.AppendChild(recipientsElementNode);

            recipientsElementNode.AppendChild(recipientsFaxElementNode);

            recipientsFaxElementNode.AppendChild(recipientElementNode);


            // FAXMAKERDATA

            // +-- FIELDS

            // +-- SENDER

            // +-- RECIPIENTS

            // +-- +-- FAX

            // +-- +-- +-- RECIPIENT

            #endregion


            #region Sender Node

            if (!String.IsNullOrWhiteSpace(sender.Name))
            {
                Mercury.Server.Public.CommonFunctions.XmlDocumentAppendNode(controlDocument, senderElementNode, "lastname", sender.Name);
            }

            if (!String.IsNullOrWhiteSpace(sender.Company))
            {
                Mercury.Server.Public.CommonFunctions.XmlDocumentAppendNode(controlDocument, senderElementNode, "company", sender.Company);
            }

            if (!String.IsNullOrWhiteSpace(sender.Department))
            {
                Mercury.Server.Public.CommonFunctions.XmlDocumentAppendNode(controlDocument, senderElementNode, "department", sender.Department);
            }

            if (!String.IsNullOrWhiteSpace(sender.FaxNumber))
            {
                Mercury.Server.Public.CommonFunctions.XmlDocumentAppendNode(controlDocument, senderElementNode, "faxnumber", sender.FaxNumber);
            }

            if (!String.IsNullOrWhiteSpace(sender.VoiceNumber))
            {
                Mercury.Server.Public.CommonFunctions.XmlDocumentAppendNode(controlDocument, senderElementNode, "voicenumber", sender.VoiceNumber);
            }

            // if (!String.IsNullOrWhiteSpace (sender.Email)) { Mercury.Server.Public.CommonFunctions.XmlDocumentAppendNode (controlDocument, senderElementNode, "emailaddress", sender.Email); }

            Mercury.Server.Public.CommonFunctions.XmlDocumentAppendNode(controlDocument, senderElementNode, "emailaddress", sender.Email);

            #endregion


            #region Recipient Node

            String faxNumber = recipient.FaxNumber;

            faxNumber = (faxNumber.Length == 7) ? faxNumber.Substring(0, 3) + "-" + faxNumber.Substring(3, 4) : faxNumber;

            faxNumber = (faxNumber.Length == 10) ? "1-" + faxNumber.Substring(0, 3) + "-" + faxNumber.Substring(3, 3) + "-" + faxNumber.Substring(6, 4) : faxNumber;



            if (!String.IsNullOrWhiteSpace(recipient.RecipientName))
            {
                Mercury.Server.Public.CommonFunctions.XmlDocumentAppendNode(controlDocument, recipientElementNode, "lastname", recipient.RecipientName);
            }

            if (!String.IsNullOrWhiteSpace(recipient.CompanyName))
            {
                Mercury.Server.Public.CommonFunctions.XmlDocumentAppendNode(controlDocument, recipientElementNode, "company", recipient.CompanyName);
            }

            if (!String.IsNullOrWhiteSpace(recipient.DepartmentName))
            {
                Mercury.Server.Public.CommonFunctions.XmlDocumentAppendNode(controlDocument, recipientElementNode, "department", recipient.DepartmentName);
            }

            Mercury.Server.Public.CommonFunctions.XmlDocumentAppendNode(controlDocument, recipientElementNode, "faxnumber", faxNumber);

            if (!String.IsNullOrWhiteSpace(recipient.RecipientEmail))
            {
                Mercury.Server.Public.CommonFunctions.XmlDocumentAppendNode(controlDocument, recipientElementNode, "emaladdress", recipient.RecipientEmail);
            }

            #endregion


            #region Fields Node

            if (!String.IsNullOrWhiteSpace(document.Subject))
            {
                Mercury.Server.Public.CommonFunctions.XmlDocumentAppendNode(controlDocument, fieldsElementNode, "subject", document.Subject);
            }

            Mercury.Server.Public.CommonFunctions.XmlDocumentAppendNode(controlDocument, fieldsElementNode, "resolution", "high");

            Mercury.Server.Public.CommonFunctions.XmlDocumentAppendNode(controlDocument, fieldsElementNode, "attachment", attachmentFileName);

            Mercury.Server.Public.CommonFunctions.XmlDocumentAppendNode(controlDocument, fieldsElementNode, "uid", document.UniqueId);

            #endregion


            attachmentFileName = faxServerConfiguration.FaxUrl + @"\" + attachmentFileName;

            attachmentFileName = attachmentFileName.Replace(@"\\" + attachmentFileName, @"\" + attachmentFileName);


            System.IO.FileStream attachmentFile = new System.IO.FileStream(attachmentFileName, System.IO.FileMode.Create);

            document.Attachment.Image.Seek(0, System.IO.SeekOrigin.Begin);

            document.Attachment.Image.WriteTo(attachmentFile);

            attachmentFile.Flush();

            attachmentFile.Close();


            controlFileName = faxServerConfiguration.FaxUrl + @"\" + controlFileName;

            controlFileName = controlFileName.Replace(@"\\" + controlFileName, @"\" + controlFileName);

            controlDocument.Save(controlFileName);


            statusWatchStartTime = DateTime.Now;

            statusWatcher = new System.IO.FileSystemWatcher();

            statusWatcher.Filter = "*.status";

            statusWatcher.Created += new System.IO.FileSystemEventHandler(StatusWatcher_OnFileCreated);

            statusWatcher.Path = faxServerConfiguration.FaxUrl;

            statusWatcher.EnableRaisingEvents = true;


            return;
        }
 public void Init()
 {
     instance = new FaxDocument();
 }