How to have an settings value in a numerator?

StatusIDPriorityType
Closed30146MajorQuestion
ProfileReply
gabossoloClient

How to have an application settings value in business numerator?

Thank you!

Replies

UserDescriptionPosted On
MariyaVoytovichAgent

Hello gabjssolo!

I did not quite understand your task.
Please provide more information.

Feel free to contact us if you have any questions.

Regards,
Mariya
On behalf of Xafari Client Services Team

gabossoloClient

Hi Mariya ! Sorry for my bad english.

This is how to get a setting value from the code:

if (SettingsAccessor.Instance == null) return;
this.InvoicePrefix = ((IModelNorthwindSettings)SettingsAccessor.Instance.ObjectSpace.AppSettings().Root()).Documents.Invoice.Prefix.Value;

And my question is how to use the SettingsAccessor value in a Business Numerators?

I would like to have: Invoice.Prefix.Value_{0:,0000}

Example: CTL00001

I hope I was more explicit...

Regards, GB

gabossoloClient

Hi ! I found another way around my difficulty...

SOLUTION:

public override void AfterConstruction()
{
base.AfterConstruction();

if (SettingsAccessor.Instance == null || ((InheritedUser) SecuritySystem.CurrentUser).Site == null) return;
this.Site = Session.GetObjectByKey(((InheritedUser)SecuritySystem.CurrentUser).Site.Oid);
var prefix = ((IModelAppSettings) SettingsAccessor.Instance.ObjectSpace.AppSettings().Root()) .Billing.InvoicePrefix.Value;
this.NumberPart = $"{prefix}{Site.Code}{DateTime.Now:yy}{DateTime.Now:MM}";
}

[Browsable(false)]
[NonPersistent]
public string NumberPart
{
get => GetPropertyValue("NumberPart");
set => SetPropertyValue("NumberPart", value);
}

And then appy this template: {0:NumberPart}{0:,000000}

gabossoloClient

Hi ! I found another way around my difficulty...

SOLUTION:

public override void AfterConstruction()
{
base.AfterConstruction();

if (SettingsAccessor.Instance == null || ((InheritedUser) SecuritySystem.CurrentUser).Site == null) return;
this.Site = Session.GetObjectByKey(((InheritedUser)SecuritySystem.CurrentUser).Site.Oid);
var prefix = ((IModelAppSettings) SettingsAccessor.Instance.ObjectSpace.AppSettings().Root()) .Billing.InvoicePrefix.Value;
this.NumberPart = $"{prefix}{Site.Code}{DateTime.Now:yy}{DateTime.Now:MM}";
}

[Browsable(false)]
[NonPersistent]
public string NumberPart
{
get => GetPropertyValue("NumberPart");
set => SetPropertyValue("NumberPart", value);
}

And then appy this template: {0:NumberPart}{0:,000000}

× This ticket is closed.

Write US