Exemplo n.º 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);
            }
        }
Exemplo n.º 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()));
            }
        }
Exemplo n.º 3
0
 private bool CustomerHasBeenImported(string pStrCardCode)
 {
     return(LocalBusinessPartnerService.GetList().Where(x => x.Code == pStrCardCode).Count() > 0 ? true : false);
 }
Exemplo n.º 4
0
 private bool CustomerHasChanges(CustomerDTO pObjCustomer)
 {
     return(LocalBusinessPartnerService.GetList().Where(x => x.Code == pObjCustomer.CardCode && x.ModificationDate != pObjCustomer.UpdateHour).Count() > 0 ? true : false);
 }
Exemplo n.º 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));
 }