/// <summary> /// incremental filtering and partial loading of name and address book for speed /// both ItemsRequestedByFilterCondition and ItemRequestedByValue must be set up for this to work /// </summary> /// <param name="source"></param> /// <param name="e"></param> protected void dxcbocompany_ItemsRequestedByFilterCondition(object source, DevExpress.Web.ASPxEditors.ListEditItemsRequestedByFilterConditionEventArgs e) { DevExpress.Web.ASPxEditors.ASPxComboBox _combo = (DevExpress.Web.ASPxEditors.ASPxComboBox)source; string _filter = !string.IsNullOrEmpty(e.Filter) ? e.Filter: ""; { //use datareaders - much faster than loading into collections string[] _cols = { "NameAndAddressBook.CompanyID, NameAndAddressBook.CompanyName, NameAndAddressBook.Customer" }; //SubSonic.SqlQuery _query = DAL.Logistics.DB.Select(_cols).From(DAL.Logistics.Tables.NameAndAddressBook).Paged(e.BeginIndex + 1, e.EndIndex +1, "CompanyID").WhereExpression("CompanyName").Like(string.Format("%{0}%", e.Filter.ToString())).And("Customer").IsEqualTo(true) ; SubSonic.SqlQuery _query = DAL.Logistics.DB.Select(_cols).From(DAL.Logistics.Tables.NameAndAddressBook).Paged(e.BeginIndex + 1, e.EndIndex + 1, "CompanyID").WhereExpression("CompanyName").Like(string.Format("%{0}%", e.Filter.ToString())); IDataReader _rd = _query.ExecuteReader(); _combo.DataSource = _rd; _combo.ValueField = "CompanyID"; _combo.TextField = "CompanyName"; _combo.DataBind(); //use sqldatasource //this.sdsCompany.ConnectionString = ConfigurationManager.ConnectionStrings["PublishipSQLConnectionString"].ToString(); //this.sdsCompany.SelectCommand = @"SELECT [CompanyID], [CompanyName], [Customer] FROM (select [CompanyID], [CompanyName], [Customer], row_number()over(order by t.[CompanyName]) as [rn] from [NameAndAddressBook] as t where (([CompanyName]) LIKE @filter)) as st where st.[rn] between @startIndex and @endIndex;"; //this.sdsCompany.SelectParameters.Clear(); //this.sdsCompany.SelectParameters.Add("filter", TypeCode.String, string.Format("%{0}%", _filter)); //this.sdsCompany.SelectParameters.Add("startindex", TypeCode.Int32, (e.BeginIndex + 1).ToString()); //this.sdsCompany.SelectParameters.Add("endindex", TypeCode.Int32, (e.EndIndex + 1).ToString()); //_combo.DataSource = this.sdsCompany; //_combo.DataBind(); } }
protected void cbCars_ItemsRequestedByFilterCondition(object source, DevExpress.Web.ASPxEditors.ListEditItemsRequestedByFilterConditionEventArgs e) { var data = MyDataSource.GetData(cbLocation.Text); var query = from r in data where r.Text.StartsWith(e.Filter) select r; cbCars.DataSource = query.Skip(e.BeginIndex).Take(e.EndIndex - e.BeginIndex + 1); cbCars.DataBind(); }
protected void cbo_UnitDim_ItemsRequestedByFilterCondition(object source, DevExpress.Web.ASPxEditors.ListEditItemsRequestedByFilterConditionEventArgs e) { XPCollection <UnitDim> collection = new XPCollection <UnitDim>(session); collection.SkipReturnedObjects = e.BeginIndex; collection.TopReturnedObjects = e.EndIndex - e.BeginIndex + 1; collection.Criteria = new GroupOperator(GroupOperatorType.And, new CriteriaOperator[] { new BinaryOperator("Code", String.Format("%{0}%", e.Filter), BinaryOperatorType.Like) }); collection.Sorting.Add(new SortProperty("Code", DevExpress.Xpo.DB.SortingDirection.Ascending)); cbo_UnitDim.DataSource = collection; cbo_UnitDim.DataBindItems(); }
//end send advance email #endregion #region company filters /// <summary> /// incremental filtering and partial loading of name and address book for speed /// both ItemsRequestedByFilterCondition and ItemRequestedByValue must be set up for this to work /// </summary> /// <param name="source"></param> /// <param name="e"></param> protected void dxcbocompany_ItemsRequestedByFilterCondition(object source, DevExpress.Web.ASPxEditors.ListEditItemsRequestedByFilterConditionEventArgs e) { DevExpress.Web.ASPxEditors.ASPxComboBox _combo = (DevExpress.Web.ASPxEditors.ASPxComboBox)source; string _filter = !string.IsNullOrEmpty(e.Filter) ? e.Filter : ""; { //use datareaders - much faster than loading into collections string[] _cols = { "NameAndAddressBook.CompanyID, NameAndAddressBook.CompanyName, NameAndAddressBook.Customer" }; //SubSonic.SqlQuery _query = DAL.Logistics.DB.Select(_cols).From(DAL.Logistics.Tables.NameAndAddressBook).Paged(e.BeginIndex + 1, e.EndIndex +1, "CompanyID").WhereExpression("CompanyName").Like(string.Format("%{0}%", e.Filter.ToString())).And("Customer").IsEqualTo(true) ; SubSonic.SqlQuery _query = DAL.Logistics.DB.Select(_cols).From(DAL.Logistics.Tables.NameAndAddressBook).Paged(e.BeginIndex + 1, e.EndIndex + 1, "CompanyID").WhereExpression("CompanyName").Like(string.Format("%{0}%", e.Filter.ToString())); IDataReader _rd = _query.ExecuteReader(); _combo.DataSource = _rd; _combo.ValueField = "CompanyID"; _combo.TextField = "CompanyName"; _combo.DataBind(); } }
protected void dxcboContainer_ItemsRequestedByFilterCondition(object source, DevExpress.Web.ASPxEditors.ListEditItemsRequestedByFilterConditionEventArgs e) { DevExpress.Web.ASPxEditors.ASPxComboBox _combo = (DevExpress.Web.ASPxEditors.ASPxComboBox)source; string _filter = !string.IsNullOrEmpty(e.Filter) ? e.Filter : ""; //use datareaders - much faster than loading into collections string[] _cols = { "ContainerSubID", "ContainerNumber" }; string[] _sort = { "ContainerNumber" }; //SubSonic.SqlQuery _query = DAL.Logistics.DB.Select(_cols).From(DAL.Logistics.Tables.NameAndAddressBook).Paged(e.BeginIndex + 1, e.EndIndex + 1, "CompanyID").WhereExpression("CompanyName").Like(string.Format("%{0}%", e.Filter.ToString())); SubSonic.SqlQuery _query = DAL.Logistics.DB.Select(_cols).From(DAL.Logistics.Views.PearsonRugbyContainerView).Paged(e.BeginIndex + 1, e.EndIndex + 1).Where("ContainerNumber").StartsWith(string.Format("{0}%", _filter)); IDataReader _rd = _query.ExecuteReader(); _combo.DataSource = _rd; _combo.ValueField = "ContainerSubID"; _combo.TextField = "ContainerNumber"; _combo.DataBindItems(); }
//end pdf #endregion #region incremental filtering for previous titles /// <summary> /// incremental filtering and partial loading of name and address book for speed /// both ItemsRequestedByFilterCondition and ItemRequestedByValue must be set up for this to work /// </summary> /// <param name="source"></param> /// <param name="e"></param> protected void dxcbotitle_ItemsRequestedByFilterCondition(object source, DevExpress.Web.ASPxEditors.ListEditItemsRequestedByFilterConditionEventArgs e) { //restricted to logged in user DevExpress.Web.ASPxEditors.ASPxComboBox _combo = (DevExpress.Web.ASPxEditors.ASPxComboBox)source; int _printerid = wwi_func.vint(this.dxlblprinter2.Text.ToString()); string _filter = !string.IsNullOrEmpty(e.Filter) ? e.Filter : ""; { //use datareaders - much faster than loading into collections string[] _cols = { "PublishipAdvanceTitleTable.PATitleID, PublishipAdvanceTitleTable.Title, PublishipAdvanceOrderTable.PrinterID" }; //string[] _cols = { "PublishipAdvanceTitleTable.PATitleID, PublishipAdvanceTitleTable.Title" }; SubSonic.SqlQuery _query = DAL.Logistics.DB.Select(_cols).From(DAL.Logistics.Tables.PublishipAdvanceOrderTable).LeftOuterJoin("PublishipAdvanceTitleTable", "PAOrderID", "PublishipAdvanceOrderTable", "OrderID").Paged(e.BeginIndex + 1, e.EndIndex + 1, "PATitleID").WhereExpression("Title").Like(string.Format("%{0}%", e.Filter.ToString())).And("PrinterId").IsEqualTo(_printerid); //SubSonic.SqlQuery _query = DAL.Logistics.DB.Select(_cols).From(DAL.Logistics.Tables.PublishipAdvanceTitleTable).Paged(e.BeginIndex + 1, e.EndIndex + 1, "PATitleID").WhereExpression("Title").Like(string.Format("%{0}%", e.Filter.ToString())); IDataReader _rd = _query.ExecuteReader(); _combo.DataSource = _rd; _combo.ValueField = "PATitleID"; _combo.TextField = "Title"; _combo.DataBind(); } }
public abstract void ItemsRequestedByFilterCondition(Session session, object source, DevExpress.Web.ASPxEditors.ListEditItemsRequestedByFilterConditionEventArgs e);
protected void cboBuiltInSingleSelectionList_ItemsRequestedByFilterCondition(object source, DevExpress.Web.ASPxEditors.ListEditItemsRequestedByFilterConditionEventArgs e) { NASCustomFieldTypeBuiltInSingleSelectionListStrategy.ItemsRequestedByFilterCondition(session, source, e); }