/// <summary>
        /// Charge les analyses et les workcenter au démarrage de la fenêtre
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void FrmDeleteAnalyse_Load(object sender, EventArgs e)
        {
            FrmWait.ShowWatingForms("Chargement des analyses en cours.");

            AnalysisResults = GetAnalysis();

            SetObjectListView(AnalysisResults);

            SetComboBoxWk(AnalysisResults);

            FrmWait.CloseForm();
        }
        /// <summary>
        /// Delete Analysis
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (SelectedAnalysis != null)
            {
                if (MessageBox.Show("Voulez-vous supprimer l'analyse ?", "Supprimer une analyse", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    FrmWait.ShowWatingForms("Suppression de l'analyse en cours.");

                    List <ADR_Analysis_Parameters> Parameters;

                    using (AnalysisParametersRepository AnalysisParametersRepository = new AnalysisParametersRepository())
                    {
                        Parameters = AnalysisParametersRepository.GetByAnalysis(SelectedAnalysis.Id).ToList();
                    }

                    foreach (ADR_Analysis_Parameters parameter in Parameters)
                    {
                        using (AnalysisParametersRepository AnalysisParametersRepository = new AnalysisParametersRepository())
                        {
                            AnalysisParametersRepository.Delete(parameter);
                        }
                    }

                    using (AnalysisResultRepositoty AnalysisResultRepositoty = new AnalysisResultRepositoty())
                    {
                        AnalysisResultRepositoty.Delete(SelectedAnalysis);
                    }

                    using (SAPOrdersRepository SAPOrdersRepository = new SAPOrdersRepository())
                    {
                        ADR_SAPOrders SAPOrder = SAPOrdersRepository.GetByOrderNbs(SelectedAnalysis.OrderNbs);
                        SAPOrder.AnalysisNbs = null;
                        SAPOrdersRepository.Update(SAPOrder);
                    }



                    GenerateHistorique.CreateHistorique(FormUser.UserID, "Deleted", $"Suppression d'une analyse {SelectedAnalysis.AnalysisNbs}");

                    btnDelete.Enabled = false;
                    SelectedAnalysis  = null;

                    FrmWait.CloseForm();

                    FrmDeleteAnalyse_Load(null, null);
                }
            }
        }
        /// <summary>
        /// Recherche les analyses avec un numéro d'ordre
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSerarch_Click(object sender, EventArgs e)
        {
            FrmWait.ShowWatingForms("Chargement des analyses en cours.");

            if (string.IsNullOrEmpty(txtOrderNumber.Text) && string.IsNullOrEmpty(cbWorkCenter.SelectedValue.ToString()))
            {
                AnalysisResults = GetAnalysis();
            }
            else
            {
                AnalysisResults = GetAnalysis(txtOrderNumber.Text, cbWorkCenter.SelectedValue.ToString());
            }

            SetObjectListView(AnalysisResults);

            FrmWait.CloseForm();
        }