Пример #1
0
        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);
            }
        }
Пример #2
0
        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()));
            }
        }
Пример #3
0
 private bool CustomerHasBeenImported(string pStrCardCode)
 {
     return(LocalBusinessPartnerService.GetList().Where(x => x.Code == pStrCardCode).Count() > 0 ? true : false);
 }
Пример #4
0
 private bool CustomerHasChanges(CustomerDTO pObjCustomer)
 {
     return(LocalBusinessPartnerService.GetList().Where(x => x.Code == pObjCustomer.CardCode && x.ModificationDate != pObjCustomer.UpdateHour).Count() > 0 ? true : false);
 }
Пример #5
0
 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));
 }