Dear Sir,
While i have send sms it's not sending due to mobile number not fetch from GridView.
Please help me sir.
namespace OCMS
{
public partial class admin : System.Web.UI.Page
{
SqlConnection con = new SqlConnection(@"Data Source=10.1.246.4;Initial Catalog=OCMS;User ID=dba_ntpc_meja_intranet;Password=alpha$890;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False");
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
refreshdata();
}
}
public void refreshdata()
{
con.Open();
//SqlCommand cmd = new SqlCommand("select * from comp_box where closing_date IS NULL ORDER BY COMP_ID DESC ", con);
SqlCommand cmd = new SqlCommand("select * from comp_box,emp where closing_date IS NULL and comp_box.emp_id=emp.emp_id order by comp_lodge_date desc", con);
SqlDataAdapter sda = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
sda.Fill(dt);
con.Close();
GridView1.DataSource = dt;
GridView1.DataBind();
}
protected void Closed(object sender, EventArgs e)
{
GridViewRow row = (sender as Button).NamingContainer as GridViewRow;
int COMP_ID = Convert.ToInt32(GridView1.DataKeys[Convert.ToInt32((sender as Button).CommandArgument)].Values[0]);
string STATUS_ID = "02";
string remark = (row.FindControl("TextBox5") as TextBox).Text;
string CLOSING_DATE = DateTime.Now.ToString();
string constr = ConfigurationManager.ConnectionStrings["constr"].ConnectionString;
using (SqlConnection con = new SqlConnection(constr))
{
using (SqlCommand cmd = new SqlCommand("UPDATE comp_box SET STATUS_ID = @STATUS_ID, REMARKS = @REMARKS,CLOSING_DATE = @CLOSING_DATE WHERE COMP_ID = @COMP_ID"))
{
cmd.Parameters.AddWithValue("@COMP_ID", COMP_ID);
cmd.Parameters.AddWithValue("@STATUS_ID", STATUS_ID);
cmd.Parameters.AddWithValue("@REMARKS", remark);
cmd.Parameters.AddWithValue("@CLOSING_DATE", CLOSING_DATE);
cmd.Connection = con;
con.Open();
cmd.ExecuteNonQuery();
con.Close();
string PHONE_MOB = row.Cells[4].Text;
string SMSurl = "http://185.255.8.59/sms/1/text/query?username=NTpc&password=NTpc@321&from=MUNPLA&to= + PHONE_MOB + &text=Your OCMS Complaint No:" + COMP_ID + " has been resolved successfully - Meja Urja Nigam PVT. LTD. &indiaDltContentTemplateId=1207164466650628862&indiaDltPrincipalEntityId=1201159222154902387";
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(SMSurl);
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
StreamReader sr = new StreamReader(response.GetResponseStream());
GridView1.EditIndex = -1;
row.Visible = false;
}
}
}
}
}