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.BeforeSave += BookingEngine_BeforeSave;
}
public void BookingEngineClosed(MercatorUi.Engine.Cpta.BookingEngine BookingEngine)
{
BookingEngine.BeforeSave -= BookingEngine_BeforeSave;
}
void BookingEngine_BeforeSave(object sender, MercatorUi.Engine.Cpta.BookingEngine.BeforeSaveEventArgs e)
{
MercatorUi.Engine.Cpta.BookingEngine bookingEngine = (MercatorUi.Engine.Cpta.BookingEngine)sender;
if ((bookingEngine.Type == 1) && (bookingEngine.CliRecord != null))
bookingEngine.PiedsCRecord.ECHEANCE = Api.AddDate(bookingEngine.PiedsCRecord.DATE, bookingEngine.CliRecord.C_PAIEM);
else if ((bookingEngine.Type == 2) && (bookingEngine.FouRecord != null))
bookingEngine.PiedsCRecord.ECHEANCE = Api.AddDate(bookingEngine.PiedsCRecord.DATE, bookingEngine.FouRecord.F_PAIEM);
}
}
}