public static PillarSaltMessage UnencryptedParser(string decryptedXML)
        {
            PillarSaltMessage myObject     = default(PillarSaltMessage);
            XmlSerializer     mySerializer = new XmlSerializer(typeof(PillarSaltMessage));

            // convert string to stream
            byte[]       byteArray = Encoding.Unicode.GetBytes(decryptedXML);
            MemoryStream stream    = new MemoryStream(byteArray);

            // Call the Deserialize method and cast to the object type.
            myObject = (PillarSaltMessage)mySerializer.Deserialize(stream);

            //Dim dNotes = myObject.content.Contents(0).MethodCall
            //Console.WriteLine(dNotes)
            return(myObject);
        }
        public static string DoMethod(string messageType, string origin, string destination, string adminuser, string transactionId, string senderIpAdd, int userId, decimal longitud, decimal latitude, string screen, string state, string description, string contentType, string notes, string amount, string accountNo)
        {
            try
            {
                _db = new PilaDbContext();
                ConnectionInfo profInfo = _db.ConnectionInfoes.First(c => c.Active == 1);
                if (profInfo != null)
                {
                    //instantiate Message Headers
                    MessageHeader mHeader = new MessageHeader
                    {
                        MessageType     = messageType,
                        Origin          = GetMacAddress(),
                        Destination     = profInfo.IPAddress + ":" + profInfo.SocketPort,
                        AdminUser       = adminuser,
                        TransactionCode = transactionId
                    };


                    //instantiate Message Trail
                    MessageTrail mTrail = new MessageTrail
                    {
                        IPAddress = senderIpAdd,
                        MAC       = GetMacAddress(),
                        SentDate  = DateTime.Now,
                        UserId    = userId,
                        Latitude  = latitude,
                        Longitude = longitud,
                        Screen    = screen,
                        State     = state
                    };

                    var allContents = new List <Content>();
                    //Add deposit content
                    allContents.Add(TransactionCls.MethodContent);

                    ////Add denomination content
                    //allContents.Add(TransactionCls.DenominationContents);


                    //instantiate Message content
                    MessageContent mContent = new MessageContent
                    {
                        IsEncryted  = true,
                        Description = description,
                        ContentType = contentType,
                        Contents    = allContents
                    };

                    //instantiate PillarSaltMessage content
                    PillarSaltMessage p = new PillarSaltMessage
                    {
                        Notes   = notes,
                        Header  = mHeader,
                        content = mContent,
                        Trails  = mTrail
                    };

                    XmlSerializer x         = new XmlSerializer(p.GetType());
                    var           strWriter = new StringWriter();
                    TextWriter    tw        = new StreamWriter(@"C:\\Machine\\DepositeMessage.xml");

                    x.Serialize(tw, p);
                    x.Serialize(strWriter, p);

                    var             encryptedMessage = EncryptMessageFromkiosk(strWriter.ToString()).Notes;
                    TMSSocketClient sending          = new TMSSocketClient();
                    ConnectionInfo  profile          = _db.ConnectionInfoes.First(c => c.Active == 1);
                    if (profile != null)
                    {
                        var response          = sending.SyncClient(profile.IPAddress, Convert.ToInt32(profile.SocketPort), encryptedMessage);
                        var decryptedResponse = DecryptMessageFromTms(response.Notes);

                        RtnMessage = decryptedResponse.Value;
                        MessageBox.Show(RtnMessage);
                        return(RtnMessage);
                    }
                }
            }
            catch (Exception ex)
            {
                RtnMessage = "ERROR : " + ex.Message;
                MessageBox.Show(RtnMessage);
            }
            return(RtnMessage);
        }