void localMenu_OnItemClicked(string ActionType)
        {
            var selectedItem = dgCrdInvLines.SelectedItem as InvTransClient;

            switch (ActionType)
            {
            case "ChangeVariant":
                if (selectedItem == null)
                {
                    return;
                }
                var cwChangeVaraints = new CWModifyVariants(api, selectedItem);
                cwChangeVaraints.Closing += delegate
                {
                    if (cwChangeVaraints.DialogResult == true)
                    {
                        gridRibbon_BaseActions("RefreshGrid");
                    }
                };
                cwChangeVaraints.Show();
                break;

            case "ChangeStorage":
                if (selectedItem == null)
                {
                    return;
                }
                var cwchangeStorage = new CWModiyStorage(api, selectedItem);
                cwchangeStorage.Closing += delegate
                {
                    if (cwchangeStorage.DialogResult == true)
                    {
                        gridRibbon_BaseActions("RefreshGrid");
                    }
                };
                cwchangeStorage.Show();
                break;

            case "SeriesBatch":
                if (selectedItem == null)
                {
                    return;
                }
                AddDockItem(TabControls.InvSeriesBatch, selectedItem, string.Format("{0}:{1}", Localization.lookup("SerialBatchNumbers"), selectedItem._InvoiceRowId));
                break;

            case "PostedBy":
                if (selectedItem != null)
                {
                    JournalPosted(selectedItem);
                }
                break;

            default:
                gridRibbon_BaseActions(ActionType);
                break;
            }
        }
