private void LoadItems() { DataClass clsDataClass = new DataClass(); TransferInItem clsTransferInItem = new TransferInItem(); lstItem.DataSource = clsDataClass.DataReaderToDataTable(clsTransferInItem.List(Convert.ToInt64(lblTransferInID.Text), "TransferInItemID", SortOption.Ascending)).DefaultView; lstItem.DataBind(); clsTransferInItem.CommitAndDispose(); }
private void SetDataSource(ReportDocument Report) { long iID = 0; try { if (Request.QueryString["task"].ToString().ToLower() == "reportfromposted" && Request.QueryString["transferinid"].ToString() != null) { iID = Convert.ToInt64(Request.QueryString["transferinid"].ToString()); } else { iID = Convert.ToInt64(Common.Decrypt(Request.QueryString["transferinid"].ToString(), Session.SessionID)); } } catch { iID = Convert.ToInt64(Common.Decrypt(lblReferrer.Text.Substring(lblReferrer.Text.IndexOf("transferinid") + 13), Session.SessionID)); } ReportDataset rptds = new ReportDataset(); TransferIn clsTransferIn = new TransferIn(); MySqlDataReader myreader = clsTransferIn.List(iID, "TransferInID", SortOption.Ascending); while (myreader.Read()) { DataRow drNew = rptds.TransferIn.NewRow(); foreach (DataColumn dc in rptds.TransferIn.Columns) { drNew[dc] = "" + myreader[dc.ColumnName]; } rptds.TransferIn.Rows.Add(drNew); } myreader.Close(); TransferInItem clsTransferInItem = new TransferInItem(clsTransferIn.Connection, clsTransferIn.Transaction); MySqlDataReader myreaderitems = clsTransferInItem.List(iID, "TransferInItemID", SortOption.Ascending); while (myreaderitems.Read()) { DataRow drNew = rptds.TransferInItems.NewRow(); foreach (DataColumn dc in rptds.TransferInItems.Columns) { drNew[dc] = "" + myreaderitems[dc.ColumnName]; } rptds.TransferInItems.Rows.Add(drNew); } myreaderitems.Close(); clsTransferIn.CommitAndDispose(); Report.SetDataSource(rptds); SetParameters(Report); }