📄 smsmessagetocontacter.aspx.cs
字号:
namespace PowerEasy.WebSite.Admin.Sms
{
using PowerEasy.Accessories;
using PowerEasy.Common;
using PowerEasy.Components;
using PowerEasy.Controls;
using PowerEasy.Crm;
using PowerEasy.Model.Crm;
using PowerEasy.Web.UI;
using PowerEasy.WebSite.Controls;
using System;
using System.Collections.Generic;
using System.Text;
using System.Web.UI;
using System.Web.UI.WebControls;
public class SmsMessageToContacter : AdminPage
{
protected Button BtnSubmit;
protected Button BtnSubmitServer;
protected DatePicker Dpk;
protected Label LabMessageCount;
protected Label LabRecieverCount;
protected HiddenField MD5String;
protected Panel Panel1;
protected Panel Panel2;
protected RadioButton RadIncept1;
protected RadioButton RadIncept2;
protected RadioButton RadIncept3;
protected RadioButton RadSendType;
protected RadioButton RadTimeSend;
protected RegionControl Region;
protected PowerEasy.Controls.RequiredFieldValidator RequiredFieldValidator1;
protected HiddenField Reserve;
protected HiddenField SendTime;
protected HiddenField SendTiming;
protected ScriptManager SmgeRegion;
protected ExtendedSiteMapPath SmpNavigator;
protected TextBox TxtContact;
protected TextBox TxtContent;
protected TextBox TxtMessage;
protected TextBox TxtMessageNumber;
protected TextBox TxtSendNum;
protected void BtnSubmit_Click(object sender, EventArgs e)
{
IList<ContacterInfo> allMobileContacters = new List<ContacterInfo>();
if (this.RadIncept1.Checked)
{
allMobileContacters = Contacter.GetAllMobileContacters();
}
if (this.RadIncept2.Checked)
{
allMobileContacters = Contacter.GetMobileContacterByRegion(this.Region.Country, this.Region.Province, this.Region.City);
}
if (this.RadIncept3.Checked)
{
allMobileContacters = Contacter.GetMobileContacterByUserName(this.TxtContact.Text.Trim());
}
StringBuilder sb = new StringBuilder();
foreach (ContacterInfo info in allMobileContacters)
{
string mobile = info.Mobile;
if (string.IsNullOrEmpty(mobile))
{
mobile = info.Phs;
}
if (!string.IsNullOrEmpty(mobile))
{
string append = mobile + "," + info.TrueName + "," + info.UserName;
StringHelper.AppendString(sb, append, "\r\n");
}
}
this.TxtSendNum.Text = sb.ToString();
this.TxtContent.Text = this.TxtMessage.Text;
this.LabRecieverCount.Text = allMobileContacters.Count.ToString();
this.LabMessageCount.Text = (allMobileContacters.Count * ((this.TxtContent.Text.Length / 70) + 1)).ToString();
if (this.RadSendType.Checked)
{
this.SendTiming.Value = "0";
}
else
{
this.SendTiming.Value = "1";
}
this.SendTime.Value = this.Dpk.Text;
this.Panel2.Visible = true;
this.Panel1.Visible = false;
}
protected void BtnSubmitServer_Click(object sender, EventArgs e)
{
try
{
AdminPage.WriteSuccessMsg(SmsMessage.SendMessage(this.TxtSendNum.Text, this.TxtContent.Text, this.SendTiming.Value, this.SendTime.Value, PEContext.Current.Admin.AdminName), "SmsMessageToContacter.aspx");
}
catch (CustomException exception)
{
AdminPage.WriteErrMsg(exception.Message);
}
}
private void InitControl()
{
if (!base.IsPostBack)
{
this.TxtMessage.Text = "{$2},您好!这是一条测试短信。----动易网络(请勿回复此短信)";
this.Dpk.Text = DateTime.Now.AddDays(1.0).ToString("yyyy-MM-dd HH:mm:ss");
this.TxtMessage.Attributes.Add("onpropertychange", "checkLength()");
this.TxtMessage.Attributes.Add("oninput", "checkLength()");
this.Panel2.Visible = false;
}
}
protected void Page_Load(object sender, EventArgs e)
{
this.InitControl();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -