示例#1
0
 public static AssociatedDocsDto CreateAssociatedDocsDto(AssociatedDoc assDoc)
 {
     var assocDocsData = new AssociatedDocsDto();
     assocDocsData.BrokerSn = assDoc.BrokerShortName;
     assocDocsData.CdtyGroupCode = assDoc.CdtyGroupCode;
     assocDocsData.CptySn = assDoc.CptyShortName;
     assocDocsData.FileName = assDoc.FileName;
     assocDocsData.Id = assDoc.Id;
     assocDocsData.InboundDocsId = assDoc.InboundDocsId;
     assocDocsData.IndexVal = Convert.ToInt16(assDoc.IndexVal);
     assocDocsData.TradeRqmtId = assDoc.TradeRqmtId;
     assocDocsData.TradeId = assDoc.TradeId;
     assocDocsData.DocTypeCode = assDoc.DocTypeCode; 
     assocDocsData.SecValidateReqFlag = assDoc.SecondValidateReqFlag;
     return assocDocsData;
 }
示例#2
0
        private void CopyDataToBeUpdated()
        {
            sumDataCacheCopy.Clear();
            rqmtDataCacheCopy.Clear();
            assDocDataCacheCopy.Clear();
            inbDocViewCacheCopy.Clear();
            tradeRqmtConfirmCacheCopy.Clear();
            
            foreach (SummaryData data in sumDataCache)
            {
                SummaryData copyData = new SummaryData();
                copyData = data;
                sumDataCacheCopy.Add(copyData);
            }

            foreach (RqmtData data in rqmtDataCache)
            {
                RqmtData copyData = new RqmtData();
                copyData = data;
                rqmtDataCacheCopy.Add(copyData);
            }

            foreach (AssociatedDoc data in assDocDataCache)
            {
                AssociatedDoc copyData = new AssociatedDoc();
                copyData = data;
                assDocDataCacheCopy.Add(copyData);
            }

            foreach (InboundDocsView data in inbDocViewCache)
            {
                InboundDocsView copyData = new InboundDocsView();
                copyData = data;
                inbDocViewCacheCopy.Add(copyData);
            }

            foreach (TradeRqmtConfirm data in tradeRqmtConfirmCache)
            {
                TradeRqmtConfirm copyData = new TradeRqmtConfirm();
                copyData = data;
                tradeRqmtConfirmCacheCopy.Add(copyData);
            }
        }
示例#3
0
 internal static void ApplyAssoicatedDocChangeToView(AssociatedDoc assDoc)
 {
     DataTable table = InboundPnl.AssociatedDocsTable;
     DataRow drFind = table.Rows.Find(assDoc.Id);
     if (drFind == null)
     {
         DataRow dr = table.NewRow();
         dr = CollectionHelper.CreateDataRowFromObject<AssociatedDoc>(assDoc, dr);
         table.Rows.Add(dr);
     }
     else
     {
         CollectionHelper.UpdateDataRowFromObject<AssociatedDoc>(assDoc,ref drFind);
     }
 }
示例#4
0
 private void SelectAssociatedDoc(AssociatedDoc doc)
 {
     var col = gridViewMatchedDocuments.Columns["Id"];
     var rowHandle = gridViewMatchedDocuments.LocateByValue(0, col, doc.Id);
     if (rowHandle != GridControl.InvalidRowHandle)
     {
         gridViewMatchedDocuments.SelectRow(rowHandle);
     }
 }
示例#5
0
        private void UpdateViewWithTransmitInformation(AssociatedDoc doc, DocumentTransmitter transmitter)
        {
            if (transmitter.UserCanceled)
            {
                return;
            }

            doc.XmitValue = transmitter.TransmitDestination.Value;
            doc.XmitStatusCode = "Queued";

            ApplyAssoicatedDocChangeToView(doc);
        }
