protected void btn_Sub_Out_Click(object sender, EventArgs e) { ZWL.BLL.ERPMobile MyModel = new ZWL.BLL.ERPMobile(); MyModel.ToUserList = this.TextBox3.Text; MyModel.ContentStr = this.TextBox4.Text; MyModel.FaSongUser = ZWL.Common.PublicMethod.GetSessionValue("UserName"); //Mobile.SendSMS2(MyModel.FaSongUser, MyModel.ToUserList, MyModel.ContentStr); string WrongUser = Mobile.send(TextBox3.Text.Trim(), MyModel.ContentStr); //发送人和发送内容 MyModel.ToUserList = "外部人员:" + this.TextBox3.Text; MyModel.Add(); if(WrongUser.Trim() == "发送成功") { ZWL.Common.MessageBox.ShowAndRedirect(this, "手机短信发送成功!", "MobileSms.aspx"); } else if(WrongUser.Trim() == "号码过多") { ZWL.Common.MessageBox.ShowAndRedirect(this, "手机短信发送失败!失败原因:号码过多。", "MobileSms.aspx"); } else if(WrongUser.Trim() == "号码不正确") { ZWL.Common.MessageBox.ShowAndRedirect(this, "手机短信发送失败!失败原因:号码不正确。", "MobileSms.aspx"); } else { ZWL.Common.MessageBox.ShowAndRedirect(this, "手机短信发送失败!失败原因:" + WrongUser + "。", "MobileSms.aspx"); } //写系统日志 ZWL.BLL.ERPRiZhi MyRiZhi = new ZWL.BLL.ERPRiZhi(); MyRiZhi.UserName = ZWL.Common.PublicMethod.GetSessionValue("UserName"); MyRiZhi.DoSomething = "用户添加新外部手机短信(" + this.TextBox4.Text + ")"; MyRiZhi.IpStr = System.Web.HttpContext.Current.Request.UserHostAddress.ToString(); MyRiZhi.Add(); Response.Write("<script>alert('手机短信发送成功!');window.location.href='MobileSms.aspx'</script>"); //ZWL.Common.MessageBox.ShowAndRedirect(this, "手机短信发送成功!", "MobileSms.aspx"); }
protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { ZWL.BLL.ERPMobile MyModel = new ZWL.BLL.ERPMobile(); MyModel.ToUserList = this.TextBox1.Text.Trim(); MyModel.ContentStr = this.TextBox2.Text.Trim(); MyModel.FaSongUser = ZWL.Common.PublicMethod.GetSessionValue("UserName"); //Mobile.SendSMS(MyModel.FaSongUser, MyModel.ToUserList, MyModel.ContentStr); string WrongUser = Mobile.UserToTel(MyModel.ToUserList, MyModel.ContentStr); //发送人名,发送内容 MyModel.ToUserList = "内部人员:" + this.TextBox1.Text; MyModel.Add(); if (WrongUser.Trim() == "0") { } else if (WrongUser.Trim() == "1") { ZWL.Common.MessageBox.ShowAndRedirect(this, "手机短信发送成功!", "MobileSms.aspx"); } else { ZWL.Common.MessageBox.ShowAndRedirect(this, "手机短信发送成功,其中" + WrongUser.Trim() + "手机号码有误!", "MobileSms.aspx"); } //写系统日志 ZWL.BLL.ERPRiZhi MyRiZhi = new ZWL.BLL.ERPRiZhi(); MyRiZhi.UserName = ZWL.Common.PublicMethod.GetSessionValue("UserName"); MyRiZhi.DoSomething = "用户添加新内部手机短信(" + this.TextBox2.Text + ")"; MyRiZhi.IpStr = System.Web.HttpContext.Current.Request.UserHostAddress.ToString(); MyRiZhi.Add(); //ZWL.Common.MessageBox.ShowAndRedirect(this, "手机短信发送成功!", "MobileSms.aspx"); }
protected void btn_Sub_In_Click(object sender, EventArgs e) { ZWL.BLL.ERPMobile MyModel = new ZWL.BLL.ERPMobile(); MyModel.ToUserList = this.TextBox1.Text.Trim(); MyModel.ContentStr = this.TextBox2.Text.Trim(); MyModel.FaSongUser = ZWL.Common.PublicMethod.GetSessionValue("UserName"); //Mobile.SendSMS(MyModel.FaSongUser, MyModel.ToUserList, MyModel.ContentStr); string WrongUser = Mobile.UserToTel(MyModel.ToUserList, MyModel.ContentStr); //发送人名,发送内容 MyModel.ToUserList = "内部人员:" + this.TextBox1.Text; MyModel.Add(); if(WrongUser.Trim() == "0") { } else if(WrongUser.Trim() == "1") { Response.Write("<script>alert('手机短信发送成功!');window.location.href='MobileSms.aspx'</script>"); //ZWL.Common.MessageBox.ShowAndRedirect(this, "手机短信发送成功!", "MobileSms.aspx"); } else { Response.Write("<script>alert('手机短信发送成功,其中" + WrongUser.Trim() + "手机号码有误!');window.location.href='MobileSms.aspx'</script>"); //ZWL.Common.MessageBox.ShowAndRedirect(this, "手机短信发送成功,其中" + WrongUser.Trim() + "手机号码有误!", "MobileSms.aspx"); } //写系统日志 ZWL.BLL.ERPRiZhi MyRiZhi = new ZWL.BLL.ERPRiZhi(); MyRiZhi.UserName = ZWL.Common.PublicMethod.GetSessionValue("UserName"); MyRiZhi.DoSomething = "用户添加新内部手机短信(" + this.TextBox2.Text + ")"; MyRiZhi.IpStr = System.Web.HttpContext.Current.Request.UserHostAddress.ToString(); MyRiZhi.Add(); Response.Write("<script>alert('手机短信发送成功!');window.location.href='MobileSms.aspx'</script>"); //ZWL.Common.MessageBox.ShowAndRedirect(this, "手机短信发送成功!", "MobileSms.aspx"); }
protected void ImageButton2_Click(object sender, EventArgs e) { ZWL.BLL.ERPMobile MyModel = new ZWL.BLL.ERPMobile(); MyModel.ToUserList = this.TextBox3.Text; MyModel.ContentStr = this.TextBox4.Text; MyModel.FaSongUser = ZWL.Common.PublicMethod.GetSessionValue("UserName"); Mobile.SendSMS2(MyModel.FaSongUser, MyModel.ToUserList, MyModel.ContentStr); MyModel.ToUserList = "外部人员:" + this.TextBox3.Text; MyModel.Add(); //写系统日志 ZWL.BLL.ERPRiZhi MyRiZhi = new ZWL.BLL.ERPRiZhi(); MyRiZhi.UserName = ZWL.Common.PublicMethod.GetSessionValue("UserName"); MyRiZhi.DoSomething = "用户添加新外部手机短信(" + this.TextBox4.Text + ")"; MyRiZhi.IpStr = System.Web.HttpContext.Current.Request.UserHostAddress.ToString(); MyRiZhi.Add(); ZWL.Common.MessageBox.ShowAndRedirect(this, "手机短信发送成功!", "MobileSms.aspx"); }
protected void btn_Sub_Out_Click(object sender, EventArgs e) { ZWL.BLL.ERPMobile MyModel = new ZWL.BLL.ERPMobile(); MyModel.ToUserList = this.TextBox3.Text; MyModel.ContentStr = this.TextBox4.Text; MyModel.FaSongUser = ZWL.Common.PublicMethod.GetSessionValue("UserName"); //Mobile.SendSMS2(MyModel.FaSongUser, MyModel.ToUserList, MyModel.ContentStr); string WrongUser = Mobile.send(TextBox3.Text.Trim(), MyModel.ContentStr); //发送人和发送内容 MyModel.ToUserList = "外部人员:" + this.TextBox3.Text; MyModel.Add(); if (WrongUser.Trim() == "发送成功") { ZWL.Common.MessageBox.ShowAndRedirect(this, "手机短信发送成功!", "MobileSms.aspx"); } else if (WrongUser.Trim() == "号码过多") { ZWL.Common.MessageBox.ShowAndRedirect(this, "手机短信发送失败!失败原因:号码过多。", "MobileSms.aspx"); } else if (WrongUser.Trim() == "号码不正确") { ZWL.Common.MessageBox.ShowAndRedirect(this, "手机短信发送失败!失败原因:号码不正确。", "MobileSms.aspx"); } else { ZWL.Common.MessageBox.ShowAndRedirect(this, "手机短信发送失败!失败原因:" + WrongUser + "。", "MobileSms.aspx"); } //写系统日志 ZWL.BLL.ERPRiZhi MyRiZhi = new ZWL.BLL.ERPRiZhi(); MyRiZhi.UserName = ZWL.Common.PublicMethod.GetSessionValue("UserName"); MyRiZhi.DoSomething = "用户添加新外部手机短信(" + this.TextBox4.Text + ")"; MyRiZhi.IpStr = System.Web.HttpContext.Current.Request.UserHostAddress.ToString(); MyRiZhi.Add(); Response.Write("<script>alert('手机短信发送成功!');window.location.href='MobileSms.aspx'</script>"); //ZWL.Common.MessageBox.ShowAndRedirect(this, "手机短信发送成功!", "MobileSms.aspx"); }
protected void ImageButton2_Click(object sender, ImageClickEventArgs e) { ZWL.BLL.ERPMobile MyModel = new ZWL.BLL.ERPMobile(); MyModel.ToUserList = this.TextBox3.Text; MyModel.ContentStr = this.TextBox4.Text; MyModel.FaSongUser = ZWL.Common.PublicMethod.GetSessionValue("UserName"); Mobile.SendSMS2(MyModel.FaSongUser, MyModel.ToUserList, MyModel.ContentStr); MyModel.ToUserList = "外部人员:" + this.TextBox3.Text; MyModel.Add(); //写系统日志 ZWL.BLL.ERPRiZhi MyRiZhi = new ZWL.BLL.ERPRiZhi(); MyRiZhi.UserName = ZWL.Common.PublicMethod.GetSessionValue("UserName"); MyRiZhi.DoSomething = "用户添加新外部手机短信(" + this.TextBox4.Text + ")"; MyRiZhi.IpStr = System.Web.HttpContext.Current.Request.UserHostAddress.ToString(); MyRiZhi.Add(); ZWL.Common.MessageBox.ShowAndRedirect(this, "手机短信发送成功!", "MobileSms.aspx"); }
public static String UserToTel(string UserList, string SendContent) //将选择的人名转换为电话列表并发送 //发送人列表,发送内容 { //SendContent += "【协同办公】"; //string UserListOk = ""; //用户名列表 //string OneUser = ""; //记录用户 //int OnUser = 0; //为1表示用户名 //for (int i = 0; i < UserList.Length; i++) //{ // if (UserList[i] == '(') { OnUser = 1; } // else if (UserList[i] == ')') // { // OnUser = 0; // if (UserListOk.Trim() != "") { UserListOk += ","; } // UserListOk += "'" + OneUser + "'"; // OneUser = ""; // } // if (UserList[i] != '(' && UserList[i] != ')' && OnUser != 0) // { // OneUser += UserList[i]; // } //} string StrMobile = ""; string WrongUser = ""; DataSet MyDT = ZWL.DBUtility.DbHelperSQL.GetDataSet("select JiaTingDianHua from ERPUser where UserName in('" + UserList.Replace(",", "','") + "')"); for (int i = 0; i < MyDT.Tables[0].Rows.Count; i++) { if (!string.IsNullOrEmpty(MyDT.Tables[0].Rows[i]["JiaTingDianHua"].ToString())) { if (StrMobile != "") { StrMobile += ","; } StrMobile += MyDT.Tables[0].Rows[i]["JiaTingDianHua"].ToString().Trim(); } } /* * DataSet MobileList = ZWL.DBUtility.DbHelperSQL.GetDataSet("select UI_strTrueName,UI_cTel from UserInfo where UI_nActive = 1 and UI_strLoginName in (" + UserList + ")"); * * if (MobileList.Tables[0].Rows.Count > 30) * { * System.Web.HttpContext.Current.Response.Write("<script>alert('超出人员上限(30人)!');</script>"); * return "0"; * } * for (int i = 0; i < MobileList.Tables[0].Rows.Count; i++) * { * if (MobileList.Tables[0].Rows[i]["UI_cTel"].ToString().Trim() == "" || Mobile.GetCount(MobileList.Tables[0].Rows[i]["UI_cTel"].ToString().Trim()) == 0) //表示不是正确的手机号 * { * if (WrongUser != "") { WrongUser += ","; } * WrongUser += MobileList.Tables[0].Rows[i]["UI_strTrueName"].ToString().Trim(); * } * else //表示手机号没有问题 * { * if (StrMobile != "") { StrMobile += ","; } * StrMobile += MobileList.Tables[0].Rows[i]["UI_cTel"].ToString().Trim(); * } * }*/ if (StrMobile == "") { System.Web.HttpContext.Current.Response.Write("<script>alert('选择用户的手机号码有误,请确定!');</script>"); return("0"); } ZWL.BLL.ERPMobile MyModel = new ZWL.BLL.ERPMobile(); MyModel.ToUserList = UserList; //发送人 //MyModel.Active = 1; MyModel.ContentStr = SendContent; //发送内容 MyModel.FaSongUser = ZWL.Common.PublicMethod.GetSessionValue("UserName").ToString().Trim(); //发送人 //MyModel.Count = GetCount(StrMobile); //发送条数 // MyModel.TypeStr = Mobile.send(StrMobile, MyModel.ContentStr); //发送人和发送内容,返回发送状态 string TypeStr = Mobile.send(StrMobile, MyModel.ContentStr); //发送人和发送内容,返回发送状态 if (TypeStr == "发送失败") { TypeStr = Mobile.send(StrMobile, MyModel.ContentStr); } if (TypeStr == "发送失败") { TypeStr = Mobile.send(StrMobile, MyModel.ContentStr); } MyModel.Add(); //写系统日志 ZWL.BLL.ERPRiZhi MyRiZhi = new ZWL.BLL.ERPRiZhi(); MyRiZhi.UserName = ZWL.Common.PublicMethod.GetSessionValue("UserName"); MyRiZhi.DoSomething = "用户发送短信(" + UserList + ")"; MyRiZhi.IpStr = System.Web.HttpContext.Current.Request.UserHostAddress.ToString(); MyRiZhi.Add(); if (WrongUser.Trim() == "") { return("1"); } else { return(WrongUser.Trim()); } }
//将选择的人名转换为电话列表并发送 //发送人列表,发送内容 public static String UserToTel(string UserList, string SendContent) { //SendContent += "【协同办公】"; //string UserListOk = ""; //用户名列表 //string OneUser = ""; //记录用户 //int OnUser = 0; //为1表示用户名 //for (int i = 0; i < UserList.Length; i++) //{ // if (UserList[i] == '(') { OnUser = 1; } // else if (UserList[i] == ')') // { // OnUser = 0; // if (UserListOk.Trim() != "") { UserListOk += ","; } // UserListOk += "'" + OneUser + "'"; // OneUser = ""; // } // if (UserList[i] != '(' && UserList[i] != ')' && OnUser != 0) // { // OneUser += UserList[i]; // } //} string StrMobile = ""; string WrongUser = ""; DataSet MyDT = ZWL.DBUtility.DbHelperSQL.GetDataSet("select JiaTingDianHua from ERPUser where UserName in('" + UserList.Replace(",", "','") + "')"); for (int i = 0; i < MyDT.Tables[0].Rows.Count; i++) { if (!string.IsNullOrEmpty(MyDT.Tables[0].Rows[i]["JiaTingDianHua"].ToString())) { if (StrMobile != "") { StrMobile += ","; } StrMobile += MyDT.Tables[0].Rows[i]["JiaTingDianHua"].ToString().Trim(); } } /* DataSet MobileList = ZWL.DBUtility.DbHelperSQL.GetDataSet("select UI_strTrueName,UI_cTel from UserInfo where UI_nActive = 1 and UI_strLoginName in (" + UserList + ")"); if (MobileList.Tables[0].Rows.Count > 30) { System.Web.HttpContext.Current.Response.Write("<script>alert('超出人员上限(30人)!');</script>"); return "0"; } for (int i = 0; i < MobileList.Tables[0].Rows.Count; i++) { if (MobileList.Tables[0].Rows[i]["UI_cTel"].ToString().Trim() == "" || Mobile.GetCount(MobileList.Tables[0].Rows[i]["UI_cTel"].ToString().Trim()) == 0) //表示不是正确的手机号 { if (WrongUser != "") { WrongUser += ","; } WrongUser += MobileList.Tables[0].Rows[i]["UI_strTrueName"].ToString().Trim(); } else //表示手机号没有问题 { if (StrMobile != "") { StrMobile += ","; } StrMobile += MobileList.Tables[0].Rows[i]["UI_cTel"].ToString().Trim(); } }*/ if (StrMobile == "") { System.Web.HttpContext.Current.Response.Write("<script>alert('选择用户的手机号码有误,请确定!');</script>"); return "0"; } ZWL.BLL.ERPMobile MyModel = new ZWL.BLL.ERPMobile(); MyModel.ToUserList = UserList; //发送人 //MyModel.Active = 1; MyModel.ContentStr = SendContent; //发送内容 MyModel.FaSongUser = ZWL.Common.PublicMethod.GetSessionValue("UserName").ToString().Trim(); //发送人 //MyModel.Count = GetCount(StrMobile); //发送条数 // MyModel.TypeStr = Mobile.send(StrMobile, MyModel.ContentStr); //发送人和发送内容,返回发送状态 string TypeStr = Mobile.send(StrMobile, MyModel.ContentStr); //发送人和发送内容,返回发送状态 if (TypeStr == "发送失败") { TypeStr = Mobile.send(StrMobile, MyModel.ContentStr); } if (TypeStr == "发送失败") { TypeStr = Mobile.send(StrMobile, MyModel.ContentStr); } MyModel.Add(); //写系统日志 ZWL.BLL.ERPRiZhi MyRiZhi = new ZWL.BLL.ERPRiZhi(); MyRiZhi.UserName = ZWL.Common.PublicMethod.GetSessionValue("UserName"); MyRiZhi.DoSomething = "用户发送短信(" + UserList + ")"; MyRiZhi.IpStr = System.Web.HttpContext.Current.Request.UserHostAddress.ToString(); MyRiZhi.Add(); if (WrongUser.Trim() == "") { return "1"; } else { return WrongUser.Trim(); } }