Beispiel #2
0
        void localMenu_OnItemClicked(string ActionType)
        {
            var selectedItem = dgInvLines.SelectedItem as InvTransInvoice;

            switch (ActionType)
            {
            case "ChangeVariant":
                if (selectedItem == null)
                {
                    return;
                }
                var cwChangeVaraints = new CWModifyVariants(api, selectedItem);
                cwChangeVaraints.Closing += delegate
                {
                    if (cwChangeVaraints.DialogResult == true)
                    {
                        gridRibbon_BaseActions("RefreshGrid");
                    }
                };
                cwChangeVaraints.Show();
                break;

            case "ChangeStorage":
                if (selectedItem == null)
                {
                    return;
                }
                var cwchangeStorage = new CWModiyStorage(api, selectedItem);
                cwchangeStorage.Closing += delegate
                {
                    if (cwchangeStorage.DialogResult == true)
                    {
                        gridRibbon_BaseActions("RefreshGrid");
                    }
                };
                cwchangeStorage.Show();
                break;

            case "SeriesBatch":
                if (selectedItem == null)
                {
                    return;
                }
                AddDockItem(TabControls.InvSeriesBatch, selectedItem, string.Format("{0}:{1}", Localization.lookup("SerialBatchNumbers"), selectedItem._InvoiceRowId));
                break;

            case "AddEditNote":
                if (selectedItem == null)
                {
                    return;
                }
                CWAddEditNote cwAddEditNote = new CWAddEditNote(api, selectedItem, null);
                cwAddEditNote.Closed += delegate
                {
                    if (cwAddEditNote.DialogResult == true)
                    {
                        if (cwAddEditNote.result == ErrorCodes.Succes)
                        {
                            selectedItem._Note   = cwAddEditNote.invTransClient._Note;
                            selectedItem.HasNote = !string.IsNullOrEmpty(cwAddEditNote.invTransClient._Note);
                            dgInvLines.UpdateItemSource(2, selectedItem);
                        }
                    }
                };
                cwAddEditNote.Show();
                break;

            case "PostedBy":
                if (selectedItem != null)
                {
                    JournalPosted(selectedItem);
                }
                break;

            default:
                gridRibbon_BaseActions(ActionType);
                break;
            }
        }
        private void LocalMenu_OnItemClicked(string ActionType)
        {
            var selectedItem = dgProductionPostedTrans.SelectedItem as ProductionPostedTransClient;

            switch (ActionType)
            {
            case "ChangeVariant":
                if (selectedItem == null)
                {
                    return;
                }
                var cwChangeVaraints = new CWModifyVariants(api, selectedItem);
                cwChangeVaraints.Closing += delegate
                {
                    if (cwChangeVaraints.DialogResult == true)
                    {
                        gridRibbon_BaseActions("RefreshGrid");
                    }
                };
                cwChangeVaraints.Show();
                break;

            case "ChangeStorage":
                if (selectedItem == null)
                {
                    return;
                }
                var cwchangeStorage = new CWModiyStorage(api, selectedItem);
                cwchangeStorage.Closing += delegate
                {
                    if (cwchangeStorage.DialogResult == true)
                    {
                        gridRibbon_BaseActions("RefreshGrid");
                    }
                };
                cwchangeStorage.Show();
                break;

            case "SeriesBatch":
                if (selectedItem == null)
                {
                    return;
                }
                AddDockItem(TabControls.InvSeriesBatch, selectedItem, string.Format("{0}: {1}", Uniconta.ClientTools.Localization.lookup("SerialBatchNumbers"), selectedItem._Item));
                break;

            case "AddEditNote":
                if (selectedItem == null)
                {
                    return;
                }
                CWAddEditNote cwAddEditNote = new CWAddEditNote(api, selectedItem);
                cwAddEditNote.Closed += delegate
                {
                    if (cwAddEditNote.DialogResult == true)
                    {
                        if (cwAddEditNote.result == ErrorCodes.Succes)
                        {
                            selectedItem._Note   = cwAddEditNote.invTransClient._Note;
                            selectedItem.HasNote = !string.IsNullOrEmpty(cwAddEditNote.invTransClient._Note);
                            dgProductionPostedTrans.UpdateItemSource(2, selectedItem);
                        }
                    }
                };
                cwAddEditNote.Show();
                break;

            case "PostedBy":
                if (selectedItem != null)
                {
                    JournalPosted(selectedItem);
                }
                break;

            case "VoucherTransactions":
                if (selectedItem == null)
                {
                    return;
                }
                string arg;
                if (selectedItem._JournalPostedId != 0)
                {
                    arg = string.Format("{0}={1}", Uniconta.ClientTools.Localization.lookup("JournalPostedId"), selectedItem._JournalPostedId);
                }
                else if (selectedItem._InvoiceNumber != 0)
                {
                    arg = string.Format("{0}={1}", Uniconta.ClientTools.Localization.lookup("Invoice"), selectedItem._InvoiceNumber);
                }
                else if (selectedItem._InvJournalPostedId != 0)
                {
                    arg = string.Format("{0} ({1})={2}", Uniconta.ClientTools.Localization.lookup("JournalPostedId"), Uniconta.ClientTools.Localization.lookup("Inventory"), selectedItem._InvJournalPostedId);
                }
                else
                {
                    arg = string.Format("{0}={1}", Uniconta.ClientTools.Localization.lookup("Account"), selectedItem.AccountName);
                }
                string vheader = string.Format("{0} ({1})", Uniconta.ClientTools.Localization.lookup("VoucherTransactions"), arg);
                AddDockItem(TabControls.AccountsTransaction, dgProductionPostedTrans.syncEntity, vheader);
                break;

            case "AttachSerialBatch":
                if (selectedItem != null)
                {
                    AddDockItem(TabControls.AttachInvSeriesBatch, selectedItem, Uniconta.ClientTools.Localization.lookup("SerialBatchNumbers"));
                }
                break;

            default:
                gridRibbon_BaseActions(ActionType);
                break;
            }
        }
        private void localMenu_OnItemClicked(string ActionType)
        {
            var selectedItem = dgInvTransGrid.SelectedItem as InvTransClient;

            switch (ActionType)
            {
            case "SeriesBatch":
                if (selectedItem != null)
                {
                    AddDockItem(TabControls.InvSeriesBatch, dgInvTransGrid.syncEntity, string.Format("{0}: {1}", Uniconta.ClientTools.Localization.lookup("SerialBatchNumbers"), selectedItem._Item));
                }
                break;

            case "AttachSerialBatch":
                if (selectedItem != null)
                {
                    AddDockItem(TabControls.AttachInvSeriesBatch, selectedItem, Uniconta.ClientTools.Localization.lookup("SerialBatchNumbers"));
                }
                break;

            case "ChangeVariant":
                if (selectedItem == null)
                {
                    return;
                }
                var cwChangeVaraints = new CWModifyVariants(api, selectedItem);
                cwChangeVaraints.Closing += delegate
                {
                    if (cwChangeVaraints.DialogResult == true)
                    {
                        gridRibbon_BaseActions("RefreshGrid");
                    }
                };
                cwChangeVaraints.Show();
                break;

            case "ChangeStorage":
                if (selectedItem == null)
                {
                    return;
                }
                var cwchangeStorage = new CWModiyStorage(api, selectedItem);
                cwchangeStorage.Closing += delegate
                {
                    if (cwchangeStorage.DialogResult == true)
                    {
                        gridRibbon_BaseActions("RefreshGrid");
                    }
                };
                cwchangeStorage.Show();
                break;

            case "VoucherTransactions":
                if (selectedItem == null)
                {
                    return;
                }
                string arg;
                if (selectedItem._JournalPostedId != 0)
                {
                    arg = string.Format("{0}={1}", Uniconta.ClientTools.Localization.lookup("JournalPostedId"), selectedItem._JournalPostedId);
                }
                else if (selectedItem._InvoiceNumber != 0)
                {
                    arg = string.Format("{0}={1}", Uniconta.ClientTools.Localization.lookup("Invoice"), selectedItem._InvoiceNumber);
                }
                else if (selectedItem._InvJournalPostedId != 0)
                {
                    arg = string.Format("{0} ({1})={2}", Uniconta.ClientTools.Localization.lookup("JournalPostedId"), Uniconta.ClientTools.Localization.lookup("Inventory"), selectedItem._InvJournalPostedId);
                }
                else
                {
                    arg = string.Format("{0}={1}", Uniconta.ClientTools.Localization.lookup("Account"), selectedItem.AccountName);
                }
                string vheader = string.Format("{0} ({1})", Uniconta.ClientTools.Localization.lookup("VoucherTransactions"), arg);
                AddDockItem(TabControls.AccountsTransaction, dgInvTransGrid.syncEntity, vheader);
                break;

            case "TransInBOM":
                if (selectedItem != null && selectedItem._MovementType == (byte)InvMovementType.ReportAsFinished)
                {
                    string header = string.Format("{0} ({1})", Uniconta.ClientTools.Localization.lookup("TransInBOM"), selectedItem._Item);
                    AddDockItem(TabControls.InventoryTransactions, dgInvTransGrid.syncEntity, header);
                }
                break;

            case "SeriesBatchInBom":
                if (selectedItem != null && selectedItem._MovementType == (byte)InvMovementType.ReportAsFinished)
                {
                    string header = string.Format("{0} ({1})", Uniconta.ClientTools.Localization.lookup("SeriesBatchInBom"), selectedItem._Item);
                    AddDockItem(TabControls.InventoryTransactionStatement, selectedItem, header);
                }
                break;

            case "MarkInvTrans":
                if (selectedItem != null)
                {
                    MarkInvTrans(selectedItem);
                }
                break;

            case "Invoice":
                if (selectedItem == null)
                {
                    return;
                }
                if (selectedItem._MovementType == (byte)InvMovementType.Debtor)
                {
                    var debtHeader = string.Format("{0} ({1})", Uniconta.ClientTools.Localization.lookup("DebtorInvoice"), selectedItem._Item);
                    AddDockItem(TabControls.Invoices, selectedItem, debtHeader);
                }
                else if (selectedItem._MovementType == (byte)InvMovementType.Creditor)
                {
                    var credHeader = string.Format("{0} ({1})", Uniconta.ClientTools.Localization.lookup("CreditorInvoice"), selectedItem._Item);
                    AddDockItem(TabControls.CreditorInvoice, selectedItem, credHeader);
                }
                break;

            case "ViewDownloadRow":
                if (selectedItem != null)
                {
                    DebtorTransactions.ShowVoucher(dgInvTransGrid.syncEntity, api, busyIndicator);
                }
                break;

            case "ProductionPosted":
                if (selectedItem != null)
                {
                    AddDockItem(TabControls.ProductionPostedGridPage, selectedItem, string.Format("{0}: {1}", Uniconta.ClientTools.Localization.lookup("ProductionPosted"), selectedItem._Item));
                }
                break;

            case "PostedBy":
                if (selectedItem != null)
                {
                    JournalPosted(selectedItem);
                }
                break;

            case "MarkOrderLineAgnstInvTrans":
                if (selectedItem?._Item == null)
                {
                    return;
                }
                object[] param = new object[] { selectedItem };
                AddDockItem(TabControls.InventoryTransactionsMarkedPage, param, true);
                break;

            default:
                gridRibbon_BaseActions(ActionType);
                break;
            }
        }