예제 #1
0
        private void FormConfig_Load(object sender, EventArgs e)
        {
            ConfigData config = ConfigDataProcessor.GetConfigData();

            if (config != null)
            {
                tbOpenApiUrl.Text       = config.OpenApiUrl;
                tbAppId.Text            = config.AppId;
                tbSaleChannelSysNo.Text = config.SaleChannelSysNo.ToString();
                tbSecretKey.Text        = config.SecretKey;
            }
        }
예제 #2
0
        private void FormImportSO_Load(object sender, EventArgs e)
        {
            ConfigData config = ConfigDataProcessor.GetConfigData();

            if (config != null)
            {
                lblChannelInfo.Text = string.Format("当前导入分销渠道编号为{0},商户AppId为{1};导入时将先对数据进行检查!", config.SaleChannelSysNo, config.AppId);
            }
            else
            {
                lblChannelInfo.Text = "请先进入配置管理中,配置正确您的分销渠道相关信息!";
            }
        }
예제 #3
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(tbOpenApiUrl.Text))
            {
                MessageBox.Show("OpenAPI Url不能为空!");
                return;
            }
            if (string.IsNullOrWhiteSpace(tbSaleChannelSysNo.Text))
            {
                MessageBox.Show("分销渠道编号不能为空!");
                return;
            }
            if (string.IsNullOrWhiteSpace(tbAppId.Text))
            {
                MessageBox.Show("AppID不能为空!");
                return;
            }
            if (string.IsNullOrWhiteSpace(tbSecretKey.Text))
            {
                MessageBox.Show("验签密钥不能为空!");
                return;
            }
            int channelNo = 0;

            if (!int.TryParse(tbSaleChannelSysNo.Text.Trim(), out channelNo))
            {
                MessageBox.Show("分销渠道编号必须为数字!");
                return;
            }


            ConfigData config = new ConfigData();

            config.OpenApiUrl       = tbOpenApiUrl.Text.Trim();
            config.SaleChannelSysNo = int.Parse(tbSaleChannelSysNo.Text.Trim());
            config.AppId            = tbAppId.Text.Trim();
            config.SecretKey        = tbSecretKey.Text.Trim();

            ConfigDataProcessor.SaveConfig(config);
            MessageBox.Show("保存配置成功!");
        }