using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using MercatorApi;
using MercatorUi;
using System.Windows.Forms;

namespace Gescom
{
    public class Customizer : MercatorUi.ICustomizers.IFormLoadCustomizer
    {

        public void FormLoadCustomize(Form WindowsForm)
        {
            if (WindowsForm is MercatorUi.Forms.Gescom.GescomAllowancesForm)
            {
                MercatorUi.Forms.Gescom.GescomAllowancesForm gescomAllowancesForm = (MercatorUi.Forms.Gescom.GescomAllowancesForm)WindowsForm;
                if ((gescomAllowancesForm.TabControl != null) // TabControl est null si on est en gestion simplifiée
                && (gescomAllowancesForm.TypeVA == MercatorUi.Engine.Gescom.Billing.TypeVAEnum.V)) // uniquement pour les remises clients
                {
                    MercatorUi._BaseClasses.MercatorLabelX labelInfo = new MercatorUi._BaseClasses.MercatorLabelX();
                    labelInfo.BackgroundStyle.Class = "";
                    labelInfo.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
                    labelInfo.Location = new System.Drawing.Point(9, 130);
                    labelInfo.Size = new System.Drawing.Size(80, 23);
                    labelInfo.TabIndex = 8;
                    labelInfo.Text = "Info :";
                    labelInfo.TextAlignment = System.Drawing.StringAlignment.Far;

                    MercatorUi._BaseClasses.BindableTextBox bindableTextBoxInfo = new MercatorUi._BaseClasses.BindableTextBox();
                    bindableTextBoxInfo.Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right);
                    bindableTextBoxInfo.Border.Class = "TextBoxBorder";
                    bindableTextBoxInfo.Border.CornerType = DevComponents.DotNetBar.eCornerType.Square;
                    bindableTextBoxInfo.Location = new System.Drawing.Point(109, 132);
                    bindableTextBoxInfo.Size = new System.Drawing.Size(398, 20);
                    bindableTextBoxInfo.Source = "info"; // nom de la colonne ajoutée dans la table BAREMESV_PIEDS
                    bindableTextBoxInfo.TabIndex = 9;
                    bindableTextBoxInfo.MaxLength = 50;

                    gescomAllowancesForm.TabControl.TabPages[0].Controls.AddRange(new Control[2] { labelInfo, bindableTextBoxInfo });
                }
            }
        }
    }
}