Getting values of PeriodFilter in code

StatusIDPriorityTypeTags
Closed24294MajorQuestioncode get PeriodFilter
ProfileReply
lucas.swapiClient

I'm trying to get the public properties of PeriodFilter through ViewController because I have a NonPersistent List that is filled directly by a function in the database.
How can I perform this solution in order to pass the End and Start values in the call of function?

Regards

Replies

UserDescriptionPosted On
NikolayAgent

Hello lucas.swapi,

We need more time to prepare the answer for your question.

Thank you for your patience.

Best regards,
Nikolay.

NikolayAgent

Hello Lucas,

I am sorry for a long silence.
Here is the code snippet that shows how you can get and set PeriodFilter value from your code.

 

using Xafari.Filters;
using Xafari.Base;
using System.Globalization;

public partial class CustomPeriodFilterController1 : ViewController
{
private DevExpress.ExpressApp.Actions.SimpleAction simpleAction1;
...
public CustomPeriodFilterController1()
{
...
this.simpleAction1.Execute += new DevExpress.ExpressApp.Actions.SimpleActionExecuteEventHandler(this.simpleAction1_Execute);
}
...
private void simpleAction1_Execute(object sender, SimpleActionExecuteEventArgs e)
{
var controller = this.Frame.GetController<PeriodFilterController>();
if (controller == null) return;
var action = (Xafari.Actions.PopupContainerShowAction)controller.Actions["PeriodFilterAction"];
if (action == null) return;
// Now you can get the filter value from action
var currentFilterValue = (PeriodStruct?)action.Value ?? PeriodStruct.Empty;
System.Diagnostics.Trace.WriteLine(string.Format("{0}", currentFilterValue));
// Also you can set the value to action
action.Value = new PeriodStruct
{
Start = DateTime.ParseExact("2014-01-01", "yyyy-MM-dd", new CultureInfo("en-US")),
End = DateTime.ParseExact("2014-12-31", "yyyy-MM-dd", new CultureInfo("en-US"))
};
}
...
}

 

If you have more questions feel free to ask. I will be glad to answer.

Best regards,
Nikolay.

lucas.swapi

Thank you for the solution, Nikolay.
I'll check this soon!

Regards

× This ticket is closed.

Write US