using System; using System.Collections.Generic; using System.Data; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; namespace Newdelhibarassocia.dhadmin { public partial class billtypepayment : System.Web.UI.Page { Class1 obj = new Class1(); protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { HealthNewsdata(); billtypedatak(); } } public void HealthNewsdata() { string qrajneeti = "select top 50 * from newdelhibar_bill 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 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 Billno = '" + TextBox1.Text + ""; } if (TextBox2.Text != "") { empty = empty + " and Mobile = '" + TextBox2.Text + "'"; } if (TextBox3.Text != "") { empty = empty + " and BCDno = '" + TextBox3.Text + "'"; } if (TextBox5.Text != "") { empty = empty + " and Ndbano = '" + TextBox5.Text + "'"; } string qrajneeti = "select * from newdelhibar_bill where id!='0' " + 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 DropDownList2_SelectedIndexChanged(object sender, EventArgs e) { string qrajneeti = "select * from newdelhibar_bill where Paymentmode='" + DropDownList2.SelectedValue + "' 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; } } void billtypedatak() { string qrajneeti = "select * from tb_billmaster order by id desc"; DataSet dsrajneeti = obj.ReturnDataSet(qrajneeti); if (dsrajneeti != null && dsrajneeti.Tables[0].Rows.Count > 0) { DropDownList1.Visible = true; DropDownList1.DataSource = dsrajneeti; DropDownList1.DataTextField = "btype"; DropDownList1.DataValueField = "btype"; DropDownList1.DataBind(); DropDownList1.Items.Insert(0, "Select"); } } protected void Button2_Click(object sender, EventArgs e) { string qrajneeti = "select * from newdelhibar_bill where Daten='" + TextBox4.Text + "' 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 DropDownList1_SelectedIndexChanged(object sender, EventArgs e) { string qrajneeti = "select * from newdelhibar_bill where btype='" + DropDownList1.SelectedValue + "' 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; } } } }