Ejemplo n.º 1
0
        /// <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());
        }
Ejemplo n.º 2
0
        public void ReceptionTest()
        {
            //Test to run through the complete reception method.
            string ss = System.IO.File.ReadAllText("Sample_121_Request.xml");

            Acord60Mins.IncomingRequest irr = new Acord60Mins.IncomingRequest();
            string output = irr.Receive(ss);

            TXLife_Type response = TXLife_Type.NewFromString(output);
        }
Ejemplo n.º 3
0
        public string Process(string txLife)
        {
            TXLife_Type txr = TXLife_Type.NewFromString(txLife);

            foreach (TXLifeRequest_Type txrr in txr.Items.Where(t => t.GetType() == typeof(TXLifeRequest_Type)))
            {
                txrr.TransTrackingID = "I Converted!";
            }

            return(txr.ToString());
        }
Ejemplo n.º 4
0
        public void Create121()
        {
            //simple test to see if we can create and output a TXLife.

            TXLife_Type        txl = new TXLife_Type();
            TXLifeRequest_Type txr = new TXLifeRequest_Type();

            txl.Items = new TXLifeRequest_Type[] { txr };
            OLI_LU_TRANS_TYPE_CODES transCode = new OLI_LU_TRANS_TYPE_CODES();

            txr.TransType       = new OLI_LU_TRANS_TYPE_CODES();
            txr.TransType.tc    = "121";
            txr.TransType.Value = "General Requirement Order Request";

            string ss = txl.ToString();

            TXLife_Type final = TXLife_Type.NewFromString(ss);
        }