示例#6
0
        public void TransmitDocument(AssociatedDoc assDoc)
        {                        
            try
            {
                var doc = assDoc ?? GetActiveAssDoc();
                if (doc == null)
                {
                    XtraMessageBox.Show("Error CNF-506 in " + FORM_NAME + ".TransmitDocument: Unable to generate Active Associated Document.");
                    return;
                }

                var sumData = GetTradeSummaryDataRec(doc.TradeId);
                var transmitter = new DocumentTransmitter(mImagesDal, vaulter, xmitRequestDal, TransmitDestination);
                transmitter.SendToGateway(doc, sumData);
                UpdateViewWithTransmitInformation(doc, transmitter);
            }
            catch (Exception ex)
            {
                LogAndDisplayException("An error occurred while transmitting the document." + Environment.NewLine +
                     "Error CNF-463 in " + FORM_NAME + ".TransmitDocument().", ex);
            }
        }
示例#7
0
        private void DisplayImageForAssociatedDoc(AssociatedDoc assDoc)
        {
            if (assDoc == null)
            {
                ImagesEventManager.Instance.Raise(new ImagesSelectedEventArgs(null, false));
                return;
            }

            var imageDto = mImagesDal.GetByDocId(assDoc.Id, ImagesDtoType.Associated);
            if (imageDto == null)
            {
                Logger.WarnFormat("Attempt to display non-existant image for associated doc with id = {0}", assDoc.Id);
            }
            ImagesEventManager.Instance.Raise(new ImagesSelectedEventArgs(imageDto, (imageDto != null)));
        }
