Пример #1
0
        private void ButtonSubmit_Click(object sender, RoutedEventArgs e)
        {
            if (this.ListBoxFournisseur.SelectedItem != null)
            {
                Model.Local.SupplierRepository SupplierRepository = new Model.Local.SupplierRepository();
                if (SupplierRepository.ExistSag_Id(((Model.Sage.F_COMPTET) this.ListBoxFournisseur.SelectedItem).cbMarq))
                {
                    Model.Local.Supplier Supplier = SupplierRepository.ReadSag_Id(((Model.Sage.F_COMPTET) this.ListBoxFournisseur.SelectedItem).cbMarq);

                    Supplier.Sup_Name            = Core.Global.RemovePurge(this.TextBoxName.Text, 128);
                    Supplier.Sup_Description     = Core.Global.RemovePurge(this.TextBoxDescription.Text, 10000);
                    Supplier.Sup_MetaTitle       = Core.Global.RemovePurge(this.TextBoxTitle.Text, 70);
                    Supplier.Sup_MetaDescription = Core.Global.RemovePurge(this.TextBoxDescription.Text, 160);
                    Supplier.Sup_MetaKeyword     = Core.Global.RemovePurgeMeta(this.TextBoxMetaKeyword.Text, 255);
                    Supplier.Sup_Active          = this.CheckBoxActive.IsChecked.Value;
                    Supplier.Sup_Sync            = this.RadioButtonSync.IsChecked.Value;
                    Supplier.Sup_Date            = DateTime.Now;

                    SupplierRepository.Save();
                    MessageBox.Show("Fournisseur mis à jour avec succès", "Fournisseur", MessageBoxButton.OK);
                }
                else
                {
                    MessageBox.Show("Fournisseur non valide !", "Fournisseur", MessageBoxButton.OK);
                }
            }
        }
Пример #2
0
        private void ListBoxFournisseur_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (this.ListBoxFournisseur.SelectedItem != null)
            {
                if (this.ListBoxFournisseur.SelectedItem is Model.Sage.F_COMPTET)
                {
                    this.isValid = false;
                    Model.Local.SupplierRepository SupplierRepository = new Model.Local.SupplierRepository();
                    Model.Local.Supplier           Supplier           = new Model.Local.Supplier();
                    if (SupplierRepository.ExistSag_Id(((Model.Sage.F_COMPTET) this.ListBoxFournisseur.SelectedItem).cbMarq))
                    {
                        this.groupBoxSupplierDetail.IsEnabled = true;
                        Supplier = SupplierRepository.ReadSag_Id(((Model.Sage.F_COMPTET) this.ListBoxFournisseur.SelectedItem).cbMarq);
                        this.TextBoxName.Text            = Supplier.Sup_Name;
                        this.TextBoxDescription.Text     = Supplier.Sup_Description;
                        this.TextBoxTitle.Text           = Supplier.Sup_MetaTitle;
                        this.TextBoxMetaKeyword.Text     = Supplier.Sup_MetaKeyword;
                        this.TextBoxMetaDescription.Text = Supplier.Sup_MetaDescription;
                        this.CheckBoxActive.IsChecked    = Supplier.Sup_Active;
                        this.RadioButtonSync.IsChecked   = Supplier.Sup_Sync;

                        if (Supplier.Pre_Id != null)
                        {
                            Model.Prestashop.PsSupplierRepository PsSupplierRepository = new Model.Prestashop.PsSupplierRepository();
                            if (PsSupplierRepository.ExistId(Convert.ToInt32(Supplier.Pre_Id)) == false)
                            {
                                MessageBoxResult Result = MessageBox.Show("Le fournisseur Prestashop n'existe plus. Voulez-vous le recréer ?", "Fournisseur", MessageBoxButton.YesNo);
                                if (Result == MessageBoxResult.Yes)
                                {
                                    Supplier.Pre_Id = null;
                                    SupplierRepository.Save();
                                }
                            }
                        }
                    }
                    else
                    {
                        this.LoadComponent();
                        this.groupBoxSupplierDetail.IsEnabled = false;
                    }
                }
                else
                {
                    this.LoadComponent();
                    this.groupBoxSupplierDetail.IsEnabled = false;
                }
            }
            else
            {
                this.LoadComponent();
                this.groupBoxSupplierDetail.IsEnabled = false;
            }
        }
Пример #3
0
        public SynchronisationFournisseur()
        {
            this.InitializeComponent();
            Model.Local.SupplierRepository LocalSupplierRepository = new Model.Local.SupplierRepository();
            List <Int32> ListSupplier = LocalSupplierRepository.ListIdSync(true);

            this.ListCount = ListSupplier.Count;
            Context        = SynchronizationContext.Current;
            this.ParallelOptions.MaxDegreeOfParallelism = MaximumThreadCount;
            this.ReportProgress(0);
            Task.Factory.StartNew(() =>
            {
                Parallel.ForEach(ListSupplier, this.ParallelOptions, Sync);
            });
        }
Пример #4
0
        private void CreateSupplier(Model.Sage.F_COMPTET F_COMPTET)
        {
            if (F_COMPTET != null && !string.IsNullOrWhiteSpace(F_COMPTET.CT_Intitule))
            {
                Model.Local.SupplierRepository SupplierRepository = new Model.Local.SupplierRepository();
                if (!SupplierRepository.ExistSag_Id(F_COMPTET.cbMarq))
                {
                    Model.Local.Supplier Supplier = new Model.Local.Supplier();
                    //Supplier = SupplierRepository.ReadSag_Id(F_COMPTET.cbMarq);
                    Supplier.Sag_Id              = F_COMPTET.cbMarq;
                    Supplier.Sup_Name            = Core.Global.RemovePurge(F_COMPTET.CT_Intitule, 128);
                    Supplier.Sup_Description     = Supplier.Sup_Name;
                    Supplier.Sup_MetaTitle       = Core.Global.RemovePurge(Supplier.Sup_Name, 70);
                    Supplier.Sup_MetaDescription = Core.Global.RemovePurge(Supplier.Sup_Name, 160);
                    Supplier.Sup_MetaKeyword     = Core.Global.RemovePurgeMeta(Supplier.Sup_Name, 255);
                    Supplier.Sup_Active          = true;
                    Supplier.Sup_Date            = DateTime.Now;
                    Supplier.Sup_Sync            = true;

                    SupplierRepository.Add(Supplier);
                }
            }
        }