private void btImport_Click(object sender, EventArgs e)
        {
            var model = new Model.F6002(new F6002());
            var z     = new ImportForms.F6002ImportForm(model);

            if (z.ShowDialog(this) == DialogResult.OK)
            {
                var f6002 = this.f6002BindingSource.Current as Model.F6002;
                if (f6002 == null)
                {
                    return;
                }
                foreach (var currentF6002Ligne in model.Lignes)
                {
                    if (currentF6002Ligne != null && !currentF6002Ligne.Calculable)
                    {
                        var l = f6002.Lignes.Single(x => x.CodeN == currentF6002Ligne.CodeN);
                        l.ValeurN = currentF6002Ligne.ValeurN;

                        l          = f6002.Lignes.Single(x => x.CodeN1 == currentF6002Ligne.CodeN1);
                        l.ValeurN1 = currentF6002Ligne.ValeurN1;
                    }
                }
                this.f6002BindingSource.ResetCurrentItem();
            }
        }
        public XtraFrmF6002(LiasseController controller)
        {
            _controller = controller;
            InitializeComponent();
            gridView1.CustomRowCellEdit += GridView1OnCustomRowCellEdit;
            _CurrentF6002 = controller.CurrentF6002();
            DBf6002BindingSource.DataSource = _CurrentF6002;
            var Model = new Model.F6002(_CurrentF6002);

            this.f6002BindingSource.DataSource = new Model.F6002(_CurrentF6002);
            btEnregistrer.Click += BtEnregistrer_Click;
            btExporter.Click    += BtExporter_Click;
            //this.gridView1.OptionsView.RowAutoHeight = true;
            //colLibelle.AppearanceCell.TextOptions.WordWrap=WordWrap.Wrap;
            saveFileDialog1.FileName = controller.GetXmlFileName(this.DBf6002BindingSource.Current);
        }
        public F6002ImportForm(Model.F6002 currentF6002)
        {
            InitializeComponent();
            CurrentF6002 = currentF6002;

            _fileName = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), Application.ProductName, $"ModelImport_{CurrentF6002.GetType().Name}.xml");
            this.f6002BindingSource.DataSource = CurrentF6002;
            if (File.Exists(_fileName))
            {
                try
                {
                    this.excelDataSource1.LoadFromXml(XElement.Load(_fileName));
                    excelDataSource1.Fill();
                    var col1 = "Code Rubrique (Net)";
                    var col2 = "Code Rubrique (N-1)";
                    //var col1 = "Code Rubrique (Net)";
                    var col3 = "Net";
                    //var col1 = "Libelle";
                    // var col4 = "Brut";
                    // var col5 = "Prov / Amort";
                    var col4 = "Net N-1";
                    //
                    this.CodeRubNetcomboBoxEdit.Properties.Items.Clear();
                    this.CodeRubNetcomboBoxEdit.Properties.Items.AddRange(excelDataSource1.Schema
                                                                          .Where(x => x.Type == typeof(string) && x.Selected).Select(x => x.Name).ToList());
                    this.CodeRubNetcomboBoxEdit.EditValue = excelDataSource1.Schema
                                                            .Where(x => x.Type == typeof(string) && x.Selected).Select(x => x.Name)
                                                            .FirstOrDefault(x => x.Trim() == col1);

                    //
                    this.CodeRubN_1comboBoxEdit.Properties.Items.Clear();
                    this.CodeRubN_1comboBoxEdit.Properties.Items.AddRange(excelDataSource1.Schema
                                                                          .Where(x => x.Type == typeof(string) && x.Selected).Select(x => x.Name).ToList());
                    this.CodeRubN_1comboBoxEdit.EditValue = excelDataSource1.Schema
                                                            .Where(x => x.Type == typeof(string) && x.Selected).Select(x => x.Name)
                                                            .FirstOrDefault(x => x.Trim() == col2);

                    //

                    this.ValNetcomboBoxEdit.Properties.Items.Clear();
                    this.ValNetcomboBoxEdit.Properties.Items.AddRange(excelDataSource1.Schema
                                                                      .Where(x => Core.Helpers.Helper.IsNumericType(x.Type) && x.Selected).Select(x => x.Name)
                                                                      .ToList());
                    this.ValNetcomboBoxEdit.EditValue = excelDataSource1.Schema
                                                        .Where(x => Core.Helpers.Helper.IsNumericType(x.Type) && x.Selected).Select(x => x.Name)
                                                        .FirstOrDefault(x => x.Trim() == col3);

                    //
                    this.ValN_1comboBoxEdit.Properties.Items.Clear();
                    this.ValN_1comboBoxEdit.Properties.Items.AddRange(excelDataSource1.Schema
                                                                      .Where(x => Core.Helpers.Helper.IsNumericType(x.Type) && x.Selected).Select(x => x.Name)
                                                                      .ToList());
                    this.ValN_1comboBoxEdit.EditValue = excelDataSource1.Schema
                                                        .Where(x => Core.Helpers.Helper.IsNumericType(x.Type) && x.Selected).Select(x => x.Name)
                                                        .FirstOrDefault(x => x.Trim() == col4);
                }
                catch
                {
                    // ignored
                }
            }
            this.buttonEdit1.EditValue     = excelDataSource1.FileName;
            layoutControlGroup3.Visibility = LayoutVisibility.Never;
        }