public static string GetRedirectUrl(ESmsProviderType providerType) { return(PageUtils.GetSettingsUrl(nameof(PageSmsTemplates), new NameValueCollection { { "providerType", ESmsProviderTypeUtils.GetValue(providerType) } })); }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } if (Body.IsQueryExists("isEnabled") && Body.IsQueryExists("providerType")) { var providerType = ESmsProviderTypeUtils.GetEnumType(Body.GetQueryString("providerType")); if (providerType == ESmsProviderType.AliDaYu) { ConfigManager.SystemConfigInfo.IsSmsAliDaYu = !ConfigManager.SystemConfigInfo.IsSmsAliDaYu; } else if (providerType == ESmsProviderType.YunPian) { ConfigManager.SystemConfigInfo.IsSmsYunPian = !ConfigManager.SystemConfigInfo.IsSmsYunPian; } BaiRongDataProvider.ConfigDao.Update(ConfigManager.Instance); } if (!IsPostBack) { BreadCrumbSettings(AppManager.Settings.LeftMenu.Config, "短信服务商管理", AppManager.Settings.Permission.SettingsConfig); RptContents.DataSource = ESmsProviderTypeUtils.GetList(); RptContents.ItemDataBound += rptInstalled_ItemDataBound; RptContents.DataBind(); } }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } _providerType = ESmsProviderTypeUtils.GetEnumType(Body.GetQueryString("providerType")); _templateType = ESmsTemplateTypeUtils.GetEnumType(Body.GetQueryString("templateType")); if (!IsPostBack) { var tplId = string.Empty; if (_templateType == ESmsTemplateType.Code) { if (_providerType == ESmsProviderType.AliDaYu) { tplId = ConfigManager.SystemConfigInfo.SmsAliDaYuCodeTplId; } else if (_providerType == ESmsProviderType.YunPian) { tplId = ConfigManager.SystemConfigInfo.SmsYunPianCodeTplId; } } TbTplId.Text = tplId; InfoMessage(GetSample()); } }
public static string GetOpenWindowStringToEdit(ESmsProviderType providerType, ESmsTemplateType templateType) { return(PageUtils.GetOpenWindowString("设置短信模板", PageUtils.GetSettingsUrl(nameof(ModalSmsTemplateAdd), new NameValueCollection { { "providerType", ESmsProviderTypeUtils.GetValue(providerType) }, { "templateType", ESmsTemplateTypeUtils.GetValue(templateType) } }), 460, 360)); }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } _providerType = ESmsProviderTypeUtils.GetEnumType(Body.GetQueryString("providerType")); _templateType = ESmsTemplateTypeUtils.GetEnumType(Body.GetQueryString("templateType")); }
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; } }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } _providerType = ESmsProviderTypeUtils.GetEnumType(Body.GetQueryString("providerType")); if (!IsPostBack) { BreadCrumbSettings(AppManager.Settings.LeftMenu.Config, "短信模板管理", AppManager.Settings.Permission.SettingsConfig); RptContents.DataSource = ESmsTemplateTypeUtils.GetList(); RptContents.ItemDataBound += rptInstalled_ItemDataBound; RptContents.DataBind(); } }
public override void Submit_OnClick(object sender, EventArgs e) { try { ConfigManager.SystemConfigInfo.SmsProviderType = ESmsProviderTypeUtils.GetEnumType(DdlProviderType.SelectedValue); ConfigManager.SystemConfigInfo.SmsAppKey = TbAppKey.Text; ConfigManager.SystemConfigInfo.SmsAppSecret = TbAppSecret.Text; ConfigManager.SystemConfigInfo.SmsSignName = TbSignName.Text; BaiRongDataProvider.ConfigDao.Update(ConfigManager.Instance); SuccessMessage("短信服务商设置成功!"); } catch (Exception ex) { FailMessage(ex, ex.Message); } }
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 = "请选择短信服务商"; } }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } if (IsPostBack) { return; } BreadCrumbSettings(AppManager.Settings.LeftMenu.Config, "短信服务商设置", AppManager.Settings.Permission.SettingsConfig); ESmsProviderTypeUtils.AddListItems(DdlProviderType); ControlUtils.SelectListItemsIgnoreCase(DdlProviderType, ESmsProviderTypeUtils.GetValue(ConfigManager.SystemConfigInfo.SmsProviderType)); TbAppKey.Text = ConfigManager.SystemConfigInfo.SmsAppKey; TbAppSecret.Text = ConfigManager.SystemConfigInfo.SmsAppSecret; TbSignName.Text = ConfigManager.SystemConfigInfo.SmsSignName; DdlProviderType_SelectedIndexChanged(null, EventArgs.Empty); }
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>"; } } }