private void LoadItems() { WBranchTransferItem clsWBranchTransferItem = new WBranchTransferItem(); lstItem.DataSource = clsWBranchTransferItem.ListAsDataTable(Convert.ToInt64(lblWBranchTransferID.Text), "WBranchTransferItemID", SortOption.Ascending).DefaultView; lstItem.DataBind(); clsWBranchTransferItem.CommitAndDispose(); }
private void SetDataSource(ReportDocument Report) { long iID = 0; try { if (Request.QueryString["task"].ToString().ToLower() == "reportfromposted" && Request.QueryString["WBranchTransferid"].ToString() != null) { iID = Convert.ToInt64(Request.QueryString["WBranchTransferid"].ToString()); } else { iID = Convert.ToInt64(Common.Decrypt(Request.QueryString["WBranchTransferid"].ToString(), Session.SessionID)); } } catch { iID = Convert.ToInt64(Common.Decrypt(lblReferrer.Text.Substring(lblReferrer.Text.IndexOf("WBranchTransferid") + 13), Session.SessionID)); } ReportDataset rptds = new ReportDataset(); WBranchTransfer clsWBranchTransfer = new WBranchTransfer(); System.Data.DataTable dt = clsWBranchTransfer.ListAsDataTable(iID); WBranchTransferItem clsWBranchTransferItem = new WBranchTransferItem(clsWBranchTransfer.Connection, clsWBranchTransfer.Transaction); System.Data.DataTable dtitems = clsWBranchTransferItem.ListAsDataTable(iID); clsWBranchTransfer.CommitAndDispose(); foreach (System.Data.DataRow dr in dt.Rows) { DataRow drNew = rptds.WBranchTransfer.NewRow(); foreach (DataColumn dc in rptds.WBranchTransfer.Columns) { drNew[dc] = dr[dc.ColumnName]; } rptds.WBranchTransfer.Rows.Add(drNew); } foreach (System.Data.DataRow dr in dtitems.Rows) { DataRow drNew = rptds.WBranchTransferItems.NewRow(); foreach (DataColumn dc in rptds.WBranchTransferItems.Columns) { drNew[dc] = dr[dc.ColumnName]; } rptds.WBranchTransferItems.Rows.Add(drNew); } Report.SetDataSource(rptds); SetParameters(Report); }