Exemple #1
0
        private void ExportBusinessPartner(Partner pObjPartner)
        {
            SAPbobsCOM.BusinessPartners lObjCustomer = null;

            try
            {
                lObjCustomer              = SapBusinessPartnerService.GetBusinessPartnerObject();
                lObjCustomer.CardCode     = pObjPartner.Code;
                lObjCustomer.CardName     = pObjPartner.Name;
                lObjCustomer.FederalTaxID = pObjPartner.TaxCode;

                if (lObjCustomer.Add() == 0)
                {
                    pObjPartner.Temporary = false;
                    LocalBusinessPartnerService.SaveOrUpdate(pObjPartner);
                }
                else
                {
                    LogUtility.Write(string.Format("[ERROR] {0}", DIApplication.Company.GetLastErrorDescription()));
                }
            }
            catch (Exception lObjException)
            {
                LogUtility.Write(string.Format("[ERROR] {0}", lObjException.ToString()));
            }
            finally
            {
                MemoryUtility.ReleaseComObject(lObjCustomer);
            }
        }
Exemple #2
0
 private void ImportCustomer(string pStrCardCode)
 {
     try
     {
         LocalBusinessPartnerService.SaveOrUpdate(GetBusinessPartnerByCode(pStrCardCode));
     }
     catch (Exception lObjException)
     {
         LogUtility.Write(string.Format("[ERROR] {0}", lObjException.ToString()));
     }
 }
Exemple #3
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()));
            }
        }