public int Invoke(DateTime processStart, NaesbConfirmationResponse naesbObj) { //serialize into naesb XmlDocument XmlDocument naesbXml = CS.Common.Utilities.XmlTransformer.XmlSerialize(naesbObj, true); int id = CreateConfirmationResponse(processStart, null, naesbObj, naesbXml); return(id); }
public IHttpActionResult Get(int id) { NaesbConfirmationResponse obj = _container.Resolve <INaesbConfirmationResponseGet>().Invoke(id); if (obj != null) { return(Ok(obj)); } return(NotFound()); }
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 int Invoke(DateTime processStart, FileInfo file) { //serialize naesb translated .xml file into naesb XmlDocument XmlDocument naesbXml = CS.Common.Utilities.XmlTransformer.ConvertToXmlDocument(file, true); //deserialize XmlDocument into NaesbConfirmationResponse naesbObj NaesbConfirmationResponse naesbObj = CS.Common.Utilities.XmlTransformer.XmlDeserialize <NaesbConfirmationResponse>(naesbXml.InnerXml); int id = CreateConfirmationResponse(processStart, file.Name, naesbObj, naesbXml); return(id); }
public IHttpActionResult Post(NaesbConfirmationResponse value) { try { int id = _container.Resolve <INaesbConfirmationResponseCreate>().Invoke(DateTime.Now, value); if (id > 0) { string location = Request.RequestUri + "/" + id; return(Created(location, id)); } } catch (NaesbError ex) { if (ex.ReasonCode == "101") { return(Conflict()); } } return(BadRequest()); }
public Domain.ConfirmationResponse.ConfirmationResponse Invoke(NaesbConfirmationResponse obj) { //map NaesbConfirmationResponse to ConfirmationResponse return(Map(CheckMissingCycle(new Nomination.BusinessLayer.Common.ModelFactory().Map(obj)))); }
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." }; }