コード例 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                string selectedItem = "";
                Type   cmdType      = null;

                if (radioButton1.Checked)
                {
                    selectedItem = (string)comboBox1.SelectedItem;
                    CreateTwoFishCommand cmd = new CreateTwoFishCommand();
                    cmdType = cmd.GetType();
                }
                else
                {
                    selectedItem = (string)comboBox3.SelectedItem;
                    CreateHangoutCommand cmd = new CreateHangoutCommand();
                    cmdType = cmd.GetType();
                }

                string selectedUser = (string)comboBox2.SelectedItem;

                if (selectedItem != null)
                {
                    ServiceCommandSerializer paymentSerializer = new ServiceCommandSerializer();

                    PaymentCommand command    = CreateCommand(selectedItem, selectedUser, cmdType, GetSelectedXml());
                    string         xmlCommand = paymentSerializer.SerializeCommandData((ServiceCommand)command, typeof(PaymentCommand));

                    StreamWriter swCommand = new StreamWriter("c:\\twofishCommand.xml");
                    swCommand.Write(xmlCommand);
                    swCommand.Close();

                    command = (PaymentCommand)paymentSerializer.DeserializeCommandData(xmlCommand, typeof(PaymentCommand));

                    PaymentCommand commandSecond = HandleSpecialCommand(command, selectedUser, cmdType);
                    if (commandSecond != null)
                    {
                        command = commandSecond;
                    }

                    PaymentItem paymentItem = new PaymentItem();
                    XmlDocument response    = paymentItem.ProcessMessage(command);

                    response = HandleSpecialResponse(response);

                    StreamWriter swResponse = new StreamWriter("c:\\twofishResponse.xml");
                    swResponse.Write(response.InnerXml);
                    swResponse.Close();

                    DisplayResponse(response);
                }
            }
            catch (Exception ex)
            {
                XmlDocument errorResponse = CreateErrorDoc(ex.Message);
                DisplayResponse(errorResponse);
            }
        }
コード例 #2
0
        /// <summary>
        /// Converts the client PaymentItems command to a PaymentItems command
        /// </summary>
        /// <param name="xmlClientMessage">xml client PaymentItems command</param>
        /// <returns>PaymentItems command</returns>
        public PaymentCommand ProcessMessage(string xmlClientMessage, getUserIdDelegate getUserIdCall)
        {
            mGetUserIdCall = getUserIdCall;
            ServiceCommandSerializer serializer    = new ServiceCommandSerializer();
            PaymentCommand           clientCommand = (PaymentCommand)serializer.DeserializeCommandData(xmlClientMessage, typeof(PaymentCommand));

            return(ParseClientPaymentCommand(clientCommand));
        }
コード例 #3
0
        public XmlDocument ProcessAdminPaymentItemXml(HangoutPostedFile paymentCommand)
        {
            XmlDocument response = new XmlDocument();

            byte[] buffer = new byte[paymentCommand.InputStream.Length];
            paymentCommand.InputStream.Read(buffer, 0, (int)paymentCommand.InputStream.Length);

            UTF8Encoding encoding             = new UTF8Encoding();
            String       paymentCommandString = encoding.GetString(buffer);

            ServiceCommandSerializer serializer = new ServiceCommandSerializer();
            PaymentCommand           command    = (PaymentCommand)serializer.DeserializeCommandData(paymentCommandString, typeof(PaymentCommand));

            AdminCommandBase parser = new AdminCommandBase("PaymentItemsAdminService");

            response = parser.ProcessRequest(command);

            return(response);
        }
コード例 #4
0
ファイル: PaymentItem.cs プロジェクト: lsmolic/hangoutsrc
        /// <summary>
        /// Main entry point for the state server to use the PaymentItems
        /// This will limited to Hangout commands
        /// </summary>
        /// <param name="xmlMessage">PaymentCommand string xml message</param>
        /// <returns>string XML response message</returns>
        public string ProcessMessage(string xmlMessage)
        {
            string response = "";

            try
            {
                ServiceCommandSerializer paymentSerializer = new ServiceCommandSerializer();
                PaymentCommand           command           = (PaymentCommand)paymentSerializer.DeserializeCommandData(xmlMessage, typeof(PaymentCommand));

                Hangout.Server.WebServices.HangoutCommandBase parser = new Hangout.Server.WebServices.HangoutCommandBase("InvokePaymentItemsProcess");
                response = parser.ProcessRequest(command).InnerXml;
            }

            catch (Exception ex)
            {
                response = CreateErrorDoc(ex.Message);
            }

            return(response);
        }