예제 #1
0
        public int Invoke(Nomination.Domain.ScheduledQuantities.ScheduledQuantities obj)
        {
            //create the naesb transaction
            int id = _scheduledQuantityService.Create(obj, _settings.UserId);

            //get the naesb event
            var naesbEvent = _naesbEventGetService.Invoke("OSQ", obj.PartyIndentificaton.PipelineEntity, obj.PartyIndentificaton.UtilityEntity, obj.Cycle);

            //process the ScheduledQuantity
            _scheduledQuantityProcessService.Invoke(naesbEvent.Pipeline, naesbEvent.Utility, obj.GasDay, naesbEvent.Cycle);

            return(id);
        }
예제 #2
0
        public int Invoke(Nomination.Domain.ConfirmationResponse.ConfirmationResponse obj)
        {
            //create the naesb transaction
            int id = _confirmationResponseEventRepositoryService.Create(obj, _settings.UserId);

            //get the naesb event
            var naesbEvent = _naesbEventGetService.Invoke("CR", obj.PartyIndentificaton.PipelineEntity, obj.PartyIndentificaton.UtilityEntity, obj.Cycle);

            //process the ConfirmationResponse
            _confirmationResponseProcessService.Invoke(naesbEvent.Pipeline, naesbEvent.Utility, obj.GasDay, naesbEvent.Cycle);

            return(id);
        }
        public int Invoke(DateTime processStart, string fileName, Domain.RequestForConfirmation.RequestForConfirmation obj)
        {
            //map domain rfc model to the Naesb rfc model.
            NaesbRequestForConfirmation nrfc = _naesbRequestForConfirmationGetService.Invoke(obj);

            //serialize to xml
            XmlDocument domainXml = XmlTransformer.XmlSerialize(obj, true);
            //serialize Naesb NaesbRequestForConfirmation
            XmlDocument naesbXml = XmlTransformer.XmlSerialize(nrfc, true);

            //create naesb event process
            int eventProcessId = _naesbEventProcessCreateService.Invoke(
                new NaesbEventProcess
            {
                Type         = "RFC",
                GasDay       = obj.GasDay,
                Cycle        = obj.Cycle,
                Pipeline     = obj.PartyIndentificaton.PipelineEntity,
                Utility      = obj.PartyIndentificaton.UtilityEntity,
                ProcessStart = processStart,
                EdiFileName  = fileName,
                EdiData      = naesbXml.InnerXml,
                DomainData   = domainXml.InnerXml,
                UserId       = _settings.UserId
            }
                );

            //get the naesb event
            var naesbEvent = _naesbEventGetService.Invoke("RFC", obj.PartyIndentificaton.PipelineEntity, obj.PartyIndentificaton.UtilityEntity, obj.Cycle);

            if (naesbEvent != null && naesbEvent.On == true) //if null then the pipeline/utility/cycle doesn't exist in Pegasys
            {
                //save the domain rfc to the repository
                _requestForConfirmationEventCreateService.Invoke(obj);

                //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);
            }

            throw new NaesbError
                  {
                      ReasonCode = "101",
                      Value      = "Pipeline/Utility/Cycle naesb event not found."
                  };
        }
        private int CreateConfirmationResponse(DateTime processStart, string fileName, NaesbConfirmationResponse naesbObj, XmlDocument naesbXml)
        {
            //map NaesbConfirmationResponse to ConfirmationResponse
            Nomination.Domain.ConfirmationResponse.ConfirmationResponse cr = _confirmationResponseGetService.Invoke(naesbObj);

            //serialize to xml
            XmlDocument domainXml = CS.Common.Utilities.XmlTransformer.XmlSerialize(cr, true);

            //instantiate naesb event process
            NaesbEventProcess obj = new NaesbEventProcess
            {
                Type         = "CR",
                GasDay       = cr.GasDay,
                Cycle        = cr.Cycle,
                Pipeline     = cr.PartyIndentificaton.PipelineEntity,
                Utility      = cr.PartyIndentificaton.UtilityEntity,
                ProcessStart = processStart,
                EdiFileName  = fileName,
                EdiData      = naesbXml.InnerXml,
                DomainData   = domainXml.InnerXml,
                UserId       = _settings.UserId
            };

            //get the naesb event
            var naesbEvent = _naesbEventGetService.Invoke("CR", obj.Pipeline, obj.Utility, obj.Cycle);

            if (naesbEvent != null && naesbEvent.On == true) //if null then the pipeline/utility/cycle doesn't exist in Pegasys
            {
                //create naesb event process
                int eventProcessId = _naesbEventProcessCreateService.Invoke(obj);

                //create the ConfirmationResponse
                _confirmationResponseCreateService.Invoke(cr);

                //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);
            }

            throw new NaesbError
                  {
                      ReasonCode = "101",
                      Value      = "Pipeline/Utility/Cycle naesb event not found."
                  };
        }