本文整理汇总了C#中DataClass.DataReaderToDataTable方法的典型用法代码示例。如果您正苦于以下问题:C# DataClass.DataReaderToDataTable方法的具体用法?C# DataClass.DataReaderToDataTable怎么用?C# DataClass.DataReaderToDataTable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataClass
的用法示例。
在下文中一共展示了DataClass.DataReaderToDataTable方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadOptions
private void LoadOptions()
{
DataClass clsDataClass = new DataClass();
Contacts clsContact = new Contacts();
cboContactCode.DataTextField = "ContactCode";
cboContactCode.DataValueField = "ContactCode";
cboContactCode.DataSource = clsContact.ListAsDataTable("ContactCode",SortOption.Ascending);
cboContactCode.DataBind();
cboContactCode.Items.Add( new ListItem("All Codes","0"));
cboContactCode.SelectedIndex = cboContactCode.Items.Count - 1;
cboContactName.DataTextField = "ContactName";
cboContactName.DataValueField = "ContactName";
cboContactName.DataSource = clsContact.ListAsDataTable("ContactName",SortOption.Ascending);
cboContactName.DataBind();
cboContactName.Items.Add( new ListItem("All Contacts","0"));
cboContactName.SelectedIndex = cboContactName.Items.Count - 1;
clsContact.CommitAndDispose();
ContactGroups clsContactGroup = new ContactGroups();
cboGroup.DataTextField = "ContactGroupName";
cboGroup.DataValueField = "ContactGroupID";
cboGroup.DataSource = clsDataClass.DataReaderToDataTable(clsContactGroup.List("ContactGroupName",SortOption.Ascending));
cboGroup.DataBind();
cboGroup.Items.Add( new ListItem("All Contact Groups","0"));
cboGroup.SelectedIndex = cboGroup.Items.Count - 1;
clsContactGroup.CommitAndDispose();
cboDeleted.SelectedIndex = cboDeleted.Items.Count - 1;
}
示例2: LoadList
private void LoadList()
{
ProductGroupCharges clsProductGroupCharge = new ProductGroupCharges();
DataClass clsDataClass = new DataClass();
if (Request.QueryString["Search"]==null)
{
PageData.DataSource = clsDataClass.DataReaderToDataTable(clsProductGroupCharge.List(Convert.ToInt64(lblGroupID.Text),"ChargeType",SortOption.Ascending)).DefaultView;
}
else
{
string SearchKey = Common.Decrypt((string)Request.QueryString["search"],Session.SessionID);
PageData.DataSource = clsDataClass.DataReaderToDataTable(clsProductGroupCharge.Search(Convert.ToInt64(lblGroupID.Text),SearchKey, "ChargeType", SortOption.Ascending)).DefaultView;
}
clsProductGroupCharge.CommitAndDispose();
int iPageSize = Convert.ToInt16(Session["PageSize"]) ;
PageData.AllowPaging = true;
PageData.PageSize = iPageSize;
try
{
PageData.CurrentPageIndex = Convert.ToInt16(cboCurrentPage.SelectedItem.Value) - 1;
lstItem.DataSource = PageData;
lstItem.DataBind();
}
catch
{
PageData.CurrentPageIndex = 1;
lstItem.DataSource = PageData;
lstItem.DataBind();
}
cboCurrentPage.Items.Clear();
for (int i=0; i < PageData.PageCount;i++)
{
int iValue = i + 1;
cboCurrentPage.Items.Add(new ListItem(iValue.ToString(),iValue.ToString()));
if (PageData.CurrentPageIndex == i)
{ cboCurrentPage.Items[i].Selected = true;}
else
{ cboCurrentPage.Items[i].Selected = false;}
}
lblDataCount.Text = " of " + " " + PageData.PageCount;
}
示例3: LoadOptions
private void LoadOptions()
{
AccountCategories clsAccountCategory = new AccountCategories();
DataClass clsDataClass = new DataClass();
cboAccountCategory.DataTextField = "AccountCategoryName";
cboAccountCategory.DataValueField = "AccountCategoryID";
cboAccountCategory.DataSource = clsDataClass.DataReaderToDataTable(clsAccountCategory.List("AccountCategoryName",SortOption.Ascending)).DefaultView;
cboAccountCategory.DataBind();
cboAccountCategory.SelectedIndex = cboAccountCategory.Items.Count - 1;
clsAccountCategory.CommitAndDispose();
}
示例4: LoadOptions
private void LoadOptions()
{
DataClass clsDataClass = new DataClass();
Country clsCountry = new Country();
cboCountry.DataTextField = "CountryName";
cboCountry.DataValueField = "CountryID";
cboCountry.DataSource = clsDataClass.DataReaderToDataTable(clsCountry.List("CountryName",SortOption.Ascending)).DefaultView;
cboCountry.DataBind();
cboCountry.SelectedIndex = cboCountry.Items.Count - 1;
AccessGroup clsAccessGroup = new AccessGroup(clsCountry.Connection, clsCountry.Transaction);
cboGroup.DataTextField = "GroupName";
cboGroup.DataValueField = "GroupID";
cboGroup.DataSource = clsDataClass.DataReaderToDataTable(clsAccessGroup.List("GroupName",SortOption.Ascending)).DefaultView;
cboGroup.DataBind();
cboGroup.SelectedIndex = cboGroup.Items.Count - 1;
clsCountry.CommitAndDispose();
}
示例5: LoadOptions
private void LoadOptions()
{
DataClass clsDataClass = new DataClass();
lblProductGroupID.Text = Common.Decrypt((string)Request.QueryString["groupid"],Session.SessionID);
ProductGroupCharges clsCharge = new ProductGroupCharges();
cboChargeType.DataTextField = "ChargeType";
cboChargeType.DataValueField = "ChargeTypeID";
cboChargeType.DataSource = clsDataClass.DataReaderToDataTable(clsCharge.AvailableCharges(Convert.ToInt64(lblProductGroupID.Text), "ChargeType",SortOption.Ascending)).DefaultView;
cboChargeType.DataBind();
cboChargeType.SelectedIndex = cboChargeType.Items.Count - 1;
clsCharge.CommitAndDispose();
cboChargeType_SelectedIndexChanged(null, null);
}
示例6: LoadOptions
private void LoadOptions()
{
DataClass clsDataClass = new DataClass();
lblProductGroupID.Text = Common.Decrypt((string)Request.QueryString["groupid"],Session.SessionID);
lblProductGroupVariationID.Text = Common.Decrypt(Request.QueryString["id"],Session.SessionID);
Variation clsVariation = new Variation();
string VariationType = clsVariation.Details( Convert.ToInt32(lblProductGroupVariationID.Text)).VariationType;
clsVariation.CommitAndDispose();
ProductGroupVariations clsProductGroupVariation = new ProductGroupVariations();
cboVariationType.DataTextField = "VariationType";
cboVariationType.DataValueField = "VariationID";
cboVariationType.DataSource = clsDataClass.DataReaderToDataTable(clsProductGroupVariation.AvailableVariations(Convert.ToInt32(lblProductGroupID.Text),"VariationType",SortOption.Ascending)).DefaultView;
cboVariationType.DataBind();
cboVariationType.Items.Add(new ListItem(VariationType, lblProductGroupVariationID.Text));
cboVariationType.SelectedIndex = cboVariationType.Items.Count - 1;
clsProductGroupVariation.CommitAndDispose();
}
示例7: cmdVariationSearch_Click
protected void cmdVariationSearch_Click(object sender, System.Web.UI.ImageClickEventArgs e)
{
string stSearchKey = txtVariation.Text.ToString();
if (txtVariation.Text == null) stSearchKey = "";
DataClass clsDataClass = new DataClass();
long ProductID = Convert.ToInt64(cboProductCode.SelectedItem.Value);
ProductVariationsMatrix clsProductVariationsMatrix = new ProductVariationsMatrix();
cboVariation.DataTextField = "Description";
cboVariation.DataValueField = "MatrixID";
cboVariation.DataSource = clsDataClass.DataReaderToDataTable(clsProductVariationsMatrix.Search(ProductID, stSearchKey, "VariationDesc",SortOption.Ascending)).DefaultView;
cboVariation.DataBind();
if (cboVariation.Items.Count == 0)
{
cboVariation.Items.Add(new ListItem("No Variation", "0"));
}
cboVariation.SelectedIndex = cboVariation.Items.Count - 1;
clsProductVariationsMatrix.CommitAndDispose();
}
示例8: LoadChartOfAccountList
private void LoadChartOfAccountList(DataList lstChartOfAccount, int AccountCategoryID)
{
ChartOfAccounts clsChartOfAccount = new ChartOfAccounts();
DataClass clsDataClass = new DataClass();
System.Data.DataTable dt = clsDataClass.DataReaderToDataTable(clsChartOfAccount.List(AccountCategoryID, "ChartOfAccountCode", SortOption.Ascending));
clsChartOfAccount.CommitAndDispose();
lstChartOfAccount.DataSource = dt.DefaultView;
lstChartOfAccount.DataBind();
}
示例9: LoadAccountCategoryList
private void LoadAccountCategoryList(DataList lstAccountCategory, int AccountSummaryID)
{
AccountCategories clsAccountCategory = new AccountCategories();
DataClass clsDataClass = new DataClass();
System.Data.DataTable dt = clsDataClass.DataReaderToDataTable(clsAccountCategory.List(AccountSummaryID, "AccountCategoryCode", SortOption.Ascending));
clsAccountCategory.CommitAndDispose();
lstAccountCategory.DataSource = dt.DefaultView;
lstAccountCategory.DataBind();
}
示例10: LoadAccount
private void LoadAccount()
{
DataClass clsDataClass = new DataClass();
ChartOfAccounts clsChartOfAccount = new ChartOfAccounts();
cboAccount.DataTextField = "ChartOfAccountName";
cboAccount.DataValueField = "ChartOfAccountID";
cboAccount.DataSource = clsDataClass.DataReaderToDataTable(clsChartOfAccount.List("ChartOfAccountName", SortOption.Ascending)).DefaultView;
cboAccount.DataBind();
clsChartOfAccount.CommitAndDispose();
cboAccount.SelectedIndex = 0;
txtAmount.Text = "0.00";
}
示例11: LoadItemData
private void LoadItemData()
{
try
{
DataClass clsData = new DataClass();
ProductVariationsMatrix clsProductVariationsMatrix = new ProductVariationsMatrix();
System.Data.DataTable dt = clsData.DataReaderToDataTable(clsProductVariationsMatrix.Search(mDetails.ProductID, "", "a.Description", SortOption.Ascending, 100, mboShowItemMoreThanZeroQty));
clsProductVariationsMatrix.CommitAndDispose();
lstItems.Items.Clear(); int iImgCtr = 0;
foreach (System.Data.DataRow dr in dt.Rows)
{
if (mboIsPriceInq)
lstItems.Items.Add(dr["MatriXID"].ToString(), "[" + dr["Price"].ToString() + "]" + Environment.NewLine + dr["Quantity"].ToString() + " " + dr["UnitCode"].ToString() + " - " + dr["Description"].ToString(), iImgCtr);
else
lstItems.Items.Add(dr["MatriXID"].ToString(), dr["Quantity"].ToString() + " " + dr["UnitCode"].ToString() + " - " + dr["Description"].ToString(), iImgCtr);
if (iImgCtr == 7) iImgCtr = 0; else iImgCtr++;
}
try { lstItems.Items[0].Selected = true; }
catch { }
}
catch (Exception ex)
{
if (ex.Message.ToLower() != "index was outside the bounds of the array.")
MessageBox.Show(ex.Message,"RetailPlus",MessageBoxButtons.OK,MessageBoxIcon.Error);
}
}
示例12: LoadItemData
private void LoadItemData()
{
MatrixPackage clsMatrixPackage = new MatrixPackage();
try
{
DataClass clsData = new DataClass();
System.Data.DataTable dt =
clsData.DataReaderToDataTable(clsMatrixPackage.List(mItemDetails.VariationsMatrixID,"a.PackageID",SortOption.Ascending));
clsMatrixPackage.CommitAndDispose();
dt.TableName = "tblMatrixPackage";
dgItems.DataSource = dt;
dgItems.Select(0);
dgItems.CurrentRowIndex=0;
}
catch (Exception ex)
{
clsMatrixPackage.CommitAndDispose();
MessageBox.Show(ex.Message,"RetailPlus",MessageBoxButtons.OK,MessageBoxIcon.Error);
}
}
示例13: LoadList
private void LoadList()
{
Payments clsPayments = new Payments();
DataClass clsDataClass = new DataClass();
string SortField = "PaymentID";
if (Request.QueryString["sortfield"]!=null)
{ SortField = Common.Decrypt(Request.QueryString["sortfield"].ToString(), Session.SessionID); }
SortOption sortoption = SortOption.Ascending;
if (Request.QueryString["sortoption"]!=null)
{ sortoption = (SortOption) Enum.Parse(typeof(SortOption), Common.Decrypt(Request.QueryString["sortoption"], Session.SessionID), true); }
if (Request.QueryString["Search"]==null)
{
PageData.DataSource = clsDataClass.DataReaderToDataTable(clsPayments.List(SortField, sortoption)).DefaultView;
}
else
{
string SearchKey = Common.Decrypt((string)Request.QueryString["search"],Session.SessionID);
PageData.DataSource = clsDataClass.DataReaderToDataTable(clsPayments.Search(SearchKey, SortField, sortoption)).DefaultView;
}
clsPayments.CommitAndDispose();
int iPageSize = Convert.ToInt16(Session["PageSize"]) ;
PageData.AllowPaging = true;
PageData.PageSize = iPageSize;
try
{
PageData.CurrentPageIndex = Convert.ToInt16(cboCurrentPage.SelectedItem.Value) - 1;
lstItem.DataSource = PageData;
lstItem.DataBind();
}
catch
{
PageData.CurrentPageIndex = 1;
lstItem.DataSource = PageData;
lstItem.DataBind();
}
cboCurrentPage.Items.Clear();
for (int i=0; i < PageData.PageCount;i++)
{
int iValue = i + 1;
cboCurrentPage.Items.Add(new ListItem(iValue.ToString(),iValue.ToString()));
if (PageData.CurrentPageIndex == i)
{ cboCurrentPage.Items[i].Selected = true;}
else
{ cboCurrentPage.Items[i].Selected = false;}
}
lblDataCount.Text = " of " + " " + PageData.PageCount;
}
示例14: LoadOptions
private void LoadOptions()
{
DataClass clsDataClass = new DataClass();
StockTypes clsStockTypes = new StockTypes();
cboStockTypes.DataTextField = "StockTypeCode";
cboStockTypes.DataValueField = "StockTypeID";
cboStockTypes.DataSource = clsDataClass.DataReaderToDataTable(clsStockTypes.List("StockTypeCode", SortOption.Ascending)).DefaultView;
cboStockTypes.DataBind();
cboStockTypes.SelectedIndex = cboStockTypes.Items.Count - 1;
Contacts clsContact = new Contacts(clsStockTypes.Connection, clsStockTypes.Transaction);
cboSupplier.DataTextField = "ContactName";
cboSupplier.DataValueField = "ContactID";
cboSupplier.DataSource = clsDataClass.DataReaderToDataTable(clsContact.Suppliers(null, 0, "ContactName", SortOption.Ascending)).DefaultView;
cboSupplier.DataBind();
Branch clsBranch = new Branch(clsStockTypes.Connection, clsStockTypes.Transaction);
cboBranch.DataTextField = "BranchCode";
cboBranch.DataValueField = "BranchID";
cboBranch.DataSource = clsBranch.ListAsDataTable().DefaultView;
cboBranch.DataBind();
clsStockTypes.CommitAndDispose();
cboStockTypes_SelectedIndexChanged(null, null);
cboSupplier.SelectedIndex = 0;
cboBranch.SelectedIndex = cboBranch.Items.IndexOf(cboBranch.Items.FindByValue(Constants.BRANCH_ID_MAIN.ToString()));
NewTransaction();
}
示例15: LoadOptions
private void LoadOptions()
{
DataClass clsDataClass = new DataClass();
lblGroupID.Text = Common.Decrypt((string)Request.QueryString["groupid"],Session.SessionID);
lblMatrixID.Text = Common.Decrypt(Request.QueryString["id"],Session.SessionID);
ProductGroupVariations clsProductGroupVariation = new ProductGroupVariations();
lstItem.DataSource = clsDataClass.DataReaderToDataTable(clsProductGroupVariation.List(Convert.ToInt32(lblGroupID.Text),"VariationType",SortOption.Ascending)).DefaultView;
lstItem.DataBind();
clsProductGroupVariation.CommitAndDispose();
Data.Unit clsUnit = new Data.Unit();
cboUnit.DataTextField = "UnitName";
cboUnit.DataValueField = "UnitID";
cboUnit.DataSource = clsUnit.ListAsDataTable(SortField:"UnitName").DefaultView;
cboUnit.DataBind();
cboUnit.SelectedIndex = cboUnit.Items.Count - 1;
clsUnit.CommitAndDispose();
ProductGroup clsProductGroup = new ProductGroup();
ProductGroupDetails clsProductGroupDetails = clsProductGroup.Details(Convert.ToInt32(lblGroupID.Text));
cboUnit.SelectedIndex = cboUnit.Items.IndexOf(cboUnit.Items.FindByValue(clsProductGroupDetails.UnitDetails.UnitID.ToString()));
txtProductPrice.Text = clsProductGroupDetails.Price.ToString("#,##0.#0");
txtPurchasePrice.Text = clsProductGroupDetails.PurchasePrice.ToString("#,##0.#0");
chkIncludeInSubtotalDiscount.Checked = clsProductGroupDetails.IncludeInSubtotalDiscount;
txtVAT.Text = clsProductGroupDetails.VAT.ToString("#,##0.#0");
txtEVAT.Text = clsProductGroupDetails.EVAT.ToString("#,##0.#0");
txtLocalTax.Text = clsProductGroupDetails.LocalTax.ToString("#,##0.#0");
}