//public int Invoke(DateTime processStart, DateTime gasDay, string cycle, string fileName, NaesbQuickResponse nqr)
        //{
        ////serialize Naesb NaesbRequestForConfirmation
        //XmlDocument naesbXml = XmlTransformer.XmlSerialize(nqr, true);

        ////create naesb event process
        //int eventProcessId = _naesbEventProcessCreateService.Invoke(
        //    new NaesbEventProcess
        //    {
        //        Type = "QR",
        //        GasDay = gasDay,
        //        Cycle = cycle,
        //        Pipeline = _naesbPipelineGetService.Invoke(nqr.PartyIndentificaton.ConfirmingPartyDuns).Pipeline,
        //        Utility = _naesbUtilityGetService.Invoke(nqr.PartyIndentificaton.UtilityDunsNumber).Utility,
        //        ProcessStart = processStart,
        //        EdiFileName = fileName,
        //        EdiData = naesbXml.InnerXml,
        //        DomainData = null,
        //        UserId = _settings.UserId
        //    }
        //);

        ////TODO: maybe make this use its own class instead of generic -> NaesbEventProcessCompletion
        ////update ProcessEnd timestamp
        //_naesbEventProcessUpdateService.Invoke(eventProcessId, new KeyValuePair<string, DateTime>("ProcessEnd", DateTime.Now));

        //return eventProcessId;
        //}

        public int Invoke(DateTime processStart, string fileName, Domain.ConfirmationResponse.ConfirmationResponse cr)
        {
            //transform ConfirmationResponse
            NaesbQuickResponse nqr = _naesbQuickResponseGetService.Invoke(cr);

            //serialize Naesb NaesbRequestForConfirmation
            XmlDocument naesbXml = XmlTransformer.XmlSerialize(nqr, true);

            //create naesb event process
            int eventProcessId = _naesbEventProcessCreateService.Invoke(
                new NaesbEventProcess
            {
                Type         = "QR",
                GasDay       = cr.GasDay,
                Cycle        = cr.Cycle,
                Pipeline     = cr.PartyIndentificaton.PipelineEntity,
                Utility      = cr.PartyIndentificaton.UtilityEntity,
                ProcessStart = processStart,
                EdiFileName  = fileName,
                EdiData      = naesbXml.InnerXml,
                DomainData   = null,    // there is no business QuickResponse
                UserId       = _settings.UserId
            }
                );

            //TODO: maybe make this use its own class instead of generic -> NaesbEventProcessCompletion
            //update ProcessEnd timestamp
            _naesbEventProcessUpdateService.Invoke(eventProcessId, new KeyValuePair <string, DateTime>("ProcessEnd", DateTime.Now));

            return(eventProcessId);
        }
Esempio n. 2
0
        public Domain.QuickResponse.Naesb.Header GetNaesbQuickResponseHeader(Domain.ConfirmationResponse.ConfirmationResponse obj)
        {
            string pipeline = obj.PartyIndentificaton.PipelineEntity;
            string utility  = obj.PartyIndentificaton.UtilityEntity;

            string partnerId = string.Empty;

            if (pipeline.ToUpper() == "NGPL" && utility.ToUpper() == "PGL")
            {
                partnerId = "PGL_NGPCrQr";
            }
            if (pipeline.ToUpper() == "NGPL" && utility.ToUpper() == "NSG")
            {
                partnerId = "NSG_NGPCrQr";
            }

            return(new Domain.QuickResponse.Naesb.Header
            {
                PartnerId = partnerId,
                Standard = "X",
                Version = "006010",
                TransactionSet = "874",
                EnvironmentFlag = "T"
            });
        }
        public Domain.ConfirmationResponse.ConfirmationResponse Invoke(FileInfo file)
        {
            //deserialize GENTRAN EDI translated .xml file into Naesb EDI XmlDocument
            XmlDocument ediXml = CS.Common.Utilities.XmlTransformer.ConvertToXmlDocument(file, true);
            //deserialize XmlDocument into NaesbConfirmationResponse naesbObj
            NaesbConfirmationResponse naesbObj = CS.Common.Utilities.XmlTransformer.XmlDeserialize <NaesbConfirmationResponse>(ediXml.InnerXml);

            //map NaesbConfirmationResponse to ConfirmationResponse
            Domain.ConfirmationResponse.ConfirmationResponse cr = Map(CheckMissingCycle(new Common.ModelFactory().Map(naesbObj)));

            return(cr);
        }
        public NaesbQuickResponse Invoke(Domain.ConfirmationResponse.ConfirmationResponse confirmationResponse)
        {
            NaesbQuickResponse nqr = new NaesbQuickResponse();

            nqr.Header = _naesbQuickResponseHeaderGetService.Invoke(confirmationResponse);
            nqr.PurchaseOrderNumber = confirmationResponse.PurchaseOrderNumber;
            nqr.PurposeCode         = "27";
            nqr.PartyIndentificaton = new PartyIndentificaton();
            nqr.PartyIndentificaton.ConfirmingPartyDuns = _naesbPipelineGetByPipelineService.Invoke(confirmationResponse.PartyIndentificaton.PipelineEntity)?.PipelineEntityId;
            nqr.PartyIndentificaton.UtilityDunsNumber   = _naesbUtilityGetByUtilityService.Invoke(confirmationResponse.PartyIndentificaton.UtilityEntity)?.UtilityEntityId;

            return(nqr);
        }
 public Header Invoke(Domain.ConfirmationResponse.ConfirmationResponse obj)
 {
     return(_repository.GetNaesbQuickResponseHeader(obj));
 }