Exemplo n.º 1
0
        //public List<Response> PeriodObject(List<FiscalCalendarPeriodIN22> dataPeriod)
        //{
        //    return ClsPeriodIn22.ExecutePeriod(dataPeriod, TypeEnvironment.Dev);
        //}

        //public List<Response> VendorLedgerJournalObject(List<LedgerJournalTransIN34> dataJnlVente)
        //{
        //    throw new NotImplementedException();
        //}

        #region CashDisc
        public List <ERPDynamics.Response> CashDisc(List <CashDiscERP> data)
        {
            log.Info(string.Format("WEB 1.0 Method Called: {0}", MethodBase.GetCurrentMethod().Name));
            return(LinkDynamics.CallDynamicsCashDisc(GetEnv(), CashDiscERP2CashDisc(data)));//envoyer vers AZURE
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            log.Info(string.Format("Method Called: {0}", MethodBase.GetCurrentMethod().Name));

            #region set ClientConfiguration
            ClientConfiguration clientConfiguration = null;
            try
            {
                clientConfiguration = new ClientConfiguration()
                {
                    UriString = GetEnvironmentConfig("UriString"),
                    ActiveDirectoryResource        = GetEnvironmentConfig("ActiveDirectoryResource"),
                    ActiveDirectoryTenant          = GetEnvironmentConfig("ActiveDirectoryTenant"),
                    ActiveDirectoryClientAppId     = GetEnvironmentConfig("ActiveDirectoryClientAppId"),
                    ActiveDirectoryClientAppSecret = GetEnvironmentConfig("ActiveDirectoryClientAppSecret"),
                    ActiveDirectoryTenantId        = GetEnvironmentConfig("ActiveDirectoryTenantId"),
                    D365SalesUri       = GetEnvironmentConfig("D365SalesUri"),
                    D365SalesClientId  = GetEnvironmentConfig("D365SalesClientId"),
                    D365SalesClientKey = GetEnvironmentConfig("D365SalesClientKey"),
                    ServiceGroup       = GetConfig("ServiceGroup"),
                    TLSVersion         = ""
                };
            }
            catch (Exception ex)
            {
                log.Error(string.Format("Error when 'new ClientConfiguration()' {0}, Inner exception: {1}", ex.Message, ex.InnerException));
                throw ex;
            }
            #endregion

            #region Set fake data and send it
            try
            {
                //CashDiscERP
                var listCashDisc = new List <CashDisc>
                {
                    new CashDisc
                    {
                        CashDiscCode        = "TEST O",
                        Description         = "test cash discount",
                        MainAccountCustomer = "403300",
                        MainAccountVendor   = "520200",
                        NumOfDays           = 5,
                        Percent             = 0.5M,
                        CompanyName         = "FRRT",
                        StatusQuery         = StatusQuery.Delete,
                        ERPOprNumber        = Guid.NewGuid()
                    },
                    new CashDisc
                    {
                        CashDiscCode        = "TEST X",
                        Description         = "test cash discount FRRT",
                        MainAccountCustomer = "665000",
                        MainAccountVendor   = "765000",
                        NumOfDays           = 5,
                        Percent             = 0.5M,
                        CompanyName         = "USMF",
                        StatusQuery         = StatusQuery.Delete,
                        ERPOprNumber        = Guid.NewGuid()
                    }
                };

                var listspCashDiscs = LinkDynamics.CallDynamicsCashDisc(clientConfiguration, listCashDisc);
                foreach (var element in listspCashDiscs)
                {
                    StringBuilder sb = new StringBuilder();
                    sb.AppendLine("listspCashDisc.Code : " + element.Code);
                    sb.AppendLine("listspCashDisc.Code : " + element.DynamicsOprNumber);
                    sb.AppendLine("listspCashDisc.Code : " + element.ERPOprNumber);
                    sb.AppendLine("listspCashDisc.Code : " + element.Message);
                    string message = sb.ToString();
                    Console.WriteLine(message);
                    log.Info(string.Format("Resultat loop on List<Response> {0}", message));
                }
            }
            catch (Exception ex)  //comment 1
            {
                log.Error(string.Format("Error {0}, Inner exception: {1}", ex.Message, ex.InnerException));
                throw ex;
            }

            try
            {
                //BusRelSegmentGroupERB
                var listBusRelSegmentGroup = new List <ERPDynamics.BusRelSegmentGroup>
                {
                    new BusRelSegmentGroup {
                        SegmentId = "BBSeg", Description = "desc BSeg09", StatusQuery = StatusQuery.Create, ERPOprNumber = Guid.NewGuid()
                    },
                    new BusRelSegmentGroup {
                        SegmentId = "BBSeg10", Description = "desc BSeg10", StatusQuery = StatusQuery.Create, ERPOprNumber = Guid.NewGuid()
                    },
                };

                var listspBusRelSegmentGroup = LinkDynamics.CallDynamicsBusRelSegmentGroup(clientConfiguration, listBusRelSegmentGroup);
                foreach (var element in listspBusRelSegmentGroup)
                {
                    StringBuilder sb = new StringBuilder();
                    sb.AppendLine("listspCashDisc.Code : " + element.Code);
                    sb.AppendLine("listspCashDisc.Code : " + element.DynamicsOprNumber);
                    sb.AppendLine("listspCashDisc.Code : " + element.ERPOprNumber);
                    sb.AppendLine("listspCashDisc.Code : " + element.Message);
                    string message = sb.ToString();
                    Console.WriteLine(message);
                    log.Info(string.Format("Resultat loop on List<Response>{0}", message));
                }
            }
            catch (Exception ex)
            {
                log.Error(string.Format("Error {0}, Inner exception: {1}", ex.Message, ex.InnerException));
                throw ex;
            }
            #endregion
        }