using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Windows.Forms;
using MercatorApi;
using MercatorExtensions;
using MercatorUi;
namespace Billing
{
public class Customizer : MercatorUi.ICustomizers.IBillingEngineCreated, MercatorUi.ICustomizers.IBillingEngineClosed
{
public void BillingEngineCreated(MercatorUi.Engine.Gescom.BillingEngine BillingEngine)
{
BillingEngine.BeforeSave += BillingEngine_BeforeSave;
}
public void BillingEngineClosed(MercatorUi.Engine.Gescom.BillingEngine BillingEngine)
{
BillingEngine.BeforeSave -= BillingEngine_BeforeSave;
}
void BillingEngine_BeforeSave(object sender, MercatorUi.Engine.Gescom.BillingEngine.BeforeSaveEventArgs e)
{
MercatorUi.Engine.Gescom.BillingEngine billingEngine = (MercatorUi.Engine.Gescom.BillingEngine)sender;
if (MercatorUi.Globals.IsMercatorPenguinServer)
{
if (!billingEngine.PenguinBeforeSaveAnswers.ContainsKey(1))
{
e.PenguinQuestion = new MercatorPenguin.Question
{
Id = 1,
Text = "Bevestigen in customizer ?",
Type = MercatorPenguin.Question.QuestionTypeEnum.YesNo,
AbortIfCancel = true
};
return;
}
if (!billingEngine.PenguinBeforeSaveAnswers.ContainsKey(2))
{
e.PenguinQuestion = new MercatorPenguin.Question
{
Id = 2,
Text = "Vrije string voor note 1 ?",
Type = MercatorPenguin.Question.QuestionTypeEnum.String,
AskStringDefaultText = billingEngine.PiedsVRecord.NOTE1,
AbortIfCancel = true
};
return;
}
else
{
billingEngine.PiedsVRecord.NOTE1 = billingEngine.PenguinBeforeSaveAnswers[2].ToString();
}
}
}
}
}