以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 求助:代码简化 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=131412) |
-- 作者:李孝春 -- 发布时间:2019/2/25 16:43:00 -- 求助:代码简化 选择干警信息表,如果行数大于零,则判断是否告知为否的 电子邮件不为空的发送邮件 同时电话不为空的发送短信 Dim rs As List(of Row) = Tables("干警信息").GetCheckedRows If rs.Count > 0 Then Dim dr1 As DataRow dr1 = DataTables("告知内容").Find("是否告知 = \'否\' ") If dr1 IsNot Nothing Then Dim tbl As Table = Tables("干警信息") For Each rw As Row In tbl.GetCheckedRows If rw("电子邮件") <> Nothing Then Dim ab As Row = Tables("系统信息").Current Dim drs = DataTables("告知内容").Select("姓名 = \'" & rw("姓名") & "\'And 是否告知 = \'是\' " ) For Each dr As DataRow In drs Functions.AsyncExecute("SendEmail",ab,rw,dr) Next End If 如果是案件承办人且电话不为空 就运行下面的代码 If dr1("人员类型")="案件承办人" Then If rw("电话") <> Nothing Then Dim ab As Row = Tables("系统信息").Current Dim drs = DataTables("告知内容").Select("姓名 = \'" & rw("姓名") & "\'And 是否告知 = \'否\' " ) For Each dr As DataRow In drs Dim t As Date= Date.Now Dim t1 As String =Format(Date.Now, "yyyMMddHHmmss") Dim Val As String = Rand.Next(1000) \' Dim s As String = val.PadLeft(4, "0") Dim password As String= ab("移动平台密码") Dim t2 As String = password & t1 & s Dim account As String = ab("移动平台账号") Dim serviceCode As String = ab("移动平台接入号") Dim authCode As String = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(t2, "MD5") Dim reqNo As String = t1 & s Dim sem As String = "【"& dr("姓名") & "】您好!" & dr("嫌疑人姓名") & "涉嫌" & dr("涉嫌案由") & "一案,瓮安县公安局于【" & dr("流程时间") & "】移送我院" & dr("流程名称") & ",根据系统轮案规则,现由你进行办理,请在【" & dr("到期日期") & "】前,办理完毕!有疑问请咨询案件管理办公室" & ab("案管办电话") & "!" Dim content As String =Functions.Execute("utf8",sem) Dim msisdn As String =rw("电话") Dim hc As New HttpClient("http://218.201.202.174:8900/smstemp/http/sendSms?account="&account.Trim()&"&reqNo="&reqNo.Trim()&"&authCode="&authCode.Trim()&"&serviceCode="&serviceCode.Trim()&"&msisdn="&msisdn.Trim()&"&c&msgType=0") Dim ret As String = hc.GetData() Dim Tel As String = ret Dim Parts() As String = Tel.Split("=") Dim Tel1 As String = Parts(1) Dim Parts1() As String = Tel1.Split(",") If parts1(0)=0 Then dr("是否告知")="是" Else dr("是否告知")="否" End If Next \' MessageBox.Show("当前信息已经全部告知","【温馨提示】") End If End If Next \'MessageBox.Show("当前没有选择用户","【温馨提示】") End If End If [此贴子已经被作者于2019/2/25 16:54:41编辑过]
|
-- 作者:有点蓝 -- 发布时间:2019/2/25 20:49:00 -- Dim ret As String = hc.GetData() Dim Parts() As String = ret.Split("=") Dim Parts1() As String = Parts(1).Split(",")
|