using System;
using DevExpress.Xpo;
using DevExpress.ExpressApp;
using DevExpress.Persistent.Base;
using DevExpress.Persistent.BaseImpl;
using DevExpress.Persistent.Validation;
using DevExpress.ExpressApp.Editors;
using DevExpress.ExpressApp.Utils;
using System.ComponentModel;
using Fleetman.Module.BusinessObjects.CRM;
using DevExpress.ExpressApp.DC;
namespace Fleetman.Module.BusinessObjects.Common
{
[DefaultClassOptions, ImageName("Action_Filter"),NavigationItem("Słowniki")]
public class FilteringCriterion : BaseObject {
public FilteringCriterion(Session session) : base(session) { }
[RuleRequiredField("DescriptionIsRequiredinFilterCriteria", DefaultContexts.Save,
CustomMessageTemplate ="Wpisz nazwę filtra")]
public string Description {
get { return GetPropertyValue<string>("Description"); }
set { SetPropertyValue<string>("Description", value); }
}
[ValueConverter(typeof(TypeToStringConverter)), ImmediatePostData]
[TypeConverter(typeof(LocalizedClassInfoTypeConverter))]
public Type ObjectType {
get { return GetPropertyValue<Type>("ObjectType"); }
set {
SetPropertyValue<Type>("ObjectType", value);
Criterion = String.Empty;
}
}
[CriteriaOptions("ObjectType"), Size(SizeAttribute.Unlimited)]
[EditorAlias(EditorAliases.PopupCriteriaPropertyEditor)]
public string Criterion {
get { return GetPropertyValue<string>("Criterion"); }
set { SetPropertyValue<string>("Criterion", value); }
}
bool prywatny;
public bool Prywatny
{
get => prywatny;
set => SetPropertyValue(nameof(Prywatny), ref prywatny, value);
}
string criteriaToCopy;
[Size(SizeAttribute.Unlimited)]
public string CriteriaToCopy
{
get => criteriaToCopy;
set => SetPropertyValue(nameof(CriteriaToCopy), ref criteriaToCopy, value);
}
// [Association("FilteringCriterion-EmployeeRoleCollection")]
[XafDisplayName("Dostępny tylko dla grup")]
[Association("EmployeeRole-FilteringCriterionCollection")]
public XPCollection<EmployeeRole> EmployeeRoleCollection
{
get
{
return GetCollection<EmployeeRole>(nameof(EmployeeRoleCollection));
}
}
}
}