public void ImportCustomers() { IList <string> lLstStrLocalCardCodes = LocalBusinessPartnerService.GetList().Select(x => x.Code).ToList(); foreach (string lStrCardCode in SapBusinessPartnerService.GetCardCodesList().Where(x => !lLstStrLocalCardCodes.Contains(x))) { ImportCustomer(lStrCardCode); } }
private void UpdateCustomer(string pStrCardCode) { Partner lObjCurrentPartner = null; Partner lObjNewPartner = null; try { lObjCurrentPartner = LocalBusinessPartnerService.GetList().FirstOrDefault(x => x.Code == pStrCardCode); lObjNewPartner = GetBusinessPartnerByCode(pStrCardCode); lObjCurrentPartner.Name = lObjNewPartner.Name; lObjCurrentPartner.ForeignName = lObjNewPartner.ForeignName; lObjCurrentPartner.TaxCode = lObjNewPartner.TaxCode; lObjCurrentPartner.PartnerStatus = lObjNewPartner.PartnerStatus; lObjCurrentPartner.CreationDate = lObjNewPartner.CreationDate; lObjCurrentPartner.ModificationDate = lObjNewPartner.ModificationDate; LocalBusinessPartnerService.SaveOrUpdate(lObjCurrentPartner); } catch (Exception lObjException) { LogUtility.Write(string.Format("[ERROR] {0}", lObjException.ToString())); } }
private bool CustomerHasBeenImported(string pStrCardCode) { return(LocalBusinessPartnerService.GetList().Where(x => x.Code == pStrCardCode).Count() > 0 ? true : false); }
private bool CustomerHasChanges(CustomerDTO pObjCustomer) { return(LocalBusinessPartnerService.GetList().Where(x => x.Code == pObjCustomer.CardCode && x.ModificationDate != pObjCustomer.UpdateHour).Count() > 0 ? true : false); }
private DateTime GetLastModificationDate() { return(LocalBusinessPartnerService.GetList().Where(b => !b.Temporary).Count() > 0 ? LocalBusinessPartnerService.GetList().Where(b => !b.Temporary).Max(x => x.CreationDate) : DateTime.Today.AddYears(-10)); }