コード例 #1
0
        private void enregistrer_config_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(comboBox_import_achats_cmd_active.Text) || !string.IsNullOrEmpty(comboBox_import_achats_dsadv_active.Text) || !string.IsNullOrEmpty(comboBox_import_achats_facture_active.Text) ||
                !string.IsNullOrEmpty(comboBox_import_ventes_cmd_active.Text) || !string.IsNullOrEmpty(comboBox_import_ventes_dsadv_active.Text) || !string.IsNullOrEmpty(comboBox_import_ventes_facture_active.Text) ||
                !string.IsNullOrEmpty(comboBox_import_ventes_cmd_active.Text))
            {
                Config_Import.ConfigurationSaveLoad       settings            = new Config_Import.ConfigurationSaveLoad();
                Config_Import.Classes.ConfigurationImport configurationExport = new Config_Import.Classes.ConfigurationImport(
                    new Config_Import.Classes.Custom_Doc.Doc_Achat(
                        new Config_Import.Classes.Custom_Doc.Custom.Commande(((comboBox_import_achats_cmd_active.Text == "Activer") ? "true" : "false"), comboBox_import_achats_cmd_format.Text, getStatutValue(comboBox_import_achats_cmd_statut.Text)),
                        new Config_Import.Classes.Custom_Doc.Custom.DSADV(((comboBox_import_achats_dsadv_active.Text == "Activer") ? "true" : "false"), comboBox_import_achats_dsadv_format.Text, getStatutValue(comboBox_import_achats_dsadv_statut.Text)),
                        new Config_Import.Classes.Custom_Doc.Custom.Facture(((comboBox_import_achats_facture_active.Text == "Activer") ? "true" : "false"), comboBox_import_achats_facture_format.Text, getStatutValue(comboBox_import_achats_facture_statut.Text))
                        ),
                    new Config_Import.Classes.Custom_Doc.Doc_Stock(
                        new Config_Import.Classes.Custom_Doc.Custom.Stock(((comboBox_import_stock_active.Text == "Activer") ? "true" : "false"), comboBox_import_stock_format.Text, getStatutValue(comboBox_import_stock_statut.Text))
                        ),
                    new Config_Import.Classes.Custom_Doc.Doc_Ventes(
                        new Config_Import.Classes.Custom_Doc.Custom.Commande(((comboBox_import_ventes_cmd_active.Text == "Activer") ? "true" : "false"), comboBox_import_ventes_cmd_format.Text, getStatutValue(comboBox_import_ventes_cmd_statut.Text)),
                        new Config_Import.Classes.Custom_Doc.Custom.DSADV(((comboBox_import_ventes_dsadv_active.Text == "Activer") ? "true" : "false"), comboBox_import_ventes_dsadv_format.Text, getStatutValue(comboBox_import_ventes_dsadv_statut.Text)),
                        new Config_Import.Classes.Custom_Doc.Custom.Facture(((comboBox_import_ventes_facture_active.Text == "Activer") ? "true" :" false"), comboBox_import_ventes_facture_format.Text, getStatutValue(comboBox_import_ventes_facture_statut.Text))
                        )
                    );

                settings.configurationImport = configurationExport;
                settings.saveInfo();

                Close();
            }
            else
            {
                ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                /// Document Achats
                ///

                // Commande
                if (!string.IsNullOrEmpty(comboBox_import_achats_cmd_active.Text))
                {
                    MessageBox.Show("La saisi import Commande Fournisseur est obligatoire !!");
                }
                if (comboBox_import_achats_cmd_active.Text.Equals("Activer") && !string.IsNullOrEmpty(comboBox_import_achats_cmd_format.Text))
                {
                    MessageBox.Show("Le Format d'Export Commande est obligatoire !!");
                }
                if (comboBox_import_achats_cmd_active.Text.Equals("Activer") && !string.IsNullOrEmpty(comboBox_import_achats_cmd_statut.Text))
                {
                    MessageBox.Show("Le Statut d'Export Commande est obligatoire !!");
                }

                // DSADV
                if (!string.IsNullOrEmpty(comboBox_import_achats_dsadv_active.Text))
                {
                    MessageBox.Show("Export Bon de Livraision est obligatoire !!");
                }
                if (comboBox_import_achats_dsadv_active.Text.Equals("Activer") && !string.IsNullOrEmpty(comboBox_import_achats_dsadv_format.Text))
                {
                    MessageBox.Show("Le Format d'Export Bon de Livraision est obligatoire !!");
                }
                if (comboBox_import_achats_dsadv_active.Text.Equals("Activer") && !string.IsNullOrEmpty(comboBox_import_achats_dsadv_statut.Text))
                {
                    MessageBox.Show("Le Statut d'Export Bon de Livraision est obligatoire !!");
                }

                // Facture
                if (!string.IsNullOrEmpty(comboBox_import_achats_facture_active.Text))
                {
                    MessageBox.Show("D'Export Facture est obligatoire !!");
                }
                if (comboBox_import_achats_facture_active.Text.Equals("Activer") && !string.IsNullOrEmpty(comboBox_import_achats_facture_format.Text))
                {
                    MessageBox.Show("Le Format d'Export Facture est obligatoire !!");
                }
                if (comboBox_import_achats_facture_active.Text.Equals("Activer") && !string.IsNullOrEmpty(comboBox_import_achats_facture_statut.Text))
                {
                    MessageBox.Show("Le Statut d'Export Facture est obligatoire !!");
                }


                ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                /// Document Ventes
                ///

                // Commande
                if (!string.IsNullOrEmpty(comboBox_import_ventes_cmd_active.Text))
                {
                    MessageBox.Show("Export Commande est obligatoire !!");
                }
                if (comboBox_import_ventes_cmd_active.Text.Equals("Activer") && !string.IsNullOrEmpty(comboBox_import_ventes_cmd_format.Text))
                {
                    MessageBox.Show("Le Format d'Export Commande est obligatoire !!");
                }
                if (comboBox_import_ventes_cmd_active.Text.Equals("Activer") && !string.IsNullOrEmpty(comboBox_import_ventes_cmd_statut.Text))
                {
                    MessageBox.Show("Le Statut d'Export Commande est obligatoire !!");
                }

                // DSADV
                if (!string.IsNullOrEmpty(comboBox_import_ventes_dsadv_active.Text))
                {
                    MessageBox.Show("Export Bon de Livraision est obligatoire !!");
                }
                if (comboBox_import_ventes_dsadv_active.Text.Equals("Activer") && !string.IsNullOrEmpty(comboBox_import_ventes_dsadv_format.Text))
                {
                    MessageBox.Show("Le Format d'Export Bon de Livraision est obligatoire !!");
                }
                if (comboBox_import_ventes_dsadv_active.Text.Equals("Activer") && !string.IsNullOrEmpty(comboBox_import_ventes_dsadv_statut.Text))
                {
                    MessageBox.Show("Le Statut d'Export Bon de Livraision est obligatoire !!");
                }

                // Facture
                if (!string.IsNullOrEmpty(comboBox_import_ventes_facture_active.Text))
                {
                    MessageBox.Show("D'Export Facture est obligatoire !!");
                }
                if (comboBox_import_ventes_facture_active.Text.Equals("Activer") && !string.IsNullOrEmpty(comboBox_import_ventes_facture_format.Text))
                {
                    MessageBox.Show("Le Format d'Export Facture est obligatoire !!");
                }
                if (comboBox_import_ventes_facture_active.Text.Equals("Activer") && !string.IsNullOrEmpty(comboBox_import_ventes_facture_statut.Text))
                {
                    MessageBox.Show("Le Statut d'Export Facture est obligatoire !!");
                }

                ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                /// Stock
                ///
                if (!string.IsNullOrEmpty(comboBox_import_stock_active.Text))
                {
                    MessageBox.Show("D'Export Stock est obligatoire !!");
                }
                if (comboBox_import_stock_active.Text.Equals("Activer") && !string.IsNullOrEmpty(comboBox_import_stock_format.Text))
                {
                    MessageBox.Show("Le Format d'Export Stock est obligatoire !!");
                }
                if (comboBox_import_stock_active.Text.Equals("Activer") && !string.IsNullOrEmpty(comboBox_import_stock_statut.Text))
                {
                    MessageBox.Show("Le Statut d'Export Stock est obligatoire !!");
                }
            }
        }