public void Sync(Model.Sage.F_COLLABORATEUR F_COLLABORATEUR) { this.Semaphore.WaitOne(); try { Model.Prestashop.PsAECRepresentativeRepository PsAECRepresentativeRepository = new Model.Prestashop.PsAECRepresentativeRepository(); Model.Prestashop.PsAEcRepresentative PsAECRepresentative; if (PsAECRepresentativeRepository.ExistSage((uint)F_COLLABORATEUR.CO_No)) { PsAECRepresentative = PsAECRepresentativeRepository.ReadSage((uint)F_COLLABORATEUR.CO_No); Affect(F_COLLABORATEUR, PsAECRepresentative); PsAECRepresentativeRepository.Save(); } else { PsAECRepresentative = new Model.Prestashop.PsAEcRepresentative(); PsAECRepresentative.IDSage = (uint)F_COLLABORATEUR.CO_No; Affect(F_COLLABORATEUR, PsAECRepresentative); PsAECRepresentativeRepository.Add(PsAECRepresentative); } } catch (Exception ex) { Core.Error.SendMailError(ex.ToString()); } lock (this) { this.CurrentCount += 1; } this.ReportProgress(this.CurrentCount * 100 / this.ListCount); this.Semaphore.Release(); }
private void Affect(Model.Sage.F_COLLABORATEUR F_COLLABORATEUR, Model.Prestashop.PsAEcRepresentative PsAECRepresentative) { PsAECRepresentative.LastName = F_COLLABORATEUR.CO_Nom; PsAECRepresentative.FirstName = F_COLLABORATEUR.CO_Prenom; PsAECRepresentative.Email = F_COLLABORATEUR.CO_EMail; PsAECRepresentative.Phone = F_COLLABORATEUR.CO_Telephone; PsAECRepresentative.Mobile = F_COLLABORATEUR.CO_TelPortable; PsAECRepresentative.Fax = F_COLLABORATEUR.CO_Telecopie; }