Esempio n. 1
0
        public void ProcessPendingOrders()
        {
            ProgressBarManager oProgressBar = null;
            var timer = Stopwatch.StartNew();

            try {
                if (pendingOrders != null && pendingOrders.Length > 0)
                {
                    SAPbouiCOM.Framework.Application.SBO_Application.StatusBar.SetText("Procesando Ordenes de Venta", SAPbouiCOM.BoMessageTime.bmt_Medium, SAPbouiCOM.BoStatusBarMessageType.smt_Warning);
                    oProgressBar = new ProgressBarManager(UIApplication.GetApplication(), "Processing Sales Orders, please wait...", pendingOrders.Length);
                    foreach (var request in pendingOrders)
                    {
                        var result = new PermissionRequestService().CreateSaleOrder(request.ID);
                        LogService.WriteInfo(String.Format("Orden {3}-{0}-{1}: Resultado: {2}", request.ID, request.Type, result, request.Folio));
                        oProgressBar.NextPosition();
                    }

                    UIApplication.ShowMessageBox(String.Format("Se procesaron un total de {0} ordenes de venta \n Tiempo Transcurrido {1}", pendingOrders.Length, timer.Elapsed));
                }
                else
                {
                    UIApplication.ShowMessageBox("No hay ordenes de venta pendientes o las ordenes aun no se han terminado cargar");
                }
            }
            catch (Exception ex) {
                PendingSalesOrdersDAO.HandleException(ex, "ProcessPendingOrders");
            }
            finally {
                oProgressBar.Stop();
                btnProcess.Item.Enabled = false;
            }
        }
Esempio n. 2
0
        private void btnProcess_ClickBefore(object sboObject, SBOItemEventArg pVal, out bool BubbleEvent)
        {
            BubbleEvent = true;

            if (btnProcess.Item.Enabled)
            {
                try {
                    this.ProcessPendingOrders();
                    //this.ParallelProcessPendingOrders();
                }
                catch (AggregateException ae) {
                    ae.Handle(ex => {
                        PendingSalesOrdersDAO.HandleException(ex, "btnProcess_ClickBefore");
                        return(true);
                    });
                }
            }
        }