public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } _styleId = Body.GetQueryInt("StyleID"); _tableStyle = ETableStyleUtils.GetEnumType(Body.GetQueryString("TableStyle")); var relatedIdentity = Body.GetQueryInt("RelatedIdentity"); var tagStyleInfo = DataProvider.TagStyleDao.GetTagStyleInfo(_styleId); if (_tableStyle == ETableStyle.GovInteractContent) { _mailSmsInfo = new TagStyleGovInteractApplyInfo(tagStyleInfo.SettingsXML); } if (!IsPostBack) { ltlTips2.Text = $"[{ContentAttribute.AddDate}]代表提交时间,[{GovInteractContentAttribute.QueryCode}]代表查询码,"; var styleInfoList = RelatedIdentities.GetTableStyleInfoList(PublishmentSystemInfo, _tableStyle, relatedIdentity); foreach (var styleInfo in styleInfoList) { if (styleInfo.IsVisible) { ltlTips2.Text += $@"[{styleInfo.AttributeName}]代表{styleInfo.DisplayName},"; } } ltlTips2.Text = ltlTips2.Text.TrimEnd(','); //短信 ControlUtils.SelectListItemsIgnoreCase(rblIsSMS, _mailSmsInfo.IsSMS.ToString()); rblIsSMS_SelectedIndexChanged(null, EventArgs.Empty); ControlUtils.SelectListItemsIgnoreCase(rblSMSReceiver, ETriStateUtils.GetValue(_mailSmsInfo.SMSReceiver)); rblSMSReceiver_SelectedIndexChanged(null, EventArgs.Empty); tbSMSTo.Text = _mailSmsInfo.SMSTo; foreach (var styleInfo in styleInfoList) { if (styleInfo.IsVisible) { var listItem = new ListItem(styleInfo.DisplayName + "(" + styleInfo.AttributeName + ")", styleInfo.AttributeName); if (StringUtils.EqualsIgnoreCase(styleInfo.AttributeName, _mailSmsInfo.SMSFiledName)) { listItem.Selected = true; } ddlSMSFiledName.Items.Add(listItem); } } ControlUtils.SelectListItemsIgnoreCase(rblIsSMSTemplate, _mailSmsInfo.IsSMSTemplate.ToString()); rblIsSMSTemplate_SelectedIndexChanged(null, EventArgs.Empty); tbSMSContent.Text = _mailSmsInfo.SMSContent; if (string.IsNullOrEmpty(tbSMSContent.Text)) { tbSMSContent.Text = MessageManager.GetSmsContent(styleInfoList); } } }
public static void SendSMS(PublishmentSystemInfo publishmentSystemInfo, ITagStyleMailSMSBaseInfo mailSMSInfo, ETableStyle tableStyle, string tableName, int relatedIdentity, ExtendedAttributes contentInfo) { try { if (mailSMSInfo.IsSMS) { var styleInfoList = RelatedIdentities.GetTableStyleInfoList(publishmentSystemInfo, tableStyle, relatedIdentity); var smsToArrayList = new ArrayList(); if (mailSMSInfo.SMSReceiver == ETriState.All || mailSMSInfo.SMSReceiver == ETriState.True) { if (!string.IsNullOrEmpty(mailSMSInfo.SMSTo)) { var mobiles = mailSMSInfo.SMSTo.Split(';', ','); foreach (var mobile in mobiles) { if (!string.IsNullOrEmpty(mobile) && StringUtils.IsMobile(mobile) && !smsToArrayList.Contains(mobile)) { smsToArrayList.Add(mobile); } } } } if (mailSMSInfo.SMSReceiver == ETriState.All || mailSMSInfo.SMSReceiver == ETriState.False) { var smsTo = contentInfo.GetExtendedAttribute(mailSMSInfo.SMSFiledName); if (!string.IsNullOrEmpty(smsTo)) { var mobiles = smsTo.Split(';', ','); foreach (var mobile in mobiles) { if (!string.IsNullOrEmpty(mobile) && StringUtils.IsMobile(mobile) && !smsToArrayList.Contains(mobile)) { smsToArrayList.Add(mobile); } } } } var builder = new StringBuilder(); if (mailSMSInfo.IsSMSTemplate && !string.IsNullOrEmpty(mailSMSInfo.SMSContent)) { builder.Append(mailSMSInfo.SMSContent); } else { builder.Append(GetSMSContent(styleInfoList)); } var content = builder.ToString(); content = StringUtils.ReplaceIgnoreCase(content, "[AddDate]", DateUtils.GetDateAndTimeString(TranslateUtils.ToDateTime(contentInfo.GetExtendedAttribute(ContentAttribute.AddDate)))); foreach (var styleInfo in styleInfoList) { var theValue = InputParserUtility.GetContentByTableStyle(contentInfo.GetExtendedAttribute(styleInfo.AttributeName), publishmentSystemInfo, tableStyle, styleInfo); content = StringUtils.ReplaceIgnoreCase(content, $"[{styleInfo.AttributeName}]", theValue); } var attributeNameList = TableManager.GetAttributeNameList(tableStyle, tableName); foreach (string attributeName in attributeNameList) { var theValue = contentInfo.GetExtendedAttribute(attributeName); content = StringUtils.ReplaceIgnoreCase(content, $"[{attributeName}]", theValue); } if (content.Length > 60) { content = content.Substring(0, 60); } //var errorMessage = string.Empty; //var providerInfo = BaiRongDataProvider.SmsProviderDAO.GetFirstSmsProviderInfo(); //if (providerInfo != null) //{ // SmsProviderManager.Send(providerInfo, smsToArrayList, content, out errorMessage); //} } } catch { // ignored } }