Esempio n. 1
0
        private void view_ShowFilterPopup(object sender, FilterPopupEventArgs e)
        {
            combo = e.ComboBoxEdit;
            List <object>      list       = combo.ItemsSource as List <object>;
            CustomComboBoxItem customItem = new CustomComboBoxItem()
            {
                DisplayValue = "(Custom)", EditValue = new CustomComboBoxItem()
            };
            List <object> data  = new List <object>();
            int           index = 0;

            for (int i = 0; i < list.Count; i++)
            {
                data.Add(list[i]);
                if (list[i] is CustomComboBoxItem)
                {
                    if ((list[i] as CustomComboBoxItem).DisplayValue.ToString() == "(Non blanks)")
                    {
                        index = i;
                        break;
                    }
                }
            }
            list.RemoveRange(0, index + 1);
            data.Add(customItem);
            data.AddRange(list);
            combo.ItemsSource           = data;
            e.ComboBoxEdit.PopupOpened += ComboBoxEdit_PopupOpened;
            focusedColumn = (GridColumn)e.Column;
            e.Handled     = true;
        }
Esempio n. 2
0
        private void TableView_ShowFilterPopup(object sender, FilterPopupEventArgs e)
        {
            if (e.Column.FieldName != "RegistrationDate")
            {
                return;
            }
            List <object> filterItems = new List <object>();

            filterItems.Add(new CustomComboBoxItem()
            {
                DisplayValue = "(All)",
                EditValue    = new CustomComboBoxItem()
            });
            filterItems.Add(new CustomComboBoxItem()
            {
                DisplayValue = "Registered in 2008",
                EditValue    = CriteriaOperator.Parse(string.Format(
                                                          "[RegistrationDate] >= #{0}# AND [RegistrationDate] < #{1}#",
                                                          new DateTime(2008, 1, 1), new DateTime(2009, 1, 1)))
            });
            filterItems.Add(new CustomComboBoxItem()
            {
                DisplayValue = "Registered in 2009",
                EditValue    = CriteriaOperator.Parse(string.Format(
                                                          "[RegistrationDate] >= #{0}# AND [RegistrationDate] < #{1}#",
                                                          new DateTime(2009, 1, 1), new DateTime(2010, 1, 1)))
            });
            e.ComboBoxEdit.ItemsSource = filterItems;
        }
Esempio n. 3
0
        void EmployeeTasks_ShowFilterPopup(object sender, FilterPopupEventArgs e)
        {
            if (e.Column.FieldName != "Status")
            {
                return;
            }
            List <object> statusFilterItems = new List <object>()
            {
                new CustomComboBoxItem()
                {
                    DisplayValue = "(All)",
                    EditValue    = new CustomComboBoxItem()
                },
                new CustomComboBoxItem()
                {
                    DisplayValue = "Complete",
                    EditValue    = CriteriaOperator.Parse("[Status] = ##Enum#DevExpress.DevAV.EmployeeTaskStatus,Completed#")
                },
                new CustomComboBoxItem()
                {
                    DisplayValue = "Incomplete",
                    EditValue    = CriteriaOperator.Parse("Not([Status] = ##Enum#DevExpress.DevAV.EmployeeTaskStatus,Completed#)")
                }
            };

            e.ComboBoxEdit.ItemsSource = statusFilterItems;
        }
Esempio n. 4
0
        private void AssociatedObject_ShowFilterPopup(object sender, FilterPopupEventArgs e)
        {
            PredefinedFilterCollection predefinedFilters = FilterHelper.GetPredefinedFilters(MediaType, e.Column.FieldName);

            if (predefinedFilters != null)
            {
                e.ExcelColumnFilterSettings.FilterItems.Clear();
                foreach (PredefinedFilter predefinedFilter in predefinedFilters)
                {
                    e.ExcelColumnFilterSettings.FilterItems.Add(new CustomComboBoxItem {
                        EditValue = predefinedFilter.Filter, DisplayValue = predefinedFilter.Name
                    });
                }
            }
        }
Esempio n. 5
0
 private void Ok_Click(object sender, RoutedEventArgs e)
 {
     if (FilterPopupEvent != null)
     {
         FilterPopupEventArgs args = new FilterPopupEventArgs {
             Filter = ReadFilter()
         };
         try
         {
             FilterPopupEvent(args);
         }
         catch (Exception ex)
         {
             FinanceMessageBox.Error(ex.Message);
         }
     }
     Close();
 }
        private void OnShowFilterPopup(object sender, FilterPopupEventArgs ea)
        {
            var setts = ea.Column.EditSettings as CustomGridSimpleLookupEditSettings;

            if (setts == null)
            {
                return;
            }

            var items = setts.GetAutoFilterItems(ea.Column.FieldName);

            if (items == null)
            {
                return;
            }

            ea.ComboBoxEdit.ItemsSource = items;

            RaiseFilterChanged();
        }
