Пример #1
0
        public void DdlProviderType_SelectedIndexChanged(object sender, EventArgs e)
        {
            var type = ESmsProviderTypeUtils.GetEnumType(DdlProviderType.SelectedValue);

            PhSettings.Visible   = type != ESmsProviderType.None;
            PhAdditional.Visible = type == ESmsProviderType.Aliyun;

            if (type != ESmsProviderType.None)
            {
                LtlType.Text =
                    $@"{ESmsProviderTypeUtils.GetText(type)}(<a href=""{ESmsProviderTypeUtils.GetUrl(type)}"" target=""_blank"">{ESmsProviderTypeUtils
                        .GetUrl(type)}</a>)";
            }
            else
            {
                LtlType.Text = "请选择短信服务商";
            }
        }
Пример #2
0
        private void rptInstalled_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                var providerType = (ESmsProviderType)e.Item.DataItem;

                var isEnabled = false;
                if (providerType == ESmsProviderType.AliDaYu)
                {
                    isEnabled = ConfigManager.SystemConfigInfo.IsSmsAliDaYu;
                }
                else if (providerType == ESmsProviderType.YunPian)
                {
                    isEnabled = ConfigManager.SystemConfigInfo.IsSmsYunPian;
                }

                var ltlName         = e.Item.FindControl("ltlName") as Literal;
                var ltlIsEnabled    = e.Item.FindControl("ltlIsEnabled") as Literal;
                var ltlTemplates    = e.Item.FindControl("ltlTemplates") as Literal;
                var ltlConfigUrl    = e.Item.FindControl("ltlConfigUrl") as Literal;
                var ltlIsEnabledUrl = e.Item.FindControl("ltlIsEnabledUrl") as Literal;

                if (ltlName != null)
                {
                    ltlName.Text = $@"{ESmsProviderTypeUtils.GetText(providerType)}(<a href=""{ESmsProviderTypeUtils.GetUrl(providerType)}"" target=""_blank"">{ESmsProviderTypeUtils.GetUrl(providerType)}</a>)";
                }
                if (ltlIsEnabled != null)
                {
                    ltlIsEnabled.Text = StringUtils.GetTrueOrFalseImageHtml(isEnabled);
                }

                if (isEnabled)
                {
                    var urlConfig  = string.Empty;
                    var isConfig   = false;
                    var isTemplate = false;
                    if (providerType == ESmsProviderType.AliDaYu)
                    {
                        urlConfig = PageSmsProviderAliDaYu.GetRedirectUrl();
                        isConfig  = !string.IsNullOrEmpty(ConfigManager.SystemConfigInfo.SmsAliDaYuAppKey) &&
                                    !string.IsNullOrEmpty(ConfigManager.SystemConfigInfo.SmsAliDaYuAppSecret) &&
                                    !string.IsNullOrEmpty(ConfigManager.SystemConfigInfo.SmsAliDaYuSignName);
                        isTemplate = !string.IsNullOrEmpty(ConfigManager.SystemConfigInfo.SmsAliDaYuCodeTplId);
                    }
                    else if (providerType == ESmsProviderType.YunPian)
                    {
                        urlConfig  = PageSmsProviderYunPian.GetRedirectUrl();
                        isConfig   = !string.IsNullOrEmpty(ConfigManager.SystemConfigInfo.SmsYunPianApiKey);
                        isTemplate = !string.IsNullOrEmpty(ConfigManager.SystemConfigInfo.SmsYunPianCodeTplId);
                    }
                    if (ltlConfigUrl != null)
                    {
                        ltlConfigUrl.Text = isConfig ? $@"<a href=""{urlConfig}"">设置</a>" : $@"<a href=""{urlConfig}"" style=""color:red"">设置</a>";
                    }
                    if (ltlTemplates != null)
                    {
                        ltlTemplates.Text = isTemplate ? $@"<a href=""{PageSmsTemplates.GetRedirectUrl(providerType)}"">短信模板管理</a>" : $@"<a href=""{PageSmsTemplates.GetRedirectUrl(providerType)}"" style=""color:red"">短信模板管理</a>";
                    }
                }

                var urlIsEnabled = GetRedirectUrl() + $"?isEnabled=True&providerType={ESmsProviderTypeUtils.GetValue(providerType)}";
                var action       = isEnabled ? "禁用" : "启用";
                if (ltlIsEnabledUrl != null)
                {
                    ltlIsEnabledUrl.Text = $@"<a href=""{urlIsEnabled}"">{action}</a>";
                }
            }
        }
Пример #3
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            if (!IsPostBack)
            {
                BreadCrumbSettings(AppManager.Settings.LeftMenu.Config, "短信服务商管理", AppManager.Settings.Permission.SettingsConfig);

                LtlType.Text = $@"{ESmsProviderTypeUtils.GetText(ESmsProviderType.YunPian)}(<a href=""{ESmsProviderTypeUtils.GetUrl(ESmsProviderType.YunPian)}"" target=""_blank"">{ESmsProviderTypeUtils.GetUrl(ESmsProviderType.YunPian)}</a>)";

                TbApiKey.Text = ConfigManager.SystemConfigInfo.SmsYunPianApiKey;
            }
        }