DomainObject Attributes
TextArea and Hide from ListView
[Size(SizeAttribute.Unlimited), VisibleInListView(true)]
XAF Display Label
[XafDisplayName("")]
[Association("FileLog-DonorFileRecords"), Aggregated]
https://documentation.devexpress.com/#CoreLibraries/CustomDocument2127
The retrieved collection of persistent objects can also be filtered. Use its XPBaseCollection.Filter property to apply the desired filter.
Criteria
https://documentation.devexpress.com/#CoreLibraries/CustomDocument2038
Validation Rule
https://documentation.devexpress.com/#eXpressAppFramework/CustomDocument113008
Rule to prevent record being deleted when there is record in the collection
[RuleRequiredField(DefaultContexts.Delete, InvertResult = true, CustomMessageTemplate = "The {TargetPropertyName} collection is not empty")] public XPCollection<WBSMapping> WBSMappings { get { return GetCollection<WBSMapping>("WBSMappings"); } }
Sum in BO
public decimal TotalAmount { get { object result = Session.Evaluate(typeof(ApplicationMain), CriteriaOperator.Parse("Sum(AmountL)"), CriteriaOperator.Parse("FileSource.Oid = ?", Oid)); decimal res = Convert.ToDecimal(result); return res; } } public bool IsNewRecord { get { return Session.IsNewObject(this); } }
//Disable all Delete button
https://documentation.devexpress.com/#eXpressAppFramework/CustomDocument112728
protected override void OnActivated()
{
base.OnActivated();
// Perform various tasks depending on the target View.
DeleteObjectsViewController deleteController =
Frame.GetController<DeleteObjectsViewController>();
if (deleteController != null)
{
deleteController.Active["Deactivation in code"] = true;
// !(View.ObjectTypeInfo.Type == typeof(PostingPeriod));
}
}
Show Popup Windows
var spc = View.CurrentObject as SpecialProjectClosure;
//IObjectSpace iosp = XPObjectSpace.FindObjectSpaceByObject(refund);
var iosp = Application.CreateObjectSpace();
var chooseobj = iosp.CreateObject<ApplicationMain>();
DetailView dv = Application.CreateDetailView(iosp, chooseobj);
dv.ViewEditMode = ViewEditMode.Edit;
ShowViewParameters svp = new ShowViewParameters();
svp.Context = TemplateContext.PopupWindow;
svp.CreateAllControllers = true;
svp.TargetWindow = TargetWindow.NewModalWindow;
svp.CreatedView = dv;
DialogController dc = Application.CreateController<DialogController>();
dc.SaveOnAccept = false;
dc.Accepting += dc_AcceptingRecordSelect; // This is an event handler. The dc_Accepting will be executed when Accepting event happens (user click OK button of the window)
dc.Tag = spc; // pass the current db connection so that we can use it inside the accepting function
svp.Controllers.Add(dc);
Show Popup Windows from Action Button
var refund = View.CurrentObject as Refund; //IObjectSpace iosp = XPObjectSpace.FindObjectSpaceByObject(refund); var iosp = Application.CreateObjectSpace(); var chooseobj = iosp.CreateObject<ChooseApplicationMain>(); chooseobj.DonatingWBS = iosp.GetObject(refund.DonatingWBS); DetailView dv = Application.CreateDetailView(iosp, chooseobj); dv.ViewEditMode = ViewEditMode.Edit; e.ShowViewParameters.Context = TemplateContext.PopupWindow; e.ShowViewParameters.CreateAllControllers = true; e.ShowViewParameters.TargetWindow = TargetWindow.NewModalWindow; e.ShowViewParameters.CreatedView = dv; DialogController dc = Application.CreateController<DialogController>(); dc.SaveOnAccept = false; dc.Accepting += dc_AcceptingRecordSelect; // This is an event handler. The dc_Accepting will be executed when Accepting event happens (user click OK button of the window) dc.Tag = refund; // pass the current db connection so that we can use it inside the accepting function e.ShowViewParameters.Controllers.Add(dc);Permission
Boolean isEditingGranted = DataManipulationRight.CanEdit(View, View.CurrentObject, LinkToListViewController.FindCollectionSource(Frame));
editAction.Active[isGrantedToEditKey] = isEditingGranted;
Master Detail
- To avoid saving of Master record while adding or editing Child record, assign e.ObjectSpace to View.ObjectSpace during ObjectCreating event
XPObjectSpace.FindObjectSpaceByObject Method
Use XAF Module library in Non-XAF application
BarcodeApp app = new BarcodeApp(); app.ConnectionString = connectionString; app.ApplicationName = "DAS"; app.Modules.Add(new DAS.Module.DASModule()); app.Setup();
No comments:
Post a Comment