using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Windows.Forms;
using MercatorApi;
using MercatorUi;
namespace Booking
{
public class Customizer : MercatorUi.ICustomizers.IBookingEngineCreated, MercatorUi.ICustomizers.IBookingEngineClosed
{
public void BookingEngineCreated(MercatorUi.Engine.Cpta.BookingEngine BookingEngine)
{
BookingEngine.BeforeApplyCustomerSupplier += new MercatorUi.Engine.Cpta.BookingEngine.BeforeApplyCustomerSupplierEventHandler(BookingEngine_BeforeApplyCustomerSupplier);
}
public void BookingEngineClosed(MercatorUi.Engine.Cpta.BookingEngine BookingEngine)
{
BookingEngine.BeforeApplyCustomerSupplier -= new MercatorUi.Engine.Cpta.BookingEngine.BeforeApplyCustomerSupplierEventHandler(BookingEngine_BeforeApplyCustomerSupplier);
}
void BookingEngine_BeforeApplyCustomerSupplier(object sender, MercatorUi.Engine.Cpta.BookingEngine.BeforeApplyCustomerSupplierEventArgs e)
{
MercatorUi.Engine.Cpta.BookingEngine bookingEngine = (MercatorUi.Engine.Cpta.BookingEngine)sender;
string ville = MercatorController.xFunctions.xLookUpString("CLI", "C_ID", e.IdCliOrFou, "C_VILLE").TrimEnd();
if (Dialogs.AnswerYesNo(string.Format("Klant \"{0}\" woonachtig in {1} aanvaarden?", e.IdCliOrFou, ville)))
bookingEngine.PiedsCRecord.REFERENCE = ville;
else
e.CancelApplyCustomerSupplier = true; // Deze flag laat Mercator weten dat men de selectie van deze klant weigert.
}
}
}