///////////////////////////////////////////////////
        /// ConfirmationResponse
        ///////////////////////////////////////////////////
        public tb_naesb_transaction_master Map(Nomination.Domain.ConfirmationResponse.ConfirmationResponse obj)
        {
            if (obj != null)
            {
                return(new tb_naesb_transaction_master
                {
                    FileType = "CR",
                    //PipelineCd = new NaesbPipelineRepository().GetByPipelineEntityID(obj.PartyIndentificaton.PipelineEntityId)?.Pipeline,
                    //CompanyCd = new NaesbUtilityRepository().GetByUtilityEntityId(obj.PartyIndentificaton.UtilityEntityId)?.Utility,
                    PipelineCd = obj.PartyIndentificaton.PipelineEntity,
                    CompanyCd = obj.PartyIndentificaton.UtilityEntity,
                    GasDay = obj.GasDay,
                    CycleCd = obj.Cycle,
                    ConfirmingEntityId = obj.PartyIndentificaton.PipelineEntity,
                    UtilityEntityId = obj.PartyIndentificaton.UtilityEntity,
                    TransportationId = obj.PurchaseOrderNumber,
                    NomCycleStart = DateTime.ParseExact(obj.GasDayStart, "yyyyMMddHHmm", null),
                    NomcycleEnd = DateTime.ParseExact(obj.GasDayEnd, "yyyyMMddHHmm", null),
                    TransactionTime = DateTime.Now,
                    row_lst_upd_userid = UserId,
                    tb_naesb_transaction_detail = Map(obj.Locations)
                });
            }

            return(null);
        }
Exemple #2
0
        public int Create(Nomination.Domain.ConfirmationResponse.ConfirmationResponse obj, string userId)
        {
            //map domain to enitity framework
            tb_naesb_transaction_master entity = new ModelFactory(userId).Map(obj);

            //insert to database
            base.Add(entity);

            return(Convert.ToInt32(entity.TransMasterId));

            //call the stored proc to process
            //ProcessConfirmationResponse();
        }
Exemple #3
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);
        }
        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."
                  };
        }
Exemple #5
0
        ///////////////////////////////////////////////////
        /// ConfirmationResponse
        ///////////////////////////////////////////////////
        public Nomination.Domain.ConfirmationResponse.ConfirmationResponse Map(Nomination.Domain.ConfirmationResponse.Naesb.NaesbConfirmationResponse obj)
        {
            if (obj != null)
            {
                //all NominationDetails with criteria -- WORKING!!
                List <ConfirmationResponseLocationContractNomination> locationContractNominations = ReMap(obj);

                Nomination.Domain.ConfirmationResponse.ConfirmationResponse item =
                    new Nomination.Domain.ConfirmationResponse.ConfirmationResponse
                {
                    PurchaseOrderNumber = obj.Header.TransactionIdentifier,
                    GasDayStart         = GasDayStart(obj),
                    GasDayEnd           = GasDayEnd(obj),
                    GasDay = GasDay(obj),
                    Cycle  = obj.Nominations[0]?.Cycle?.Indicator,
                    PartyIndentificaton = Map(obj.ConfirmingParties),
                    Locations           = locationContractNominations.Select(Map).ToList()
                };

                return(item);
            }

            return(null);
        }