protected override void OnActivated() { base.OnActivated(); // Perform various tasks depending on the target View. View.ControlsCreated += new EventHandler(View_ControlsCreated); XPQuery<TimekeepingName> _TimekeepingName = new XPQuery<TimekeepingName>(( (XPObjectSpace)ObjectSpace).Session); List<TimekeepingName> listTimekeepingName = (from tso in _TimekeepingName select tso).ToList(); acFilterByTimekeepingMonth.Items.Clear(); foreach (TimekeepingName item in listTimekeepingName) { if (item.StartDate <= DateTime.Now && DateTime.Now <= item.EndDate) { tkname = item; } setLookupItem = new ChoiceActionItem(item.timekeepingName, item); acFilterByTimekeepingMonth.Items.Add(setLookupItem); } if (listTimekeepingName != null) { if (tkname == null) { tkname = listTimekeepingName[0]; } ((DevExpress.ExpressApp.ListView)View).CollectionSource.Criteria["Filter1"] = new BinaryOperator( "TimekeepingName.Oid", tkname.Oid, BinaryOperatorType.Equal); } }
private void acFilterByTimekeepingMonth_Execute(object sender, SingleChoiceActionExecuteEventArgs e) { tkname = e.SelectedChoiceActionItem.Data as TimekeepingName; ((DevExpress.ExpressApp.ListView)View).CollectionSource.Criteria["Filter1"] = new BinaryOperator( "TimekeepingName.Oid", tkname.Oid, BinaryOperatorType.Equal); }