using PTMedicalInsurance.Common;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace PTMedicalInsurance.Forms
{
    public partial class CenterResult : Form
    {
        public string returnData;

        private string tradeNo;

        public CenterResult()
        {
            InitializeComponent();
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.returnData = "{infcode:-1}";
            DialogResult = DialogResult.OK;
            Close();
        }

        public void setTradeNo(string no,string input)
        {
            this.tradeNo = no;
            this.txtInput.AppendText(input);
            this.label4.Text = string.Format("请输入【{0}】交易的返回结果:",no);
        }
        private void btnOK_Click(object sender, EventArgs e)
        {
            this.returnData = txtOutput.Text.Trim();
            DialogResult = DialogResult.OK;
            Close();
        }

        private void btnConfig_Click(object sender, EventArgs e)
        {
            // TODO: 可自动提供基线版JSON
            //JsonMappingForm form = new JsonMappingForm("",txtOutput.Text,tradeNo,false);
            //form.ShowDialog();
        }

        private void btnLoad_Click(object sender, EventArgs e)
        {
            txtOutput.Clear();
            txtOutput.AppendText(Utils.MockData(false,tradeNo));
        }

        private void CenterResult_Load(object sender, EventArgs e)
        {
            btnLoad_Click(sender,e);
        }
    }
}
