using System; using System.Collections.Generic; using System.Data; using System.Linq; using System.Net; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; namespace BCD.admin { public partial class paymentdue : System.Web.UI.Page { Class1 obj = new Class1(); protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { HealthNewsdata(); } } public void HealthNewsdata() { string qrajneeti = "select * from Memberslist where subscription_upto < CONVERT (varchar(10), getdate(), 101) order by id desc"; DataSet dsrajneeti = obj.ReturnDataSet(qrajneeti); if (dsrajneeti != null && dsrajneeti.Tables[0].Rows.Count > 0) { Label5.Text = dsrajneeti.Tables[0].Rows.Count.ToString(); Label6.Text = Convert.ToString(Convert.ToInt32(dsrajneeti.Tables[0].Rows.Count.ToString()) * 500); DataGrid2.DataSource = dsrajneeti; DataGrid2.DataBind(); DataGrid2.Visible = true; } else { DataGrid2.Visible = false; } } protected void DataGrid2_PageIndexChanged(object source, DataGridPageChangedEventArgs e) { if (DataGrid2.Items.Count >= 0) { DataGrid2.CurrentPageIndex = e.NewPageIndex; HealthNewsdata(); } } protected void Button1_Click(object sender, EventArgs e) { string empty = ""; if (TextBox1.Text != "") { empty = empty + " and name_of_advocate like '%" + TextBox1.Text + "%'"; } if (TextBox2.Text != "") { empty = empty + " and Mobile_No = '" + TextBox2.Text + "'"; } if (TextBox3.Text != "") { empty = empty + " and Enroll_id = '" + TextBox3.Text + "'"; } string qrajneeti = "select * from Memberslist where subscription_upto < CONVERT (varchar(10), getdate(), 101) " + empty + " order by id desc"; DataSet dsrajneeti = obj.ReturnDataSet(qrajneeti); if (dsrajneeti != null && dsrajneeti.Tables[0].Rows.Count > 0) { DataGrid2.DataSource = dsrajneeti; DataGrid2.DataBind(); DataGrid2.Visible = true; } else { DataGrid2.Visible = false; } } protected void Button2_Click(object sender, EventArgs e) { string qrajneeti = "select top 200 * from Memberslist where subscription_upto < CONVERT (varchar(10), getdate(), 101) and mssgstatus='No' order by id desc"; DataSet dsrajneeti = obj.ReturnDataSet(qrajneeti); if (dsrajneeti != null && dsrajneeti.Tables[0].Rows.Count > 0) { for(int i = 0;i< dsrajneeti.Tables[0].Rows.Count;i++) { string mn = dsrajneeti.Tables[0].Rows[i]["NewMobile_No"].ToString(); string emn = dsrajneeti.Tables[0].Rows[i]["Enroll_id"].ToString().Replace("/","!"); // mn = "9871482014"; string links = "www.awftc.com/"+ emn; string messag = "This is to inform you that your Subscription for Advocate Welfare Fund has become due. Kindly submit a sum of Rs.500/- for a period of 10 years @ Rs. 50/- per year, at the earliest online/offline via this link "+links+" \r\nKumar Mukesh\r\nHony. Secretary\r\nBar Council of Delhi"; string SmsStatusMsg = string.Empty; try { WebClient client = new WebClient(); string URL = "http://hindit.co.in/API/pushsms.aspx?loginID=T1BarCouncil&password=482014&mobile=" + mn+"&text="+messag+ "&senderid=AWFTCD&route_id=3&Unicode=0&IP=122.1.1.1&Template_id=1707169166099559685"; SmsStatusMsg = client.DownloadString(URL); if (SmsStatusMsg.Contains("
")) { SmsStatusMsg = SmsStatusMsg.Replace("
", ", "); } string ups = "update Memberslist set mssgstatus='Yes' where NewMobile_No='" + mn + "'"; obj.ReturnDataSet(ups); } catch (WebException e1) { SmsStatusMsg = e1.Message; } } } } } }