//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); }
private static void SaveNaesbQuickResponseFile(NaesbQuickResponse qr, string fileName) { //serialize with out the namespace because GENTRAN can't handle it XmlDocument xmlFile = XmlTransformer.XmlSerialize(qr, true); xmlFile.Save(Properties.Settings.Default.NaesbOutboundUnc + fileName); }
private static void SaveNaesbRequestForConfirmationFile(NaesbRequestForConfirmation nrfc, string ediFileName) { //serialize with out the namespace because GENTRAN can't handle it XmlDocument xmlFile = XmlTransformer.XmlSerialize(nrfc, true); xmlFile.Save(Properties.Settings.Default.NaesbOutboundUnc + ediFileName); }
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." }; }