smssend.aspx.cs
来自「该服务平台解决了计算机网络与移动网络之间信息交换问题」· CS 代码 · 共 719 行 · 第 1/2 页
CS
719 行
// catch
{
//Response.Write("<script language='javascript'>alert('提交短信失败!');</script>");
//String url = String.Format("<script>window.location.href ='SMSEdit.aspx?SMSTyp={0}&operationID={1}&smsID=0'</script>", Request.QueryString[2].ToString(), Request.QueryString[1].ToString());
//Response.Write(url);
}
}
# endregion
#region gridview pageindex
protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
GridView1.PageIndex = e.NewPageIndex;
UserInfoList();
}
#endregion
#region 发送(该页面的发送暂时没有用)
protected void btnSend_Click(object sender, EventArgs e)
{
DataAccess.TableAccessor.SMSInfo smsInfo = new DataAccess.TableAccessor.SMSInfo();
DataAccess.SendSMS sendSMS = new DataAccess.SendSMS();
DataAccess.CookieAccessor cookieAccessor = new DataAccess.CookieAccessor();
DataAccess.TableAccessor.UserInfo userInfo = new DataAccess.TableAccessor.UserInfo();
//DataAccess.TableAccessor.UserInfo userInfo = new DataAccess.TableAccessor.UserInfo();
string SMSType = Request.QueryString[2].ToString();
int userID = cookieAccessor.GetLoginUserOperationID();
int smsID = int.Parse(Request.QueryString[0].ToString());
String smsContent = smsInfo.GetMsgContentBySMSID(smsID);
int countSendUser = 0;
int trade = 0;
int count = 0;
int totalSMS = smsInfo.GetCount();//允许发送的最大条数
int countSMS = smsInfo.GetCountSMS();//统计已发条数
int SendUser = 0;
// int CountUser = 0;
try
{
//smsSendUserList.DeleteSendUserInfoBySMSID(smsID);
for (int j = 0; j < GridView1.Rows.Count; j++)
{
CheckBox ckb = (CheckBox)GridView1.Rows[j].FindControl("chk");
if (ckb.Checked)
{
SendUser++;
}
}
count = countSMS + SendUser;
//count = countSMS;
if (count <= totalSMS) //已发短信统计
{
smsSendUserList.DeleteSendUserInfoBySMSID(smsID);
for (int i = 0; i < GridView1.Rows.Count; i++)
{
CheckBox ckb = (CheckBox)GridView1.Rows[i].FindControl("chk");
if (ckb.Checked)
{
String mobile = GridView1.Rows[i].Cells[8].Text;
int sendUserID = int.Parse(GridView1.Rows[i].Cells[2].Text);
trade = userInfo.GetTradeByMobile(mobile);
string companyID = "001";
smsInfo.Send(mobile, smsContent, trade);
// smsSendUserList.AddSMSSendUserList(smsID, sendUserID);
// sendSMS.SendingSMS(mobile, smsContent, trade, companyID,);
countSendUser++;
}
}
if (countSendUser >= 1)
{
//int remnantCount1 = totalSMS - countSMS;
//this.tbSmsCount.Text = remnantCount1.ToString();
smsInfo.UpdateCountSMSInfo(countSendUser, 0, int.Parse(Request.QueryString[0].ToString()));
smsInfo.ChangeSMSFlagAndSetSendManID(smsID, userID);//AreadySendSMS.aspx?SMSType=1
Response.Write("<script language='javascript'>alert('发送短信成功!');</script>");//SubmisionMsg.aspx?SMSType=1
string url = string.Format("<script>window.location.href ='SubmisionMsg.aspx?SMSType={0}'</script>", Request.QueryString[2].ToString());
Response.Write("<script>top.Title.window.location='../TreeViewPage.aspx'</script>");
Response.Write(url);
}
else
{
this.label.Text = "<script language='javascript'>alert('请选择要发送的用户!');</script>";
string url = string.Format("<script>window.location.href ='SubmisionMsg.aspx?SMSType={0}'</script>", Request.QueryString[2].ToString());
Response.Write(url);
}
}
else
{
int remnantCount1 = totalSMS - countSMS;
this.tbSmsCount.Text = remnantCount1.ToString();
//int remnantCount = 15 - count;//当前可以发的条数:'+remnantCount(15-count)'你所发短信已超出充许的最大条数!当前可以发的条数:'
this.label.Text = "<script language='javascript'>alert('你所发短信已超出充许的最大条数!');</script>";
}
}
catch
{
Response.Write("<script language='javascript'>alert('发送短信失败!');</script>");
string url = string.Format("<script>window.location.href ='SubmisionMsg.aspx?SMSType={0}'</script>", Request.QueryString[2].ToString());
Response.Write(url);
}
}
#endregion
#endregion
#region 客户操作
#region 客户信息gridview
private void GetCustomerInfo()
{
this.lbworker.Visible = false;
GridView2.Columns[2].Visible = true;
userInfoAccessor = new DataAccess.TableAccessor.UserInfo();
DataTable filterTeble = userInfoAccessor.GetCustomerInfo();
filterTeble.Columns.Add("UserDefineID", typeof(int));
if (filterTeble.Rows.Count == 0)
{
Panel2.Visible = false;
Label2.Visible = true;
}
else
{
this.Panel2.Visible = true;
this.Label2.Visible = false;
}
string filterStr = " (1=1)";
if (cbUserTeam.SelectedValue != "")
filterStr += string.Format(" AND (TypeName = '{0}')", cbCust.SelectedItem.Text);
if (cbDept.SelectedValue != "")
filterStr += string.Format(" AND (GroupName = '{0}')", group.SelectedItem.Text);
if (cbSex.SelectedValue != "")
filterStr += string.Format(" AND (Sex = '{0}')", ddsex.SelectedValue);
if (tbName.Text != "")
filterStr += string.Format(" AND (Name LIKE '%{0}%')", tbCustName.Text);
if (tbDuty.Text != "")
filterStr += string.Format(" AND (Duty LIKE '%{0}%')", zhiwu.Text);
DataView dv = filterTeble.DefaultView;
dv.RowFilter = filterStr;
dv.Sort = "Customerlocation ASC";
for (int i = 0; i < dv.Count; i++)
{
dv[i]["UserDefineID"] = i + 1;
}
GridView2.DataSource = dv;
GridView2.DataBind();
GridView2.Columns[2].Visible = false;
GridView2.Columns[8].Visible = false;
}
protected void btnAllData_Click(object sender, EventArgs e)
{
GetCustomerInfo();
}
protected void btsearch_Click(object sender, EventArgs e)
{
GetCustomerInfo();
}
#endregion
#region 客户下拉框邦定
private void FillType()
{
DataAccess.TableAccessor.CountyVillage countyVillage = new DataAccess.TableAccessor.CountyVillage();
cbCust.DataTextField = "TypeName";
cbCust.DataValueField = "TypeID";
cbCust.DataSource = countyVillage.GetcoustomertypeInfo();
cbCust.DataBind();
cbCust.Items.Insert(0, "");
ddsex.Items.Insert(0, "");
ddsex.Items.Insert(1, "男");
ddsex.Items.Insert(2, "女");
}
protected void cbCust_SelectedIndexChanged(object sender, EventArgs e)
{
group.Items.Clear();
if (ddsex.SelectedValue != "")
{
int userTeamID = int.Parse(ddsex.SelectedValue);
DataAccess.TableAccessor.UserConporation userCorporation = new DataAccess.TableAccessor.UserConporation();
group.DataTextField = "GroupName";
group.DataValueField = "GroupID";
group.DataSource = userCorporation.GetMostGroupByTypeID(userTeamID);
group.DataBind();
group.Items.Insert(0, "");
}
}
#endregion
#region 客户选择
private int CheckUserID(GridView gridView)
{
int check = 0;
int count = 0;
for (int j = 0; j < GridView2 .Rows.Count; j++)
{
CheckBox ckb = (CheckBox)GridView2.Rows[j].FindControl("chk");
if (ckb.Checked)
{
check = int.Parse(GridView2.Rows[j].Cells[2].Text);
count++;
}
}
if (count > 1)
return 0;
else if (count == 0)
return 0;
else
return check;
}
protected void selectAll_Click(object sender, EventArgs e)
{
for (int t = 0; t < GridView2.Rows.Count; t++)
{
CheckBox ckbs = (CheckBox)GridView2.Rows[t].FindControl("chk");
ckbs.Checked = true;
}
}
#endregion
#region 客户提交
protected void btnUpdate_Click(object sender, EventArgs e)
{
DataAccess.TableAccessor.SMSInfo smsInfo = new DataAccess.TableAccessor.SMSInfo();
DataAccess.CookieAccessor cookieAccessor = new DataAccess.CookieAccessor();
int smsID = int.Parse(Request.QueryString[0].ToString());
int submitUserID = cookieAccessor.GetLoginUserOperationID();
string SMSType = Request.QueryString[2].ToString();
//DataTable dt = userInfoAccessor.GetCustomerInfo();
//string typeN = dt.Rows[0]["TypeName"].ToString();
//int checkValue = 0;
int checkCount = 0;
int userId = 0;
int custId = 0;
try
{
for (int i = 0; i < GridView2.Rows.Count; i++)
{
CheckBox ckb = (CheckBox)GridView2.Rows[i].FindControl("chk");
if (ckb.Checked)
{
custId = int.Parse(GridView2.Rows[i].Cells[2].Text);
string typeN = GridView2.Rows[i].Cells[3].Text.ToString();
string mobile = GridView2.Rows[i].Cells[8].Text.ToString();
string name = GridView2.Rows[i].Cells[6].Text.ToString();
checkCount++;
smsSendUserList.AddSMSSendUserList(smsID, userId, custId,typeN ,mobile,name);
}
}
if (checkCount >= 1)
{
//9-7
// smsInfo.ChangeSMSFlag(smsID, 1, submitUserID);//MsgManagement/SMSSend.aspx?smsID=51&operationid=1
Response.Write("<script language='javascript'>alert('提交短信成功!');</script>");///ReadySMS.aspx?SMSType=1&operationID=0
String url = String.Format("<script>window.location.href ='SMSEdit.aspx?SMSTyp={0}&operationID={1}&smsID={2}'</script>", Request.QueryString[2].ToString(), Request.QueryString[1].ToString(), smsID);
Response.Write(url);
}
else
{
this.label.Text = "<script language='javascript'>alert('请选择要发送的用户!');</script>";
}
}
catch
{
Response.Write("<script language='javascript'>alert('提交短信失败!');</script>");
String url = String.Format("<script>window.location.href ='SMSEdit.aspx?SMSTyp={0}&operationID={1}&smsID=0'</script>", Request.QueryString[2].ToString(), Request.QueryString[1].ToString());
Response.Write(url);
}
}
#endregion
#endregion
#region
protected void GridView2_SelectedIndexChanged(object sender, EventArgs e)
{
}
protected void ddsex_SelectedIndexChanged(object sender, EventArgs e)
{
}
protected void ddPerson_SelectedIndexChanged(object sender, EventArgs e)
{
if (ddPerson.SelectedValue == "")
{
this.lbworker.Visible = false;
this.lbcustomer.Visible = false;
}
else if (ddPerson.SelectedValue == "职工信息")
{
int operationID = int.Parse(Request.QueryString[1].ToString());
this.lbworker.Visible = true;
this.lbcustomer.Visible = false;
FillComboBox();
Panel1.Visible = false;
if (operationID == 1)
{
this.word.Visible = false;
btnSend.Visible = false;
btnSubmit.Visible = true;
}
else if (operationID == 2)
{
this.word.Visible = true;
btnSend.Visible = true;
btnSubmit.Visible = false;
GetSendUserList();
}
}
else if (ddPerson.SelectedValue == "客户信息")
{
this.lbworker.Visible = false;
this.lbcustomer.Visible = true;
GetCustomerInfo();
}
}
#endregion
protected void Btall_Click(object sender, EventArgs e)
{
for (int i = 0; i < GridView2.Rows.Count; i++)
{
CheckBox ckb = (CheckBox)GridView2.Rows[i].FindControl("chk");
ckb.Checked = true;
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?