本文整理汇总了C#中AceSoft.RetailPlus.Data.Products.ListAsDataTable方法的典型用法代码示例。如果您正苦于以下问题:C# Products.ListAsDataTable方法的具体用法?C# Products.ListAsDataTable怎么用?C# Products.ListAsDataTable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AceSoft.RetailPlus.Data.Products
的用法示例。
在下文中一共展示了Products.ListAsDataTable方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadOptions
private void LoadOptions()
{
DataClass clsDataClass = new DataClass();
ChartOfAccounts clsChartOfAccount = new ChartOfAccounts();
System.Data.DataTable dtList = clsDataClass.DataReaderToDataTable(clsChartOfAccount.List("ChartOfAccountName", SortOption.Ascending));
ProductGroup clsProductGroup = new ProductGroup(clsChartOfAccount.Connection, clsChartOfAccount.Transaction);
System.Data.DataTable dtProductGroup = clsProductGroup.ListAsDataTable(SortField:"ProductGroupName");
ProductSubGroupColumns clsProductSubGroupColumns = new ProductSubGroupColumns() { ColumnsNameID = true };
ProductSubGroup clsSubGroup = new ProductSubGroup(clsChartOfAccount.Connection, clsChartOfAccount.Transaction);
System.Data.DataTable dtProductSubGroup = clsSubGroup.ListAsDataTable(clsProductSubGroupColumns, SortField: "ProductSubGroupName", SortOrder: System.Data.SqlClient.SortOrder.Ascending);
Products clsProduct = new Products(clsChartOfAccount.Connection, clsChartOfAccount.Transaction);
System.Data.DataTable dtProduct = clsProduct.ListAsDataTable("ProductID", SortOption.Ascending);
clsChartOfAccount.CommitAndDispose();
cboProductGroup.DataTextField = "ProductGroupName";
cboProductGroup.DataValueField = "ProductGroupID";
cboProductGroup.DataSource = dtProductGroup.DefaultView;
cboProductGroup.DataBind();
cboProductGroup.Items.Add(new ListItem("Apply to all Product Groups", "0"));
cboProductGroup.SelectedIndex = cboProductGroup.Items.Count - 1;
cboProductSubGroup.DataTextField = "ProductSubGroupName";
cboProductSubGroup.DataValueField = "ProductSubGroupID";
cboProductSubGroup.DataSource = dtProductSubGroup.DefaultView;
cboProductSubGroup.DataBind();
cboProductSubGroup.Items.Add(new ListItem("Do not Apply to Product Sub Groups", "-1"));
cboProductSubGroup.Items.Add(new ListItem("Apply to all Product Sub Groups", "0"));
cboProductSubGroup.SelectedIndex = cboProductSubGroup.Items.Count - 1;
cboProduct.DataTextField = "ProductCode";
cboProduct.DataValueField = "ProductID";
cboProduct.DataSource = dtProduct.DefaultView;
cboProduct.DataBind();
cboProduct.Items.Add(new ListItem("Do not Apply to Products", "-1"));
cboProduct.Items.Add(new ListItem("Apply to all Products", "0"));
cboProduct.SelectedIndex = cboProduct.Items.Count - 1;
cboChartOfAccountPurchase.DataTextField = "ChartOfAccountNameComplete";
cboChartOfAccountPurchase.DataValueField = "ChartOfAccountID";
cboChartOfAccountPurchase.DataSource = dtList.DefaultView;
cboChartOfAccountPurchase.DataBind();
cboChartOfAccountPurchase.Items.Add(new ListItem("Not Applicable", "0"));
cboChartOfAccountPurchase.SelectedIndex = cboChartOfAccountPurchase.Items.Count - 1;
cboChartOfAccountSold.DataTextField = "ChartOfAccountNameComplete";
cboChartOfAccountSold.DataValueField = "ChartOfAccountID";
cboChartOfAccountSold.DataSource = dtList.DefaultView;
cboChartOfAccountSold.DataBind();
cboChartOfAccountSold.Items.Add(new ListItem("Not Applicable", "0"));
cboChartOfAccountSold.SelectedIndex = cboChartOfAccountSold.Items.Count - 1;
cboChartOfAccountInventory.DataTextField = "ChartOfAccountNameComplete";
cboChartOfAccountInventory.DataValueField = "ChartOfAccountID";
cboChartOfAccountInventory.DataSource = dtList.DefaultView;
cboChartOfAccountInventory.DataBind();
cboChartOfAccountInventory.Items.Add(new ListItem("Not Applicable", "0"));
cboChartOfAccountInventory.SelectedIndex = cboChartOfAccountInventory.Items.Count - 1;
cboChartOfAccountIDTaxPurchase.DataTextField = "ChartOfAccountNameComplete";
cboChartOfAccountIDTaxPurchase.DataValueField = "ChartOfAccountID";
cboChartOfAccountIDTaxPurchase.DataSource = dtList.DefaultView;
cboChartOfAccountIDTaxPurchase.DataBind();
cboChartOfAccountIDTaxPurchase.Items.Add(new ListItem("Not Applicable", "0"));
cboChartOfAccountIDTaxPurchase.SelectedIndex = cboChartOfAccountIDTaxPurchase.Items.Count - 1;
cboChartOfAccountIDTaxSold.DataTextField = "ChartOfAccountNameComplete";
cboChartOfAccountIDTaxSold.DataValueField = "ChartOfAccountID";
cboChartOfAccountIDTaxSold.DataSource = dtList.DefaultView;
cboChartOfAccountIDTaxSold.DataBind();
cboChartOfAccountIDTaxSold.Items.Add(new ListItem("Not Applicable", "0"));
cboChartOfAccountIDTaxSold.SelectedIndex = cboChartOfAccountIDTaxSold.Items.Count - 1;
}
示例2: LoadList
private void LoadList()
{
string SortField = "ProductDesc";
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); }
ProductListFilterType clsProductListFilterType = ProductListFilterType.ShowActiveOnly;
if (rdoShowInactiveOnly.Checked == true) clsProductListFilterType = ProductListFilterType.ShowInactiveOnly;
if (rdoShowActiveOnly.Checked == true) clsProductListFilterType = ProductListFilterType.ShowActiveOnly;
if (rdoShowAll.Checked == true) clsProductListFilterType = ProductListFilterType.ShowActiveAndInactive;
int intLimit = 0;
try { intLimit = int.Parse(txtLimit.Text); }
catch { }
string SearchKey = string.Empty;
if (Request.QueryString["Search"] != null)
{ SearchKey = Server.UrlDecode(Common.Decrypt((string)Request.QueryString["search"], Session.SessionID)); }
else if (Session["Search"] != null)
{ SearchKey = Server.UrlDecode(Common.Decrypt(Session["Search"].ToString(), Session.SessionID)); }
try { Session.Remove("Search"); } catch { }
if (SearchKey == null) { SearchKey = string.Empty; }
else if (SearchKey != string.Empty) { Session.Add("Search", Common.Encrypt(SearchKey, Session.SessionID)); }
Data.ProductDetails clsSearchKeys = new Data.ProductDetails();
clsSearchKeys.BarCode = SearchKey;
clsSearchKeys.BarCode2 = SearchKey;
clsSearchKeys.BarCode3 = SearchKey;
clsSearchKeys.ProductCode = SearchKey;
ProductAddOnFilters clsProductAddOnFilters = new ProductAddOnFilters();
clsProductAddOnFilters.BarcodeFrom = txtBarcodeFrom.Text;
clsProductAddOnFilters.BarcodeTo = txtBarcodeTo.Text;
clsProductAddOnFilters.ProductCodeFrom = txtProductCodeFrom.Text;
clsProductAddOnFilters.ProductCodeTo = txtProductCodeTo.Text;
clsProductAddOnFilters.ProductSubGroupNameFrom = txtProductSubGroupNameFrom.Text;
clsProductAddOnFilters.ProductSubGroupNameTo = txtProductSubGroupNameTo.Text;
clsProductAddOnFilters.ProductGroupNameFrom = txtProductGroupnameFrom.Text;
clsProductAddOnFilters.ProductGroupNameTo = txtProductGroupNameTo.Text;
clsProductAddOnFilters.SupplierNameFrom = txtSupplierNameFrom.Text;
clsProductAddOnFilters.SupplierNameTo = txtSupplierNameTo.Text;
Products clsProduct = new Products();
System.Data.DataTable dt = clsProduct.ListAsDataTable(clsSearchKeys: clsSearchKeys, ProductAddOnFilters: clsProductAddOnFilters, clsProductListFilterType: clsProductListFilterType, limit: 100, SortField: SortField, SortOrder: SortOption.Ascending);
clsProduct.CommitAndDispose();
PageData.DataSource = dt.DefaultView;
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: LoadProducts
private void LoadProducts(System.Data.SqlClient.SortOrder SequenceSortOrder)
{
try
{
tblLayoutProducts.Controls.Clear();
if (mboLocked) return;
Int64 intSequenceNoStart = 0;
if (SequenceSortOrder == System.Data.SqlClient.SortOrder.Descending)
try { intSequenceNoStart = long.Parse(cmdProductLeft.Tag.ToString()); }
catch { }
else
try { intSequenceNoStart = long.Parse(cmdProductRight.Tag.ToString()); }
catch { }
// Sep 24, 2014 put an override if cmdSubGroupLeft.Tag = 0
// always do an asceding coz its already the end.
if (intSequenceNoStart < Constants.C_RESTOPLUS_MAX_PRODUCTS) intSequenceNoStart = 0; //reset to 0 if it's 1
if (intSequenceNoStart == 0) SequenceSortOrder = System.Data.SqlClient.SortOrder.Ascending;
//if (tblLayoutProducts.Controls.Count <= Constants.C_RESTOPLUS_MAX_PRODUCTS) { intSequenceNoStart -= 1; SequenceSortOrder = System.Data.SqlClient.SortOrder.Ascending; }
ProductColumns clsProductColumns = new ProductColumns();
clsProductColumns.BarCode = true;
clsProductColumns.ProductCode = true;
clsProductColumns.SequenceNo = true;
ProductColumns clsSearchColumns = new ProductColumns();
long lngProductSubGroupID = 0;
try { lngProductSubGroupID = long.Parse(lblItems.Tag.ToString()); }
catch { }
Products clsProduct = new Products(mConnection, mTransaction);
// always put the branchid as zero so that it will show all products
System.Data.DataTable dtProduct = clsProduct.ListAsDataTable(clsProductColumns, 0, ProductListFilterType.ShowActiveOnly, intSequenceNoStart, SequenceSortOrder,
clsSearchColumns, string.Empty, Constants.ZERO, Constants.ZERO, string.Empty, lngProductSubGroupID, string.Empty, SequenceSortOrder == System.Data.SqlClient.SortOrder.Descending ? Constants.C_RESTOPLUS_MAX_PRODUCTS : Constants.C_RESTOPLUS_MAX_PRODUCTS + 1, mclsTerminalDetails.ShowItemMoreThanZeroQty, true, "SequenceNo", SequenceSortOrder == System.Data.SqlClient.SortOrder.Ascending ? SortOption.Ascending : SortOption.Desscending);
//System.Data.DataTable dtProduct = clsProduct.ListAsDataTableFE(Constants.BRANCH_ID_MAIN, string.Empty, ProductListFilterType.ShowActiveOnly, Constants.C_RESTOPLUS_MAX_PRODUCTS + 1, false, "SequenceNo", System.Data.SqlClient.SortOrder.Ascending);
clsProduct.CommitAndDispose();
// re-order the products by sequcen no
if (dtProduct.Rows.Count > 0)
{
System.Data.DataView dv = dtProduct.DefaultView;
dv.Sort = "SequenceNo";
dtProduct = dv.ToTable();
}
int iRow = 0;
int iCol = 0;
int iCtr = 1;
if (dtProduct.Rows.Count == 0)
{
cmdProductLeft.Tag = "0".ToString(); // reset the sequenceno to 0 if no record
cmdProductRight.Tag = "0".ToString(); // reset the sequenceno to 0 if no record
}
foreach (System.Data.DataRow dr in dtProduct.Rows)
{
if (iCtr > Constants.C_RESTOPLUS_MAX_PRODUCTS) break;
if (iCtr == 1) cmdProductLeft.Tag = dr[Data.ProductColumnNames.SequenceNo].ToString();
if (iCtr >= 1 && dtProduct.Rows.Count > Constants.C_RESTOPLUS_MAX_PRODUCTS) cmdProductRight.Tag = dr[Data.ProductColumnNames.SequenceNo].ToString();
//if (iCtr == Constants.C_RESTOPLUS_MAX_PRODUCTS && dtProduct.Rows.Count > Constants.C_RESTOPLUS_MAX_PRODUCTS)
//{
// if (SequenceSortOrder == System.Data.SqlClient.SortOrder.Descending)
// try { if (iCtr == 1) cmdProductLeft.Tag = dr[Data.ProductColumnNames.SequenceNo].ToString(); }
// catch { }
// else
// try { cmdProductRight.Tag = dr[Data.ProductColumnNames.SequenceNo].ToString(); }
// catch { }
//}
//else if (dtProduct.Rows.Count > 0 && dtProduct.Rows.Count <= Constants.C_RESTOPLUS_MAX_PRODUCTS)
//{
// if (SequenceSortOrder == System.Data.SqlClient.SortOrder.Descending)
// {
// try {
// if (Int32.Parse(cmdProductRight.Tag.ToString()) < Int32.Parse(dr[Data.ProductColumnNames.SequenceNo].ToString()))
// cmdProductRight.Tag = dr[Data.ProductColumnNames.SequenceNo].ToString();
// }
// catch { }
// cmdProductLeft.Tag = "0".ToString();
// }
// else
// {
// try { if (iCtr == 1) cmdProductLeft.Tag = dr[Data.ProductColumnNames.SequenceNo].ToString(); }
// catch { }
// // cmdProductRight.Tag = cmdProductRight.Tag; // do not reset
// }
//}
ProductButton cmdProduct = new ProductButton();
cmdProduct.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
cmdProduct.BackColor = System.Drawing.Color.WhiteSmoke;
cmdProduct.Dock = System.Windows.Forms.DockStyle.Fill;
cmdProduct.FlatAppearance.BorderColor = System.Drawing.Color.Gold;
//.........这里部分代码省略.........