Esempio n. 7
0
        static void OnViewShowFilterPopup(object sender, FilterPopupEventArgs e)
        {
            if (!GetIsEnabled(e.Column))
            {
                return;
            }
            string fieldName = e.Column.FieldName;

            if (string.IsNullOrEmpty(fieldName))
            {
                return;
            }
            PropertyInfo             propertyInfo     = null;
            Dictionary <int, object> valuesDictionary = new Dictionary <int, object>();

            AddBlanksAndNotBlanks(fieldName, valuesDictionary);
            foreach (object item in (IEnumerable <object>)((GridControl)e.Column.View.DataControl).ItemsSource)
            {
                if (propertyInfo == null)
                {
                    propertyInfo = GetPropertyInfo(item.GetType(), fieldName);
                    if (propertyInfo == null)
                    {
                        return;
                    }
                }
                DateTime dateTimeValue;
                try {
                    dateTimeValue = (DateTime)propertyInfo.GetValue(item, null);
                } catch (NullReferenceException) {
                    continue;
                }
                int value = dateTimeValue.Year;
                AddItem(valuesDictionary, value, fieldName);
            }
            e.ComboBoxEdit.ItemsSource = GetSortedByKeyValues(valuesDictionary);;
        }
Esempio n. 8
0
        private void ShowFilterPopup(FilterPopupEventArgs e)
        {
            if (e.Column.FieldName == "DateOrder") {

                var v1 = e.ComboBoxEdit.ItemsSource as List<object>;
                //ppp
                //List<CustomComboBoxItem> listItems = v1.Cast<CustomComboBoxItem>().ToList();

                //var listMonth1 = listItems.Where(x => x.EditValue is DateTime).ToList();
                //var listMonth2 = listMonth1.Select(x => new { dt = ((DateTime)x.EditValue) }).ToList();
                //var listMonth3 = listMonth2.Select(x => new { mnt = new DateTime(x.dt.Year, x.dt.Month,1) }).ToList();
                //var listMonth4 = listMonth3.GroupBy(x => x.mnt).Select(y => new { vl =(DateTime) y.Key }).ToList();
                //var listMonth5 = listMonth4.Select(x => new { Display = x.vl.ToString("MMM yyyy"), v1 = x.vl, v2 = x.vl.AddMonths(1) }).ToList();
                //var listMonth6 = listMonth5.Select(x => new CustomComboBoxItem() { DisplayValue = x.Display, EditValue = CriteriaOperator.Parse(string.Format("[DateOrder]>=#{0}# and [DateOrder]<#{1}#", x.v1, x.v2)) }).ToList();

                var listMonth = v1.Cast<CustomComboBoxItem>().Where(x => x.EditValue is DateTime).Select(x => new { dt = ((DateTime)x.EditValue) }).Select(x => new { mnt = new DateTime(x.dt.Year, x.dt.Month, 1) }).GroupBy(x => x.mnt).Select(y => new { vl = (DateTime)y.Key }).Select(x => new { Display = x.vl.ToString("MMM yyyy"), v1 = x.vl, v2 = x.vl.AddMonths(1) }).Select(x => new CustomComboBoxItem() { DisplayValue = x.Display, EditValue = CriteriaOperator.Parse(string.Format("[DateOrder]>=#{0}# and [DateOrder]<#{1}#", x.v1, x.v2)) }).ToList();
                e.ComboBoxEdit.ItemsSource = listMonth;
            }
            if (e.Column.FieldName == "ParentTag") {
                var l = AllTags.Select(x => new CustomComboBoxItem() { DisplayValue = x.TagName, EditValue = x.TagName }).ToList();
                e.ComboBoxEdit.ItemsSource = l;
            }
        }
Esempio n. 9
0
        private void TableView_ShowFilterPopup(object sender, FilterPopupEventArgs e)
        {
            
            if (e.Column.FieldName == "IDMultipleNormalxxx")
            {
                List<object> filterItems = new List<object>();
                foreach (object obj in e.ComboBoxEdit.ItemsSource)
                {
                    if (obj as CustomComboBoxItem != null)
                    {
                        filterItems.Add(obj);
                    }
                }

                //List<Multiple> multiples = animationManager.Products.Select(ap => ap.Multiple).ToList();
                //foreach (Multiple m in multiples)
                //{
                //    filterItems.Add(m);
                //}

                List<Guid?> normalMultiples = animationManager.Products.Select(ap => ap.IDMultipleNormal).ToList();
                foreach (Guid? guid in normalMultiples)
                {
                    if (guid != null)
                    {
                        Multiple multiple = MultipleManager.Instance.GetAll().Single(mm => mm.ID == guid.Value);
                        string displayValue = string.Format("{0} - {1}", multiple.Value, multiple.Product.MaterialCode);
                        if (filterItems.Any(item => (item as CustomComboBoxItem).DisplayValue.ToString() == displayValue.ToString()) == false)
                        {
                            filterItems.Add(new CustomComboBoxItem()
                            {
                                DisplayValue = displayValue,
                                EditValue = CriteriaOperator.Parse(string.Format("[IDMultipleNormal] = ?"), guid.Value)
                            });
                        }
                    }
                }

                e.ComboBoxEdit.ItemsSource = filterItems;
               
            }
        }
        void View_ShowFilterPopup(object sender, FilterPopupEventArgs e)
        {
            if (e.Column.FieldName == "AllocationRemainder")
            {
                CustomComboBoxItem item = new CustomComboBoxItem();
                item.DisplayValue = "Products with Allocation Remainder > 0";
                item.EditValue = CriteriaOperator.Parse("[AllocationRemainder] > 0");
                List<object> itemssSource = e.ComboBoxEdit.ItemsSource.Cast<object>().ToList();
                itemssSource.Add(item);

                e.ComboBoxEdit.ItemsSource = itemssSource;
            }
        }