示例#8
0
        private void ValidateAssociation(AssociatedDoc assDoc, bool isBeingUnAssociated)
        {
            if (!isBeingUnAssociated)
            {
                var currentSelected = ImagesEventManager.Instance.CurrentSelected;
                if (currentSelected == null)
                {
                    throw new Exception("No document is currently selected." + Environment.NewLine +
                         "Error CNF-450 in " + FORM_NAME + ".ValidateAssociation().");
                }

                if (currentSelected.Type != ImagesDtoType.Associated &&
                    currentSelected.DocsId != assDoc.Id)
                {
                    throw new Exception("Display document does not match current document selected.  Please reload selected document." + Environment.NewLine +
                         "Error CNF-451 in " + FORM_NAME + ".ValidateAssociation().");
                }
            }

            if (gridViewMatchedDocuments.GetSelectedRows().Length > 1)
            {
                throw new Exception("Cannot perform this operation on multiple documents." + Environment.NewLine +
                     "Error CNF-452 in " + FORM_NAME + ".ValidateAssociation().");
            }

            if ((!gridViewMatchedDocuments.IsValidRowHandle(gridViewMatchedDocuments.FocusedRowHandle)) ||
                assDoc == null)
            {
                throw new Exception("No Associated Document is currently selected." + Environment.NewLine +
                     "Error CNF-453 in " + FORM_NAME + ".ValidateAssociation().");
            }


            if (assDoc.DocStatusCode.Equals(AssociatedDoc.ASSOCIATED)) // this is an Auto-Match user Confirmation
            {
                if (!isBeingUnAssociated)
                {
                    if (assDoc.TradeId != ActiveTradeRqmt.TradeId)
                        // we can't use rqmt id here, because its auto associated..no rqmt id is know right now, so just verify the trade id is correct.
                    {
                        var result =
                            XtraMessageBox.Show(
                                "Currently selected trade does not match the auto matched trade ID.  Do you wish to break the current match and re-assign the current document?",
                                "Re-Assign Document",
                                MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
                        if (result == DialogResult.No)
                        {
                            throw new Exception("Auto Matched Trade Id: " + assDoc.TradeId +
                                                               " Does not match currently selected Trade Id: " +
                                                               ActiveTradeRqmt.TradeId + Environment.NewLine +
                                 "Error CNF-454 in " + FORM_NAME + ".ValidateAssociation().");
                        }
                        assDoc.TradeId = ActiveTradeRqmt.TradeId;
                    }
                    if (ActiveTradeRqmt.FinalApprovalFlag.Equals("Y"))
                    {
                        throw new Exception("Please re-open Trade Id: " + assDoc.TradeId +
                                            ". No changes are allowed to a Final Approved Trade / Document." + Environment.NewLine +
                             "Error CNF-455 in " + FORM_NAME + ".ValidateAssociation().");
                    }
                }
            }

            if (assDoc.TradeRqmtId != 0)
            {
                if ((assDoc.TradeRqmtId != ActiveTradeRqmt.Id) || (ActiveTradeRqmt == null))
                {
                    throw new Exception("Currently selected trade rqmt ID " + ActiveTradeRqmt.Id +
                                        " does not match with Inbound Document: " + assDoc.TradeRqmtId + Environment.NewLine +
                        "Error CNF-456 in " + FORM_NAME + ".ValidateAssociation().");
                }
                var sumData = GetTradeSummaryDataRec(assDoc.TradeId);
                if (sumData.FinalApprovalFlag.Equals("Y"))
                {
                    throw new Exception("Please re-open Trade Id: " + assDoc.TradeId +
                                        ". No changes are allowed to a Final Approved Trade / Document." + Environment.NewLine +
                         "Error CNF-457 in " + FORM_NAME + ".ValidateAssociation().");
                }
            }
        }
示例#9
0
 private static void ApplyAssoicatedDocRemoveToView(AssociatedDoc assDoc)
 {
     DataTable table = InboundPnl.AssociatedDocsTable;
     DataRow drFind = table.Rows.Find(assDoc.Id);
     if (drFind != null)
     {
         drFind.Delete();                                
     }
 }
示例#10
0
        public void TransmitDocument(SummaryData sumData, AssociatedDoc assDoc)
        {            
            string pageList = null;
            string fileName = null;            

            try
            {
                if (assDoc == null)
                {
                    throw new NotSupportedException("Error CNF-523: Unable to transmit without an associated document data.");
                }

                if (sumData == null)
                {
                    throw new NotSupportedException("Error CNF-524: Unable to transmit a document without trade summary data.");
                }

                var transmitter = new DocumentTransmitter(imagesDal, vaulter, xmitRequestDal);
                transmitter.SendToGateway(assDoc, sumData);                
            }
            catch (Exception ex)
            {
                LogAndDisplayException("An error occurred while transmitting the document." + Environment.NewLine +
                       "Error CNF-525 in " + FORM_NAME + ".TransmitDocument(): ", ex);
            }            
        }
示例#11
0
        private void SetDocIndexValue(ref AssociatedDoc assDoc)
        {            
            AssociatedDocsDal assocDocsDal = new AssociatedDocsDal(sqlConnectionString);
            int inboundDocsId = Convert.ToInt32(assDoc.InboundDocsId);
            int indexVal = assocDocsDal.GetCurrentIndexValue(inboundDocsId);

            if (indexVal >= 0)
            {
                assDoc.IndexVal = indexVal + 1;
            }
            else
            {
                throw new Exception("An error occurred while setting the document index value." + Environment.NewLine +
                        "Error CNF-513 in " + FORM_NAME + ".SetDocIndexValue().");
            }            
        }
示例#12
0
        private AssociatedDoc CreateAssociatedDoc(InboundDocsView inbDocView, RqmtData activeTradeRqmt,
            SummaryData activeSummaryData)
        {
            var assDoc = new AssociatedDoc();
            assDoc.AssociatedBy = p_UserId;
            assDoc.InboundDocsId = inbDocView.Id;
            assDoc.MultipleAssociatedDocs = false;
            assDoc.SecondValidateReqFlag = activeTradeRqmt.SecondCheckFlag ?? "N";
            assDoc.TradeId = activeTradeRqmt.TradeId;
            assDoc.TradeRqmtId = activeTradeRqmt.Id;
            assDoc.TradeId = activeTradeRqmt.TradeId;

            //Israel 12/02/2015 -- Changed rqmt code to readable display
            //assDoc.DocTypeCode = activeTradeRqmt.Rqmt;
            assDoc.DocTypeCode = activeTradeRqmt.DisplayText;

            // Trade Summary Data..
            assDoc.CptyShortName = activeSummaryData.CptySn;
            assDoc.BrokerShortName = activeSummaryData.BrokerSn;
            assDoc.CdtyGroupCode = activeSummaryData.CdtyGrpCode;
            assDoc.SetDocStatus();
            SetDocIndexValue(ref assDoc);
            assDoc.FileName = inbDocView.FileName;
            return assDoc;
        }