Esempio n. 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);
            }
        }
Esempio n. 2
0
        private XmlDocument SpecialCreateCommand(string commandName, PaymentCommand command, string userID)
        {
            XmlDocument response = null;

            CreateTwoFishCommand cmd    = new CreateTwoFishCommand();
            Type           cmdType      = cmd.GetType();
            PaymentCommand firstCommand = CreateCommand(commandName, userID, cmdType, null);
            PaymentItem    paymentItem  = new PaymentItem();

            response = paymentItem.ProcessMessage(firstCommand);

            return(response);
        }
Esempio n. 3
0
        public Form1()
        {
            InitializeComponent();

            radioButton1.Checked = false;
            radioButton2.Checked = true;

            mUserIdList.Add("545", "");
            mUserIdList.Add("547", "");
            mUserIdList.Add("549", "");
            mUserIdList.Add("551", "");
            mUserIdList.Add("554", "");
            mUserIdList.Add("556", "");
            mUserIdList.Add("558", "");
            mUserIdList.Add("559", "");
            mUserIdList.Add("576", "");
            mUserIdList.Add("574", "");
            mUserIdList.Add("652", "");
            mUserIdList.Add("721", "1000011");
            mUserIdList.Add("734", "1000008");

            CreateTwoFishCommand cmdTwoFish = new CreateTwoFishCommand();
            Type cmdType = cmdTwoFish.GetType();

            PopulateComboBox(cmdType, comboBox1);

            CreateHangoutCommand cmdHangout = new CreateHangoutCommand();

            cmdType = cmdHangout.GetType();
            PopulateComboBox(cmdType, comboBox3);

            foreach (KeyValuePair <string, string> keyValue in mUserIdList)
            {
                comboBox2.Items.Add(keyValue.Key);
            }
        }