Example #1
0
 public DocumentTransmitter(IImagesDal imagesDal, IVaulter vaulter, IXmitRequestDal xmitRequestDal, TransmitDestination transmitDestination = null)
 {
     this.imagesDal           = imagesDal;
     this.transmitDestination = transmitDestination;
     this.vaulter             = vaulter;
     this.xmitRequestDal      = xmitRequestDal;
 }
Example #2
0
        private void frmEditContractFax_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (!InboundSettings.IsProductionSystem && !isFormCancelled)
            {
                string[] destinations = teditFaxTelexNumber.Text.Split(';');

                foreach (string destin in destinations)
                {
                    var dest = new TransmitDestination(destin);
                    if (!dest.IsValidNonProdSendToAddress())
                    {
                        e.Cancel = true;
                        XtraMessageBox.Show("Please enter a valid Non-Production EMail Address or Fax Number.", "Non-Production Address Verification",
                                            MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
            }

            WriteUserSettings();
        }
Example #3
0
        private void frmEditContractFax_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (!InboundSettings.IsProductionSystem && !isFormCancelled)
            {
                string[] destinations = teditFaxTelexNumber.Text.Split(';');

                foreach (string destin in destinations)
                {
                    var dest = new TransmitDestination(destin);
                    if (!dest.IsValidNonProdSendToAddress())
                    {
                        e.Cancel = true;
                        XtraMessageBox.Show("Please enter a valid Non-Production EMail Address or Fax Number.", "Non-Production Address Verification",
                            MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
            }

            WriteUserSettings();
        }
Example #4
0
        private void DetermineTransmitDestination(AssociatedDoc assDoc)
        {
            if (transmitDestination.IsValid)
            {
                if (!InboundSettings.IsProductionSystem && !transmitDestination.IsValidNonProdSendToAddress())
                {
                    throw new Exception(String.Format(
                                            "Unable to send to '{0}' from a non-production system.", transmitDestination.Value) + Environment.NewLine +
                                        "Error CNF-423 in " + FORM_NAME + ".DetermineTransmitDestination().");
                }
                return;
            }

            using (var rqstForm = new frmAssignFaxNo())
            {
                rqstForm.SetFaxNumbers("", assDoc.XmitValue ?? "");
                rqstForm.SetIsAssociatedDoc(true);
                rqstForm.ShowDialog();
                transmitDestination = rqstForm.TransmitDestination;
            }
        }
Example #5
0
        private void SendToFaxGateway(string AFaxTelexInd, string AFaxTelexNumbers, string AConfirmLabel,
           byte[] AContractBody, DocumentFormat ADocFormat, string ARecipient, Int32 ATradeId, string ATradeSysTicket, Int32 ARqmtId, Int32 AConfirmId,
           bool ARtf, string AFromAddress, string ASubject, string AEmailBody, bool ACoverPage)
        {

            try
            {
                if (AFaxTelexNumbers != null)
                {
                    string[] AFaxTelexNumbersList = AFaxTelexNumbers.Split(';');

                    foreach (string AFaxTelexNumber in AFaxTelexNumbersList)
                    {
                        if (AContractBody == null)
                        {
                            XtraMessageBox.Show("Confirm Data was not found. Send/Resend was cancelled.",
                               "Confirm Not Found", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            return;
                        }

                        if (!InboundSettings.IsProductionSystem)
                        {
                            var destination = new TransmitDestination(AFaxTelexNumber);
                            if (!destination.IsValidNonProdSendToAddress())
                            {
                                XtraMessageBox.Show("Please enter a valid Non-Production EMail Address or Fax Number.", "Non-Production Address Verification",
                                    MessageBoxButtons.OK, MessageBoxIcon.Information);
                                return;
                            }
                        }

                        this.Cursor = Cursors.WaitCursor;
                        string faxTelexNumber = AFaxTelexNumber;

                        //5/21/09 Israel -- Create a new folder for each fax transmission.
                        string folderName = ATradeId.ToString() + "_" + String.Format("{0:yyMMddHHmmss}", DateTime.Now);
                        //string faxDir = tempFaxDir + folderName;
                        string faxDir = Path.Combine(tempFaxDir, folderName);
                        System.IO.Directory.CreateDirectory(faxDir);
                        faxDir += "\\";

                        string xmlFileNameOnly = "request.xml";
                        string xmlFileNameWithPath = faxDir + xmlFileNameOnly;
                        string rtfFileNameOnly = "Contract.rtf";
                        string rtfFileNameWithPath = faxDir + rtfFileNameOnly;
                        string pdfDocFileNameOnly = "Contract.pdf";
                        string pdfDocFileNameWithPath = faxDir + pdfDocFileNameOnly;

                        //Israel 9/3/2015 -- Replace PDFMetamorphosis with DevExpress RichEditControl
                        //SaveRtfAsPdfDoc(rtfFileNameWithPath, pdfDocFileNameWithPath);
                        WSUtils.SaveByteArrayAsPdfFile(AContractBody, ADocFormat, pdfDocFileNameWithPath);

                        //1/28/2015 Israel - Replaced DB name with system setting
                        //if (barStaticDBName.Caption.ToLower() != PROD_DB_NAME)

                        //Israel 10/26/15 Removed TestFaxNumber
                        //if (!Properties.Settings.Default.IsProductionSystem)
                        //    faxTelexNumber = Properties.Settings.Default.TestFaxNumber;

                        //PDF isn't handling E. European languages properly so send them as rtf.
                        string docFileName = pdfDocFileNameOnly;
                        string bookingCoSn = GetTradeSummaryData(ATradeId, "BookingCoSn");
                        string cdtyCode = GetTradeSummaryData(ATradeId, "CdtyCode");
                        //       bool isFreightDeal = (cdtyCode == "FRGHT");

                        string cptySn = GetTradeSummaryData(ATradeId, "CptySn");

                        //5/20/09 Israel - Handle RTF override parm
                        if (ARtf)
                            docFileName = rtfFileNameOnly;

                        string docFileNameWithPath = faxDir + docFileName;

                        TransmitDestinationType transDestType;
                        if (AFaxTelexNumber.Contains("@"))
                            transDestType = TransmitDestinationType.EMAIL;
                        else
                            transDestType = TransmitDestinationType.FAX;


                        IXmitRequestDal xmitRequestDal = new XmitRequestDal(sqlConnectionStr);
                        int xmitRequestId = xmitRequestDal.SaveTradeRqmtConfirmXmitRequest(AConfirmId, transDestType, AFaxTelexNumber, Utils.GetUserNameWithoutDomain(p_UserId));

                        string xmlText = GetFaxSubmitXML(ATradeId.ToString(),ATradeSysTicket, docFileName, AFaxTelexInd,
                           AFaxTelexNumber, ARecipient, ARqmtId.ToString(), AConfirmId.ToString(), AConfirmLabel,
                           ASubject, AEmailBody, ACoverPage, xmitRequestId.ToString());

                        System.IO.File.WriteAllText(xmlFileNameWithPath, xmlText);

                        string emailToAddress = Properties.Settings.Default.TransmissionGatewayEmailToAddress;
                        //string emailToAddress = "*****@*****.**";
                        //Israel 9/28/2015
                        //string emailFromAddress = toolbarOrWindowsUserId + "@" + Properties.Settings.Default.EMailDomain;

                        //Israel 10/26/15 -- Removed FaxGatewayEmailFromAddress
                        string emailFromAddress = ""; //Properties.Settings.Default.FaxGatewayEmailFromAddress;
                        if (AFromAddress.Length > 2)
                            emailFromAddress = AFromAddress;
                        else
                            emailFromAddress = emailToAddress;
                        string emailSubject = "Confirmation of Trade: " + ATradeSysTicket;
                        if (ASubject.Length > 2)
                            emailSubject = ASubject;

                        //Changed variable name for doc file.
                        SendEmail(emailFromAddress, emailToAddress, emailSubject, AEmailBody, xmlFileNameWithPath, docFileNameWithPath);

                        string faxDocRefCode = "";
                        string templateName = "**Template Name**";

                        //Log submission in case it becomes necessary to trace it
                        //Israel 11/13/2015 -- Removed as part of move to XmitRequest/XmitResult
                        //CallInsertToFaxLogSent(ATradeId, AFaxTelexInd, AFaxTelexNumber, faxDocRefCode);

                        if (AConfirmLabel == CONFIRM_LABEL_CONFIRM && ARqmtId > 0)
                        {
                            string reference = GetTradeRqmtData(ARqmtId, "Reference");
                            string cmt = GetTradeRqmtData(ARqmtId, "Cmt");
                            CallUpdateTradeRqmts(ATradeId, ARqmtId, SEMPRA_RQMT, "SENT", DateTime.Today, reference, cmt, true);
                        }
                        else if (AConfirmId > 0)
                        {
                            string confirmCmt = GetConfirmData(AConfirmId, "ConfirmCmt");
                            UpdateTradeRqmtConfirmRow(AConfirmId, ATradeId, Convert.ToInt32(ARqmtId),
                               templateName, AFaxTelexInd, AFaxTelexNumber, AConfirmLabel, confirmCmt, "SENT", "Y");
                        }

                        string trdSysCode = GetTradeSummaryData(ATradeId, "TrdSysCode");
                        if (trdSysCode.Length > 0)
                        {
                            trdSysCode = trdSysCode.Substring(0, 1);
                            //string cdtyGrpCode = GetTradeSummaryData(ATradeId, "CdtyGrpCode");
                            string sttlType = GetTradeSummaryData(ATradeId, "SttlType");

                            DateTime dtTradeDt = GetTradeSummaryDate(ATradeId, "TradeDt");
                            string strTradeDt = dtTradeDt.ToString("MM/dd/yyyy");
                            string strToday = DateTime.Today.ToString("MM/dd/yyyy");
                        }
                    }
                }
            }

            catch (Exception ex)
            {
                throw new Exception("An error occurred while attempting to send a document to the Transmission Gateway using the following values:" + Environment.NewLine +
                    "Transmission Method: " + AFaxTelexInd + ", Transmission Send-To Address: " + AFaxTelexNumbers + ", Document Format: " + ADocFormat.ToString() +
                        ", Recipient: " + ARecipient + Environment.NewLine +
                    "Trade Id: " + ATradeId.ToString() + "Rqmt Id: " + ARqmtId.ToString() + "Confirm Id: " + AConfirmId.ToString() + ", IsRtf?: " + ARtf + Environment.NewLine +
                    "From Address: " + AFromAddress + ", Subject: " + ASubject + ", EMail Body: " + AEmailBody + ", IncludeCoverPage?: " + ACoverPage + Environment.NewLine +
                     "Error CNF-145 in " + FORM_NAME + ".SendToFaxGateway([14 parms]): " + ex.Message);
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }