Spring V10, Extensibility, how to use the function: this.ContextService.Articleprices.Getedita(Dynamic Index)

Asked

Viewed 216 times

-3

In Spring V10, in API Extensibility:

  1. I have a Customtab in "Article Sheet"
  2. I need to access the article/currency currently being edited in the form.
  3. I use the instruction: MessageBox.Show(this.ContextService.ArtigoPrecos.NumItens.ToString());to detect how many items there are and reports 1 item that corresponds to the currency being edited

How can I use the instruction: this.ContextService.ArtigoPrecos.GetEdita(dynamic Index) to obtain the type object BasBEArtigoMoeda?

Currently to get this data from the database I use:

BasBEArtigoMoeda artigoMoeda this.ContextService.BSO.Base.ArtigosPrecos.Edita(
    this.ContextService.Artigo.Artigo, 
    this.ContextService.BSO.Contexto.MoedaBase,
    this.ContextService.Artigo.UnidadeVenda);
  • this.ContextService.Articleprices.Getedita(1) returns the first coin to be edited

1 answer

0

Good morning,

Manipulation of these values in the article sheet from a user separator can be done as follows::

if (this.ContextService.ArtigoPrecos != null)
{
    BasBEArtigoMoeda precos = this.ContextService.ArtigoPrecos.First(p => (p.Moeda == this.ContextService.BSO.Contexto.MoedaBase) && (p.Unidade == this.ContextService.Artigo.UnidadeVenda));

    if (precos != null)
    {
        precos.PVP1 = 2.2;
        this.ContextService.CommitContext();
    }
}

It is important that the instruction this.ContextService.CommitContext() is invoked at the end so that the values in the fiche are updated.

  • O código: BasBEArtigoMoeda precos = this.ContextService.ArtigoPrecos.First(p => (p.Moeda == this.ContextService.BSO.Contexto.MoedaBase) && (p.Unidade == this.ContextService.Artigo.UnidadeVenda)); Dá erro "Erro ao carregar o registo na extensibilidade"

  • Try placing the following before if: this.ContextService.Refreshcontext();

  • I chose to make extra validations in Uifichaartigo for events that will influence data loading.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.