Ce customizer permet d'arrondir l'heure de fin au quart d'heure supérieur à la sortie de l'écran de saisie des prestations. Ce customizer, à placer dans les séquences concernées, implémente les interfaces suivantes :
Il exploite essentiellement l'évènement ProviderTimeBeforeOk du BillingEngine du document en cours.
Le code s'établit comme suit :
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Windows.Forms;
using MercatorApi;
using MercatorUi;
namespace Billing
{
public class Customizer : MercatorUi.ICustomizers.IBillingEngineCreated, MercatorUi.ICustomizers.IBillingEngineClosed
{
public void BillingEngineCreated(MercatorUi.Engine.Gescom.BillingEngine BillingEngine)
{
BillingEngine.ProviderTimeBeforeOk += new MercatorUi.Engine.Gescom.BillingEngine.ProviderTimeBeforeOkEventHandler(BillingEngine_ProviderTimeBeforeOk);
}
public void BillingEngineClosed(MercatorUi.Engine.Gescom.BillingEngine BillingEngine)
{
BillingEngine.ProviderTimeBeforeOk -= new MercatorUi.Engine.Gescom.BillingEngine.ProviderTimeBeforeOkEventHandler(BillingEngine_ProviderTimeBeforeOk);
}
void BillingEngine_ProviderTimeBeforeOk(object sender, MercatorUi.Engine.Gescom.BillingEngine.ProviderTimeBeforeOkEventArgs e)
{
int min2 = Api.ValSafeInt(e.ProviderTimePanel.HourMinEnd.Text.Substring(3, 2));
if ((min2 > 0) && (min2 < 15))
e.ProviderTimePanel.HourMinEnd.Text = e.ProviderTimePanel.HourMinEnd.Text.Substring(0, 3) + "15";
else if ((min2 > 15) && (min2 < 30))
e.ProviderTimePanel.HourMinEnd.Text = e.ProviderTimePanel.HourMinEnd.Text.Substring(0, 3) + "30";
else if ((min2 > 30) && (min2 < 45))
e.ProviderTimePanel.HourMinEnd.Text = e.ProviderTimePanel.HourMinEnd.Text.Substring(0, 3) + "45";
else if ((min2 > 45) && (min2 <= 59))
e.ProviderTimePanel.HourMinEnd.Text = Convert.ToString(Api.ValSafeInt(e.ProviderTimePanel.HourMinEnd.Text.Substring(0, 2)) + 1).PadLeft(2, '0') + ":00";
}
}
}