While have send SMS i have gettin mention error.
Server Error in '/' Application.
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. Compiler Error Message: CS1501: No overload for method 'sendSMS' takes 2 arguments Source Error:
|
Line 236:
Line 237:
Line 238: sendSMS(mob_nm.Trim(), "Monthly bill for the mobile number " + mob_nm + " currently used by " + lctn + " has been generated for date " + frm_dt + " to " + to_dt + " date . kindly verify the bill in MUNPL intranet " );
Line 239: dt.Clear();
Line 240: dt.Dispose();
|
Source File: c:\Users\Administrator\Documents\Visual Studio 2012\Projects\Mobile_detals\Mob_del_dtls\Mob_del_dtls\admn.aspx.cs Line: 23
namespace WebApplication13
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
//string message = "$#%^&*()?/|";
// Response.Write(sendSMS("+919999999999", Uri.EscapeDataString(message)));
if (Session["FirstName"] == null)
Response.Redirect("login1.aspx");
else
{
String EmplooyeId = Convert.ToString((int)Session["empid"]);
String FirstName = Session["FirstName"].ToString();
String LastName = Session["LastName"].ToString();
String Department = Session["Department"].ToString();
lbluserInfo.Text = "Department:- " + Department + ".";
Label1.Text = "Welcome Mr." + FirstName + " " + LastName + " ";
}
if (!this.IsPostBack)
{
this.BindGrid();
}
}
private void BindGrid()
{
string constr = ConfigurationManager.ConnectionStrings["constr"].ConnectionString;
using (SqlConnection con = new SqlConnection(constr))
{
using (SqlCommand cmd = new SqlCommand("SELECT Id, VEND_EMP, VEN_EMP_NAME, REF_NO, PARTICULARS, AMT,VEN_EMP_PHNO, VEN_EMP_EMAIL,EIC_PH_NO,EIC_MAIL_ID FROM MESSAGE_SYSTEM where flag <> 'Y'"))
{
using (SqlDataAdapter sda = new SqlDataAdapter())
{
cmd.Connection = con;
sda.SelectCommand = cmd;
using (DataTable dt = new DataTable())
{
sda.Fill(dt);
GridView1.DataSource = dt;
GridView1.DataBind();
}
}
}
}
}
protected void btnSendMail_Click(object sender, EventArgs e)
{
string Id = string.Empty;
DataTable dt = new DataTable();
try
{
foreach (GridViewRow row in GridView1.Rows)
{
//get Current EMAIL_ID from the DataKey
Id = Convert.ToString(GridView1.DataKeys[row.RowIndex].Value);
CheckBox cb = (CheckBox)row.FindControl("chkSelect");
string flag = cb.Checked ? "Y" : "N";
string constr = ConfigurationManager.ConnectionStrings["constr"].ConnectionString;
using (SqlConnection con = new SqlConnection(constr))
{
SqlCommand cmd = new SqlCommand("UPDATE MESSAGE_SYSTEM SET flag = @flag where Id=@Id");
cmd.Connection = con;
cmd.Parameters.AddWithValue("@flag", flag);
cmd.Parameters.AddWithValue("@Id", Id);
con.Open();
string isUpdated = Convert.ToString(cmd.ExecuteNonQuery());
con.Close();
}
if (cb.Checked)
{
using (SqlConnection con = new SqlConnection(constr))
{
SqlCommand cmd = new SqlCommand("select VEN_EMP_EMAIL,EIC_MAIL_ID, PARTICULARS, REF_NO,AMT, VEN_EMP_PHNO, EIC_PH_NO from MESSAGE_SYSTEM where Id=@Id", con);
cmd.Parameters.AddWithValue("@Id", Id);
SqlDataAdapter adp = new SqlDataAdapter(cmd);
//Fill datatable with EMAIL_ID corresponding to Current EMP_ID
adp.Fill(dt);
//Get EMAIL_ID into variable
string emailId = dt.Rows[0]["VEN_EMP_EMAIL"].ToString();
string emailId1 = dt.Rows[0]["EIC_MAIL_ID"].ToString();
string PARTICULARS = dt.Rows[0]["PARTICULARS"].ToString();
string AMT = dt.Rows[0]["AMT"].ToString();
string REF_NO = dt.Rows[0]["REF_NO"].ToString();
string[] num = REF_NO.Split('&').Select(n => (n.Trim())).ToArray();
string phoneNo = dt.Rows[0]["VEN_EMP_PHNO"].ToString();
string phoneNo1 = dt.Rows[0]["EIC_PH_NO"].ToString();
//write code to send mail
// string message = "$#%^&*()?/|";
SendEmailUsingGmail(emailId, PARTICULARS, AMT, REF_NO);
SendEmailUsingGmail(emailId1, PARTICULARS, AMT, REF_NO);
sendSMS(phoneNo.Trim(), "Amount of Rs " + AMT + " for " + PARTICULARS + " is sent to your Bank account against " + REF_NO + " ");
sendSMS(phoneNo1.Trim(), "Amount of Rs " + AMT + " for " + PARTICULARS + " is sent to your Bank account against " + REF_NO + " ");
dt.Clear();
dt.Dispose();
}
}
}
// ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('Payment Details Sent Successfully');", true);
}
catch (Exception ex)
{
Response.Write("Error occured: " + ex.Message.ToString());
}
finally
{
Id = string.Empty;
}
System.Threading.Thread.Sleep(5000);
}
static string sendSMS(string mobileNo, string messageTxt)
{
string SMSurl = "http://185.255.8.59/sms/1/text/query?username=NTpc&password=NTpc@321&to=" + mobileNo + "&text=" + messageTxt + " &from=MUNPLA & indiaDltContentTemplateId=@templateid&indiaDltPrincipalEntityId=1201159222154902387";
//string SMSurl = "https://82r89.api.infobip.com/sms/1/text/query?username=MUNPLA&password=Ashwini@085531&to=" + mobileNo + "&text=" + messageTxt + "&from=MUNPLA";
// string SMSurl = "http://smsdone.com/login/?callback=http%3A%2F%2Fsmsdone.com%2Fsettings%2Froundabout%3F?username=ntpc&password=NTpc@321&to=" + mobileNo + "&text=" + messageTxt + "&from=MUNPLA";
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(SMSurl);
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
StreamReader sr = new StreamReader(response.GetResponseStream());
return sr.ReadToEnd();
}
}
}