protected void bindgrid() { string gra = ""; if (filterschool.SelectedIndex > 0) { gra += " where BusinessID='" + filterschool.SelectedValue + "'"; } SqlCommand cmdc = new SqlCommand("SELECT tblBuilding.BuildingName,tblBuilding.ID,tblBuilding.BusinessID,WareHouseMaster.Name as School FROM tblBuilding inner join WareHouseMaster on tblBuilding.BusinessID=WareHouseMaster.WareHouseId" + gra + "", con); SqlDataAdapter dac = new SqlDataAdapter(cmdc); DataTable dtc = new DataTable(); dac.Fill(dtc); if (dtc.Rows.Count > 0) { GVC.DataSource = dtc; GVC.DataBind(); } else { GVC.DataSource = null; GVC.DataBind(); } }
protected void bindgrid() { PageConn pgcon = new PageConn(); con = pgcon.dynconn; string gra = ""; if (filterschool.SelectedIndex > 0) { gra += " where tblAnnouncementType.BusinessID='" + filterschool.SelectedValue + "'"; } SqlCommand cmdc = new SqlCommand("SELECT WareHouseMaster.Name as School,tblAnnouncementType.ID,tblAnnouncementType.AnnouncementType FROM tblAnnouncementType inner join WareHouseMaster on tblAnnouncementType.BusinessID=WareHouseMaster.WareHouseId " + gra + "", con); SqlDataAdapter dac = new SqlDataAdapter(cmdc); DataTable dtc = new DataTable(); dac.Fill(dtc); if (dtc.Rows.Count > 0) { GVC.DataSource = dtc; GVC.DataBind(); } else { GVC.DataSource = null; GVC.DataBind(); } }
protected void fillGVC() { string st1 = ""; lblstat.Text = "All"; if (ddlstatus_search.SelectedIndex > 0) { lblstat.Text = ddlstatus_search.SelectedItem.Text; st1 += " where BusinessCategory.Active='" + ddlstatus_search.SelectedValue + "'"; } SqlCommand cmdc = new SqlCommand("SELECT B_CatID,B_Category,case when(Active = '1') then 'Active' else 'Inactive' end as Active From BusinessCategory " + st1 + "", con); SqlDataAdapter dac = new SqlDataAdapter(cmdc); DataTable dtc = new DataTable(); dac.Fill(dtc); if (dtc.Rows.Count > 0) { GVC.DataSource = dtc; GVC.DataBind(); } else { GVC.DataSource = null; GVC.DataBind(); } }
protected void bindgrid() { string st1 = "", st2 = "", st3 = "", st4 = "", st5 = ""; if (ddlstatus_search.SelectedIndex > 0) { st1 += "WHERE RoomMasterTbl.Available='" + ddlstatus_search.SelectedValue + "'"; } if (filterschool.SelectedIndex > 0) { st2 += " and RoomMasterTbl.BusinessID='" + filterschool.SelectedValue + "'"; } if (filterbuilding.SelectedIndex > 0) { st3 += " and RoomMasterTbl.Buildingid='" + filterbuilding.SelectedValue + "'"; } if (filterfloor.SelectedIndex > 0) { st4 += " and RoomMasterTbl.floorid='" + filterfloor.SelectedValue + "'"; } if (filterroomtype.SelectedIndex > 0) { st5 += " and RoomMasterTbl.RoomTypeID='" + filterroomtype.SelectedValue + "'"; } lblstat.Text = ddlstatus_search.SelectedItem.Text; SqlCommand cmdc = new SqlCommand(" SELECT tblFloor.floorname,RoomMasterTbl.RoomID,RoomMasterTbl.RoomNumber,tblBuilding.BuildingName,WareHouseMaster.Name as School," + " " + "tblroomtype.RoomType,CASE(RoomMasterTbl.Available) WHEN 1 THEN 'Available' ELSE 'Unavailable' end as Available FROM RoomMasterTbl " + " " + "inner join WareHouseMaster on RoomMasterTbl.BusinessID=WareHouseMaster.WareHouseId inner join tblBuilding on tblBuilding.ID=RoomMasterTbl.Buildingid" + " " + "inner join tblFloor ON tblFloor.ID=RoomMasterTbl.floorid inner join tblroomtype on tblroomtype.ID=RoomMasterTbl.RoomTypeID " + st1 + st2 + st3 + st4 + st5 + "", con); SqlDataAdapter dac = new SqlDataAdapter(cmdc); DataTable dtc = new DataTable(); dac.Fill(dtc); if (dtc.Rows.Count > 0) { GVC.DataSource = dtc; GVC.DataBind(); } else { GVC.DataSource = null; GVC.DataBind(); } }
protected void fillGVC() { string st1 = ""; //lblstat.Text = "All"; if (ddlstatus_search.SelectedIndex > 0) { //lblstat.Text = ddlstatus_search.SelectedItem.Text; st1 += " where BusinessDetails.BusinessCategory='" + ddlstatus_search.SelectedValue + "'"; } string str = "select distinct BusinessDetails.ID,WareHouseMaster.Name as Wname,BusinessSubSubCat.B_SubSubCategory as Category,BusinessDetails.year,LEFT(BusinessDetails.Title,40) as Title,BusinessDetails.Title as Title1,LEFT(BusinessDetails.kee,40) as kee,BusinessDetails.kee as kee1,LEFT(BusinessDetails.Corporate,40) as Corporate,BusinessDetails.Corporate as Corporate1,LEFT(BusinessDetails.Facts,40) as Facts,BusinessDetails.Facts as Facts1 from BusinessDetails inner join WareHouseMaster on WareHouseMaster.WareHouseId=BusinessDetails.BusinessID left join BusinessSubSubCat on BusinessSubSubCat.B_SubSubCatID=BusinessDetails.BusinessCategory " + st1 + " order by WareHouseMaster.Name asc"; SqlDataAdapter dac = new SqlDataAdapter(str, con); DataTable dtc = new DataTable(); dac.Fill(dtc); DataView myDataView = new DataView(); myDataView = dtc.DefaultView; if (hdnsortExp.Value != string.Empty) { myDataView.Sort = string.Format("{0} {1}", hdnsortExp.Value, hdnsortDir.Value); } if (dtc.Rows.Count > 0) { GVC.DataSource = myDataView; GVC.DataBind(); } else { GVC.DataSource = null; GVC.DataBind(); } }
protected void bindgrid() { PageConn pgcon = new PageConn(); con = pgcon.dynconn; string gra = "", sta = "", sta2 = ""; if (filterschool.SelectedIndex > 0) { gra += " where tblroomtype.BusinessID='" + filterschool.SelectedValue + "'"; } if (filterbuilding.SelectedIndex > 0) { sta += " and tblroomtype.Buildingid='" + filterbuilding.SelectedValue + "'"; } if (filterfloor.SelectedIndex > 0) { sta2 += " and tblroomtype.floorid='" + filterfloor.SelectedValue + "'"; } SqlCommand cmdc = new SqlCommand("SELECT tblFloor.floorname,tblroomtype.ID,tblBuilding.BuildingName,WareHouseMaster.Name as School,tblroomtype.RoomType,tblroomtype.BusinessID,tblroomtype.floorid FROM tblroomtype inner join WareHouseMaster on tblroomtype.BusinessID=WareHouseMaster.WareHouseId inner join tblBuilding on tblBuilding.ID=tblroomtype.Buildingid inner join tblFloor ON tblFloor.ID=tblroomtype.floorid" + gra + sta + sta2 + "", con); SqlDataAdapter dac = new SqlDataAdapter(cmdc); DataTable dtc = new DataTable(); dac.Fill(dtc); if (dtc.Rows.Count > 0) { GVC.DataSource = dtc; GVC.DataBind(); } else { GVC.DataSource = null; GVC.DataBind(); } }