Beispiel #1
0
        private void DeleteJournal(ProductionPostedClient selectedItem)
        {
            if (selectedItem == null)
            {
                return;
            }
            var deleteDialog = new DeletePostedJournal();

            deleteDialog.Closed += async delegate
            {
                if (deleteDialog.DialogResult == true)
                {
                    var        pApi = new ProductionAPI(api);
                    ErrorCodes res  = await pApi.DeletePostedProduction(selectedItem, deleteDialog.Comment);

                    if (res == ErrorCodes.Succes)
                    {
                        UnicontaMessageBox.Show(string.Format(Uniconta.ClientTools.Localization.lookup("Journaldeleted"), selectedItem._LineNumber), Uniconta.ClientTools.Localization.lookup("Message"));
                        dgProductionPostedGrid.UpdateItemSource(3, selectedItem);
                    }
                    else
                    {
                        UtilDisplay.ShowErrorCode(res);
                    }
                }
            };
            deleteDialog.Show();
        }
Beispiel #2
0
        void CreateOrderLines(ProductionOrderClient productionOrder)
        {
            CWProductionOrderLine dialog = new CWProductionOrderLine(api);

            dialog.Closing += async delegate
            {
                if (dialog.DialogResult == true)
                {
                    var prodAPI = new ProductionAPI(api);
                    var result  = await prodAPI.CreateProductionLines(productionOrder, (StorageRegister)dialog.storage);

                    UtilDisplay.ShowErrorCode(result);
                    //else
                    //    CreditorOrders.ShowOrderLines(4, productionOrder, this, dgProductionOrders);
                }
            };
            dialog.Show();
        }
        void CreateOrderLines(ProductionOrderClient productionOrder)
        {
            CWProductionOrderLine dialog = new CWProductionOrderLine(productionOrder, api, false, null);

#if !SILVERLIGHT
            dialog.DialogTableId = 2000000078;
#endif
            dialog.Closing += async delegate
            {
                if (dialog.DialogResult == true)
                {
                    var prodAPI = new ProductionAPI(api);
                    var result  = await prodAPI.CreateProductionLines(productionOrder, (StorageRegister)dialog.Storage, dialog.Force, dialog.ProductionTime);

                    UtilDisplay.ShowErrorCode(result);
                    //else
                    //    CreditorOrders.ShowOrderLines(4, productionOrder, this, dgProductionOrders);
                }
            };
            dialog.Show();
        }
Beispiel #4
0
        private void CreateProdcution(ProductionPostedClient fromProductionPosted)
        {
            var prodOrder = new ProductionOrderClient()
            {
                _ProdItem = fromProductionPosted._Item, _ProdQty = fromProductionPosted._Qty
            };
            var cwProductionOrderLine = new CWProductionOrderLine(prodOrder, api, true, Uniconta.ClientTools.Localization.lookup("ProductionOrder"));

#if !SILVERLIGHT
            cwProductionOrderLine.DialogTableId = 2000000079;
#endif
            cwProductionOrderLine.Closed += async delegate
            {
                if (cwProductionOrderLine.DialogResult == true)
                {
                    prodOrder._DeliveryDate = cwProductionOrderLine.DeliveryDate;
                    var prodApi = new ProductionAPI(api);
                    var result  = await prodApi.CreateProductionFromProduction(fromProductionPosted, prodOrder, cwProductionOrderLine.quantity, (StorageRegister)cwProductionOrderLine.Storage);

                    if (result != ErrorCodes.Succes)
                    {
                        Uniconta.ClientTools.Util.UtilDisplay.ShowErrorCode(result);
                    }
                    else
                    {
#if !SILVERLIGHT
                        if (UnicontaMessageBox.Show(string.Format(Uniconta.ClientTools.Localization.lookup("GoTo"), Uniconta.ClientTools.Localization.lookup("ProductionLines")),
                                                    Uniconta.ClientTools.Localization.lookup("Message"), MessageBoxButton.YesNo) == MessageBoxResult.Yes)
#elif SILVERLIGHT
                        if (UnicontaMessageBox.Show(string.Format(Uniconta.ClientTools.Localization.lookup("GoTo"), Uniconta.ClientTools.Localization.lookup("ProductionLines")),
                                                    Uniconta.ClientTools.Localization.lookup("Message"), MessageBoxButton.OKCancel) == MessageBoxResult.OK)
#endif
                        { AddDockItem(TabControls.ProductionOrderLines, prodOrder); }
                    }
                }
            };
            cwProductionOrderLine.Show();
        }
        async void UpdateLines(ProductionOrderClient productionOrder, StorageRegister Storage, bool OverwriteLines, bool goToLines, int prodTime = 0)
        {
            var prodAPI = new ProductionAPI(api);
            var result  = await prodAPI.CreateProductionLines(productionOrder, Storage, OverwriteLines, prodTime);

            if (result == ErrorCodes.Succes)
            {
                prodQty = productionOrder._ProdQty;
                if (goToLines)
                {
                    GoToLines(productionOrder);
                }
            }
            else
            {
                if (productionOrder.RowId != 0)
                {
                    productionOrder.ProdQty = prodQty;
                    api.UpdateNoResponse(productionOrder);
                }
                UtilDisplay.ShowErrorCode(result);
            }
        }