Home > database >  Messages with a simple delivery status authentication single debug execution time is no problem, but
Messages with a simple delivery status authentication single debug execution time is no problem, but

Time:02-27



Using System;
Using System. Collections. Generic;
Using System. Linq;
Using System. The Text;
using System.Net;
Using System. IO;
Using System. The Data;
Using Oracle. ManagedDataAccess. Client;
Using System. Text. RegularExpressions;

The namespace ConsoleApp1
{
Class Program
{
The static void Main (string [] args)
{
String the ConnectionString="there is no problem";//write connection string
OracleConnection conn=new OracleConnection (the ConnectionString);//create a new connection
Try
{

conn.Open();
OracleCommand CMD=new OracleCommand (" select Amy polumbo hone_no AS NO, arjun essage AS SMS, arjun ess_id AS fsid, Anderson tem_no AS itno from message_rec_temp where a a.s end_flag='0' and a.s end_way=1 ' 'platform ", conn);

OracleDataAdapter sda=new OracleDataAdapter (CMD);
The DataTable ds=new DataTable ();

Sda. The Fill (ds);

Console. WriteLine (ds) Rows) Count);

For (int I=0; I & lt; Ds. Rows. Count; I++)
{
Console. WriteLine (I);
Console. WriteLine (ds) Rows [I] [0]).
Console. WriteLine (ds) Rows [I] [1]).
String MobileNum=ds. Rows [I] [0]. The ToString ();
The string content=ds. Rows [I] [1]. The ToString ();
String mseid=ds. Rows [I] [2]. The ToString ();
String itno=ds. Rows [I] [3]. The ToString ();
//Text. PostSendMessage (MobileNum, content);
//DateTime dt=DateTime. Now;
//string dt24=dt. ToString (" MM - dd yyyy - HH: MM: ss ");

String reas=Text. PostSendMessage (MobileNum, content);
//string reas="result=0 & amp; Description=send SMS success & amp; Taskid=10111820286222 ";
Console. WriteLine (reas);

String [] strArray=reas. Split (new string [] {& amp; "" , & amp; "" }, StringSplitOptions. RemoveEmptyEntries);
Console. WriteLine (strArray [1]);
Bool isContains=true;
If (strArray [1]. The Contains (" success "))
{
IsContains=true;
}
The else
{
IsContains=false;

}

.//var index=StringA IndexOf (" result=0 ");

//bool isContains=reas. IndexOf (" success ", StringComparison. OrdinalIgnoreCase) & gt; 0;//true a.s end_datetime sysdate=
If (isContains is true)
{
Cmd.Com mandText="update message_rec_temp a set a.s end_datetime=sysdate, a.s end_flag='1', arjun emo='" + reas +"' where Amy polumbo hone_no='" + MobileNum + "' and arjun ess_id='" + mseid + "' and Anderson TEM_NO='" + itno + "' and a.s end_flag='0' ";
CMD. ExecuteNonQuery ();
Successful Console. WriteLine (" contains ");

}
The else
{
Cmd.Com mandText="update message_rec_temp a set arjun emo='" + reas +"' where Amy polumbo HONE_NO='" + MobileNum + "' and arjun ESS_ID='" + mseid + "' and a.s end_flag='0' ";
CMD. ExecuteNonQuery ();
}


}
Console.ReadKey();





}
The catch (Exception ee)
{
//System. Diagnostics. Debug. WriteLine (ee) Message);//if there is an error, the output error message
Console. WriteLine (ee. Message);
}
The finally
{
Conn. Close ();//close the connection
}


}

Class Text//send here is also the normal
{
Public static string PostSendMessage (string MobileNum, string content)
{
The string url="http://js.ums86.com:8899/sms/Api/Send.do";
String Spcode="";//corporate account
String LoginName="";//user name
String Password="";//password
String MessageContent=content;//message content
String UserNumber=MobileNum;//phone number
String SerialNumber=DateTime. Now. ToString (" yyyyMMddHHmmssfff ") + "001";//serial number
String ScheduleTime="";//to make an appointment to send time
String ExtendAccessNum="";//access, extension,
The StringBuilder sb=new StringBuilder ();
Sb. Append (" SpCode="+ SpCode +" & amp; LoginName="+ LoginName +" & amp; Password="+" + "& amp; MessageContent MessageContent="+ +" & amp; UserNumber UserNumber="+ +" & amp; SerialNumber="+ SerialNumber +" & amp; ScheduleTime ScheduleTime="+ +" & amp; ExtendAccessNum ExtendAccessNum="+ +" & amp; F=1 ");
Byte [] bData=https://bbs.csdn.net/topics/Encoding.GetEncoding (" GBK "). GetBytes (sb. ToString ());
HttpWebRequest hwRequest;
HttpWebResponse hwResponse;
String strResult=string. The Empty;
Try
{
HwRequest=(HttpWebRequest) WebRequest. Create (url);
HwRequest. Method="POST";
HwRequest. ContentType="application/x - WWW - form - urlencoded";
HwRequest. ContentLength=bData. Length;
The Stream smWrite=hwRequest. GetRequestStream ();
SmWrite. Write (bData, 0, bData. Length);
SmWrite. Close ();
HwResponse=(HttpWebResponse) hwRequest. The method GetResponse ();
StreamReader srReader=new StreamReader (hwResponse GetResponseStream (), Encoding. The Default).
StrResult=srReader. ReadToEnd ();
SrReader. Close ();
HwResponse. Close ();
}
Catch
{; }
Return strResult;

}

}

}
}
  • Related