Voeg extra kolommen toe aan het aanverwante artikelen raster (in de code)

0000002317     -      29-03-2019

De customizer hieronder staat het toevoegen van een kolom toe die een veld neemt in het record van de aanverwante artikelen.
In ons voorbeeld gaat het over sleutel 3, maar alle velden uit de tabel STOCK zijn beschikbaar.

 

Zoom
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using MercatorApi;
using MercatorUi;
using System.Windows.Forms;
using System.Reflection;

namespace Main
{
    public class Customizer : MercatorUi.ICustomizers.IExec
    {
        public void Main(MercatorUi.ICustomizers.ExecAction Action)
        {
            if (Action == MercatorUi.ICustomizers.ExecAction.DossierOpen)
            {
                Globals.Main.BaseFormCreating += new MercatorUi.Main.BaseFormCreatingEventHandler(Main_BaseFormCreating);
            }
            else if (Action == MercatorUi.ICustomizers.ExecAction.DossierClose)
            {
                Globals.Main.BaseFormCreating -= new MercatorUi.Main.BaseFormCreatingEventHandler(Main_BaseFormCreating);
            }
        }

        void Main_BaseFormCreating(object sender, MercatorUi.Main.BaseFormCreatingEventArgs e)
        {
            if ((e.Form.GetType() == typeof(MercatorUi.Forms.Billing.BillingDialogs.BillingAskMariage))
                && (Globals.CurrentUser != null))
            {
                MercatorUi.Forms.Billing.BillingDialogs.BillingAskMariage billingAskMariage = (MercatorUi.Forms.Billing.BillingDialogs.BillingAskMariage) e.Form;
                billingAskMariage.FullInitialized += new EventHandler(BillingAskMariage_FullInitialized);
                
            }
        }
        void BillingAskMariage_FullInitialized(object sender, EventArgs e)
        {
            MercatorUi.Forms.Billing.BillingDialogs.BillingAskMariage billingAskMariage = (MercatorUi.Forms.Billing.BillingDialogs.BillingAskMariage) sender;
            billingAskMariage.Grid.Columns.Add("s_cle3", "cle3");
            billingAskMariage.Grid.Columns["s_cle3"].DataPropertyName = "s_cle3";
        }
    }
}