/// <summary> /// The full receive method takes in a string txlife file, runs client conversion on it, based on the /// auth in the file and attempts to convert it from the fules located in the ConverterRules.xml file. The object can /// then can be shipped off to another location for persistence. Finally, a TXLifeResponse is returned. This /// method is meant to be hooked up to a web controller, or other, wherein a string is received and a response is /// sent out. Validation on the TXLife is not performed in here as, when receiving from many clients, one might /// need to convert a file into a properly validating file. /// </summary> /// <param name="txLifeRequest">A string of the TXLifeRequest file.</param> /// <returns>A string representation of the TXLifeResponse</returns> public string Receive(string txLifeRequest) { //clear out our existing errors. this.internalErrors.Clear(); this.publicErrors.Clear(); //process the conversion from the clientrules xml file. txLifeRequest = ProcessClientConverion(txLifeRequest); //setup our deserialization. TXLife_Type txr = null; try { //Create our txlife object from the incoming string. txr = TXLife_Type.NewFromString(txLifeRequest); } catch (Exception ex) { internalErrors.Add($"Error Reading TXLifeRequest Conversion Failed, the error was, \"{ex.Message}\"."); publicErrors.Add($"Could not read the TXLife file."); } //setup the response object for sending back out. TXLife_Type response = new TXLife_Type(); TXLifeResponse_Type txrr = new TXLifeResponse_Type(); response.Items = new object[] { txrr }; txrr.TransRefGUID = System.Guid.NewGuid().ToString(); txrr.TransExeDate = System.DateTime.Now; txrr.TransExeTime = System.DateTime.Now; txrr.TransResult = new TransResult_Type(); txrr.TransResult.ResultCode = new RESULT_CODES(); if (publicErrors.Count == 0) { txrr.TransResult.ResultCode.tc = "1"; txrr.TransResult.ResultCode.Value = "Success"; } else { txrr.TransResult.ResultCode.tc = "5"; txrr.TransResult.ResultCode.Value = "Failure"; //Log out the public errors. We are hard coding the errors here at a severe, cannot be overridden. //There is a possibility to add in severity here. foreach (string ss in publicErrors) { txrr.TransResult.ResultInfo = new ResultInfo_Type[] { new ResultInfo_Type { ResultInfoDesc = ss, ResultInfoSeverity = new OLI_LU_MSGSEVERITY { tc = "5", Value = "The message is severe and cannot be overridden." } } }; } } //return the TXLife Response return(response.ToString()); }
public abstract Sans_TXLifeRequest_UserAuthRequest_TXLifeBuilder AddTXLifeResponse(TXLifeResponse_Type response);
public override Sans_TXLifeRequest_UserAuthRequest_TXLifeBuilder AddTXLifeResponse(TXLifeResponse_Type response) { _buildActions[typeof(TXLifeResponse_Type)].AddLast(n => n.Items.Add(response)); return(this); }
Sans_TXLifeRequest_UserAuthRequest_UserAuthResponse_TXLifeBuilder TXLifeResponse_TXLifeBuilder <Sans_TXLifeRequest_UserAuthRequest_UserAuthResponse_TXLifeBuilder> .AddTXLifeResponse(TXLifeResponse_Type response) { return((Sans_TXLifeRequest_UserAuthRequest_UserAuthResponse_TXLifeBuilder)AddTXLifeResponse(response)); }