Dit programma staat toe om de op het “Grote boek” tabblad van de klantenwaardering de einddatum toe te voegen. Deze ontwikkeling is gebouwd op een SigCli customizer die de volgende interfaces implementeert:
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using MercatorApi;
using MercatorUi;
using System.Windows.Forms;
namespace SigCli
{
public class Customizer : MercatorUi.ICustomizers.IStringUpdater, MercatorUi.ICustomizers.IFormLoadCustomizer,
MercatorUi.ICustomizers.IFormClosedCustomizer
{
public string StringUpdate(string StringToModify)
{
string id = Api.StrExtract(StringToModify, "<ID>", "</ID>");
if(id == "LEDGER_CLI")
return StringToModify.Replace("lignes_c.date,", "lignes_c.date,lignes_c.echeance,").Replace(",date,", ",date,echeance,").Replace("convert(datetime, '2999-12-31 0:0:0.0', 121),", "convert(datetime, '2999-12-31 0:0:0.0', 121),convert(datetime, '2999-12-31 0:0:0.0', 121),");
else
return StringToModify;
}
public void FormLoadCustomize(System.Windows.Forms.Form WindowsForm)
{
MercatorUi.Forms.Sig.SigForm sigForm = (MercatorUi.Forms.Sig.SigForm) WindowsForm;
List<Control> l = sigForm.FindMovableControlsByType(typeof(MercatorUi.Forms.Sig.SigGrids.Ledger));
if (l.Count > 0)
{
MercatorUi.Forms.Sig.SigGrids.Ledger ledger = (MercatorUi.Forms.Sig.SigGrids.Ledger) l[0];
ledger.AfterColumnsCreated += new MercatorUi.Forms.Sig.SigGrids.Ledger.AfterColumnsCreatedHandler(Ledger_AfterColumnsCreated);
}
}
public void FormClosedCustomize(System.Windows.Forms.Form WindowsForm)
{
MercatorUi.Forms.Sig.SigForm sigForm = (MercatorUi.Forms.Sig.SigForm) WindowsForm;
List<Control> l = sigForm.FindMovableControlsByType(typeof(MercatorUi.Forms.Sig.SigGrids.Ledger));
if (l.Count > 0)
{
MercatorUi.Forms.Sig.SigGrids.Ledger ledger = (MercatorUi.Forms.Sig.SigGrids.Ledger) l[0];
ledger.AfterColumnsCreated -= new MercatorUi.Forms.Sig.SigGrids.Ledger.AfterColumnsCreatedHandler(Ledger_AfterColumnsCreated);
}
}
private void Ledger_AfterColumnsCreated(object sender, EventArgs e)
{
MercatorUi.Forms.Sig.SigGrids.Ledger ledger = (MercatorUi.Forms.Sig.SigGrids.Ledger) sender;
ledger.Grid.Columns.Add("echeance", "Echéance");
ledger.Grid.Columns["echeance"].Width = 68;
ledger.Grid.Columns["echeance"].DataPropertyName = "echeance";
ledger.Grid.Columns["echeance"].DefaultCellStyle.Format = Api.Iif(MercatorUi.Globals.DateMDY, "MM/dd/yyyy", "dd/MM/yyyy");
}
}
}