protected void BindGvDetails() { try { using (SqlConnection conn = new SqlConnection(DbSmartCode.x)) { conn.Open(); string strSelectCmd = @"SELECT om.cPoNum as cPONo,isnull(vws.cColour,'Not Found') as cColour,vps.OrgSize,vpcs.OrgQty,isnull(vws.cQty,0) AS cQty, sum(CASE WHEN vwsc.BTDescription='INPUT' THEN isnull(vwsc.BQty,0) else 0 end) as INPUT, sum(CASE WHEN vwsc.BTDescription='SEWING QC OUT' THEN isnull(vwsc.BQty,0) else 0 end) as SEWING, sum(CASE WHEN vwsc.BTDescription='FINAL OUT' THEN isnull(vwsc.BQty,0) else 0 end) as POLY,isnull(shp.shpqty,0) as shpqty,COALESCE(ex.sp_SizeQty,0) as sp_SizeQty, COALESCE(ex.sp_Fob,0) as sp_Fob,COALESCE(ex.sp_TotalValue,0) as sp_TotalValue,om.DXfty from SpecFo.dbo.Smt_OrdersMaster om join SpecFo.dbo.View_PivotSize vps on om.nOStyleId=vps.nStyleId and om.cOrderNu=vps.cLotNo join SpecFo.dbo.View_PivotColorQtyBySize vpcs on vps.nStyleID=vpcs.nstyCd and vps.cLotNo=vpcs.cLot and vps.SizeNo=vpcs.SizeNo left join SmartCode.dbo.View_Web_StyleCutWiseCutOut vws on vps.nStyleID=vws.nStyleID and vps.cLotNo=vws.PLot and vps.OrgSize=vws.cSize and vpcs.nCol=vws.nFabColNo and om.cOrderNu=vws.PLot left join SmartCode.dbo.View_Web_ScanData_ColourSize vwsc on vws.cPONo=vwsc.BPO and vws.PLot=vwsc.cOrderNu and vws.nStyleID=vwsc.BTStyleCode and vws.cColour=vwsc.BColor and vws.cSize=vwsc.BSize and vws.nFabColNo=vwsc.nColNo and vwsc.BTDescription in ('INPUT','FINAL OUT','SEWING QC OUT') and vwsc.BTStyle='" + ddlStyle.SelectedItem.Text + "' left join (select sp_StyleID,sp_POLot,sp_ColorID,sp_Size,SUM(sp_SizeQty) shpqty from Smt_ShipmentInf group by sp_StyleID,sp_POLot,sp_ColorID,sp_Size) shp " + " on vws.nStyleID=shp.sp_StyleID and vws.cSize=shp.sp_Size and vws.cPONo=shp.sp_POLot and vwsc.nColNo=shp.sp_ColorID " + " left join (select sp_StyleID,sp_POLot,sp_ColorID,sp_Size,SUM(sp_SizeQty) sp_SizeQty,sp_Fob,sum(sp_TotalValue) sp_TotalValue from Smt_ExportInf group by sp_StyleID,sp_POLot,sp_ColorID,sp_Size,sp_Fob) ex " + " on vws.nStyleID=ex.sp_StyleID and vws.cPONo=ex.sp_POLot and vwsc.nColNo=ex.sp_ColorID and vws.cSize=ex.sp_Size " + " where om.nOStyleId='" + ddlStyle.SelectedValue + "' group by om.cPoNum,vws.cColour,vps.OrgSize,vpcs.OrgQty,vws.cQty,shp.shpqty,ex.sp_SizeQty,ex.sp_TotalValue,ex.sp_Fob,om.DXfty"; SqlDataAdapter da = new SqlDataAdapter(strSelectCmd, conn); DataTable ds = new DataTable(); da.Fill(ds); if (ds.Rows.Count == 0) { DataRow dr = ds.NewRow(); foreach (DataColumn dc in ds.Columns) { dr[dc] = 0; } ds.Rows.Add(); GvDetails.DataSource = ds; GvDetails.DataBind(); //int columncount = GvIvn.Rows[0].Cells.Count; //GvDetails.Rows[0].Cells.Clear(); //GvDetails.Rows[0].Cells.Add(new TableCell()); //GvDetails.Rows[0].Cells[0].ColumnSpan = columncount; //GvDetails.Rows[0].Cells[0].Text = ""; } else { GvDetails.DataSource = ds; GvDetails.DataBind(); } } } catch (Exception ex) { throw ex; } }
private void binddata(Boolean IsRunRowsCountQuery) { GvDetails.DataSource = null; GvDetails.DataBind(); objClaimApprovel.ASC = ddlasc.SelectedValue; objClaimApprovel.ProductDivision = ddlDivision.SelectedValue; objClaimApprovel.CGuser = Membership.GetUser().UserName.ToString(); // for custom paging 8 nv 11 objClaimApprovel.FirstRow = int.Parse(ViewState["FirstRow"].ToString()); objClaimApprovel.LastRow = int.Parse(ViewState["LastRow"].ToString()); // end bp // for Logg date filter 19 Apr 12 bhawesh objClaimApprovel.DateFrom = txtFromDate.Text.Trim(); objClaimApprovel.DateTo = txtToDate.Text.Trim(); objClaimApprovel.IsRunCountQuery = IsRunRowsCountQuery; // For Repetiitve Complain Search by MUKESH as on 17.Jun.2015 if (ChkRepetitive.Checked) { objClaimApprovel.IsRepetitiveCheck = true; } else { objClaimApprovel.IsRepetitiveCheck = false; } objClaimApprovel.BindData(GvDetails, LblCount); Session["asc"] = ddlasc.SelectedValue; Session["div"] = ddlDivision.SelectedValue; // Added By BP 1 Nov 12 Session["Fdate"] = objClaimApprovel.DateFrom; Session["Tdate"] = objClaimApprovel.DateTo; if (GvDetails.Rows.Count > 0) { imgBtnView.Visible = true; repager.Visible = true; } else { imgBtnView.Visible = false; } CLEAR(); }
private void BINDCOUNTDATA_ONSELECTTED_INDEX() { objClaimApprovel.ASC = ddlasc.SelectedValue; objClaimApprovel.ProductDivision = ddlDivision.SelectedValue; objClaimApprovel.CGuser = Membership.GetUser().UserName.ToString(); objClaimApprovel.DateFrom = txtFromDate.Text.Trim(); objClaimApprovel.DateTo = txtToDate.Text.Trim(); objClaimApprovel.BindCount(LblCount); ViewState["RecoredCount"] = objClaimApprovel.strRecordCount; bindpager(); GvDetails.DataSource = null; GvDetails.DataBind(); GvDetails.Visible = false; imgBtnView.Visible = false; }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { GvDetails.DataSource = new List <Item> { new Item { Product = "HCLLaptop", price = 50, discount = 5 }, new Item { Product = "HPLaptop", price = 150, discount = 10 }, new Item { Product = "DellLaptop", price = 170, discount = 15 }, new Item { Product = "MILaptop", price = 70, discount = 7 }, }; GvDetails.DataBind(); } }