Beispiel #1
0
        private void localMenu_OnItemClicked(string ActionType)
        {
            var selectedItem  = dgDebtorAccountGrid.SelectedItem as DebtorClient;
            var selectedItems = dgDebtorAccountGrid.SelectedItems;

            switch (ActionType)
            {
            case "EditAll":
                if (dgDebtorAccountGrid.Visibility == Visibility.Visible)
                {
                    EditAll();
                }
                break;

            case "AddRow":
                object[] param = new object[2];
                param[0] = api;
                param[1] = null;
                AddDockItem(TabControls.DebtorAccountPage2, param, Uniconta.ClientTools.Localization.lookup("DebtorAccount"), "Add_16x16.png");
                break;

            case "EditRow":
                if (selectedItem != null)
                {
                    object[] Params = new object[2] {
                        selectedItem, true
                    };
                    AddDockItem(TabControls.DebtorAccountPage2, Params, string.Format("{0}: {1}", Uniconta.ClientTools.Localization.lookup("DebtorAccount"), selectedItem._Account));
                }
                break;

            case "DebtorTran":
                if (selectedItem != null)
                {
                    AddDockItem(TabControls.DebtorTransactions, dgDebtorAccountGrid.syncEntity);
                }
                break;

            case "OpenTran":
                if (selectedItem != null)
                {
                    AddDockItem(TabControls.DebtorOpenTransactions, dgDebtorAccountGrid.syncEntity);
                }
                break;

            case "Contacts":
                if (selectedItem != null)
                {
                    AddDockItem(TabControls.ContactPage, dgDebtorAccountGrid.syncEntity);
                }
                break;

            case "ClientItemNumber":
                if (selectedItem != null && selectedItem._ItemNameGroup != null)
                {
                    AddDockItem(TabControls.LanguageItemTextPage, selectedItem);
                }
                else
                {
                    UtilDisplay.ShowFieldMissing("ItemNameGroup");
                }
                break;

#if !SILVERLIGHT
            case "CreateMandates":
                if (selectedItems != null)
                {
                    CreateMandates(selectedItems);
                }
                break;
#endif
            case "Prices":
                if (selectedItem != null && selectedItem._PriceList != null)
                {
                    AddDockItem(TabControls.CustomerPriceListLinePage, selectedItem);
                }
                else
                {
                    UtilDisplay.ShowFieldMissing("PriceList");
                }
                break;

            case "DebtorOrders":
                if (selectedItem != null)
                {
                    AddDockItem(TabControls.DebtorOrdersMultiple, dgDebtorAccountGrid.syncEntity);
                }
                break;

            case "FollowUp":
                if (selectedItem != null)
                {
                    var header = string.Format("{0}:{2} {1}", Uniconta.ClientTools.Localization.lookup("FollowUp"), selectedItem._Name, Uniconta.ClientTools.Localization.lookup("Accounts"));
                    AddDockItem(TabControls.CrmFollowUpPage, dgDebtorAccountGrid.syncEntity, header);
                }
                break;

            case "AddNote":
                if (selectedItem != null)
                {
                    string header = string.Format("{0} : {1}", Uniconta.ClientTools.Localization.lookup("UserNotesInfo"), selectedItem._Account);
                    AddDockItem(TabControls.UserNotesPage, dgDebtorAccountGrid.syncEntity, header);
                }
                break;

            case "AddDoc":
                if (selectedItem != null)
                {
                    AddDockItem(TabControls.UserDocsPage, dgDebtorAccountGrid.syncEntity, string.Format("{0}: {1}", Uniconta.ClientTools.Localization.lookup("Documents"), selectedItem._Name));
                }
                break;

            case "Orders":
                if (dgDebtorAccountGrid.syncEntity == null)
                {
                    return;
                }
                AddDockItem(TabControls.DebtorOrdersMultiple, dgDebtorAccountGrid.syncEntity);
                break;

            case "Offers":
                if (selectedItem != null)
                {
                    AddDockItem(TabControls.DebtorOffers, dgDebtorAccountGrid.syncEntity);
                }
                break;

            case "Invoices":
                if (selectedItem != null)
                {
                    string header = string.Format("{0}/{1}", Uniconta.ClientTools.Localization.lookup("DebtorInvoice"), selectedItem._Account);
                    AddDockItem(TabControls.Invoices, dgDebtorAccountGrid.syncEntity, header);
                }
                break;

            case "InvTran":
                if (selectedItem != null)
                {
                    AddDockItem(TabControls.InvTransactions, dgDebtorAccountGrid.syncEntity);
                }
                break;

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

            case "AccountStatDate":
                if (selectedItem == null)
                {
                    return;
                }
                object[] obj = new object[2];
                obj[0] = selectedItem;
                obj[1] = true;
                AddDockItem(TabControls.DebtorAccountStat, obj, string.Format("{0}:{1}", Uniconta.ClientTools.Localization.lookup("AccountStat"), selectedItem._Account));
                break;

            case "RefreshGrid":
                if (gridControl.Visibility == Visibility.Visible)
                {
                    gridRibbon_BaseActions(ActionType);
                }
                break;

            case "AddLine":
                dgDebtorAccountGrid.AddRow();
                break;

            case "CopyRow":
                if (selectedItem != null)
                {
                    if (copyRowIsEnabled)
                    {
                        dgDebtorAccountGrid.CopyRow();
                    }
                    else
                    {
                        CopyRecord(selectedItem);
                    }
                }
                break;

            case "DeleteRow":
                dgDebtorAccountGrid.DeleteRow();
                break;

            case "SaveGrid":
                Save();
                break;

            case "DebtorStatement":
                if (selectedItem != null)
                {
                    AddDockItem(TabControls.DebtorStatement, dgDebtorAccountGrid.syncEntity);
                }
                break;

            case "DeliveryAddresses":
                if (selectedItem != null)
                {
                    var header = string.Format("{0}: {1}, {2}", Uniconta.ClientTools.Localization.lookup("DeliveryAddresses"), selectedItem._Account, selectedItem._Name);
                    AddDockItem(TabControls.WorkInstallationPage, dgDebtorAccountGrid.syncEntity, header);
                }
                break;

            case "QuickInvoice":
                if (selectedItem != null)
                {
                    AddDockItem(TabControls.CreateInvoicePage, selectedItem);
                }
                break;

            case "CopyRecord":
                CopyRecord(selectedItem);
                break;

#if WPF
            case "DebtorTransPivot":
                if (selectedItem != null)
                {
                    AddDockItem(TabControls.DebtorInvoiceLinesPivotReport, selectedItem, string.Format("{0}: {1}", Uniconta.ClientTools.Localization.lookup("Pivot"), selectedItem._Name));
                }
                break;
#endif
            case "Project":
                if (selectedItem != null)
                {
                    AddDockItem(TabControls.Project, selectedItem, string.Format("{0}: {1}", Uniconta.ClientTools.Localization.lookup("Project"), selectedItem._Name));
                }
                break;

            case "UndoDelete":
                dgDebtorAccountGrid.UndoDeleteRow();
                break;

#if !SILVERLIGHT
            case "DocSendLog":
                if (selectedItem != null)
                {
                    AddDockItem(TabControls.DocsSendLogGridPage, dgDebtorAccountGrid.syncEntity);
                }
                break;
#endif
            case "TaskGroups":
                if (selectedItem != null)
                {
                    AddDockItem(TabControls.DebtorProjTaskGroup, dgDebtorAccountGrid.syncEntity, string.Format("{0}: {1}", Uniconta.ClientTools.Localization.lookup("TaskGroups"), selectedItem._Name));
                }
                break;

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

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

            switch (ActionType)
            {
            case "EditAll":
                if (dgCreditorAccountGrid.Visibility == Visibility.Visible)
                {
                    EditAll();
                }
                break;

            case "AddLine":
                dgCreditorAccountGrid.AddRow();
                break;

            case "CopyRow":
                if (copyRowIsEnabled)
                {
                    dgCreditorAccountGrid.CopyRow();
                }
                else
                {
                    CopyRecord(selectedItem);
                }
                break;

            case "DeleteRow":
                dgCreditorAccountGrid.DeleteRow();
                break;

            case "SaveGrid":
                Save();
                break;

            case "AddRow":
                object[] param = new object[2];
                param[0] = api;
                param[1] = null;
                AddDockItem(TabControls.CreditorAccountPage2, param, Uniconta.ClientTools.Localization.lookup("Creditorsaccount"), "Add_16x16.png");
                break;

            case "EditRow":
                if (selectedItem != null)
                {
                    var objParam = new object[2] {
                        selectedItem, true
                    };
                    AddDockItem(TabControls.CreditorAccountPage2, objParam, string.Format("{0}: {1}", Uniconta.ClientTools.Localization.lookup("Creditorsaccount"), selectedItem.Account));
                }
                break;

            case "CreditorTran":
                if (selectedItem != null)
                {
                    AddDockItem(TabControls.CreditorTransactions, dgCreditorAccountGrid.syncEntity);
                }
                break;

            case "OpenTran":
                if (selectedItem != null)
                {
                    AddDockItem(TabControls.CreditorOpenTransactions, dgCreditorAccountGrid.syncEntity);
                }
                break;

            case "Contacts":
                if (selectedItem != null)
                {
                    AddDockItem(TabControls.ContactPage, dgCreditorAccountGrid.syncEntity);
                }
                break;

            case "ClientItemNumber":
                if (selectedItem?._ItemNameGroup != null)
                {
                    AddDockItem(TabControls.LanguageItemTextPage, selectedItem);
                }
                else
                {
                    UtilDisplay.ShowFieldMissing("ItemNameGroup");
                }
                break;

            case "Prices":
                if (selectedItem?._PriceList != null)
                {
                    AddDockItem(TabControls.CustomerPriceListLinePage, selectedItem);
                }
                else
                {
                    UtilDisplay.ShowFieldMissing("PriceList");
                }
                break;

            case "Orders":
                if (dgCreditorAccountGrid.syncEntity != null)
                {
                    AddDockItem(TabControls.CreditorOrders, dgCreditorAccountGrid.syncEntity);
                }
                break;

            case "FollowUp":
                if (selectedItem != null)
                {
                    var followUpHeader = string.Format("{0}:{2} {1}", Uniconta.ClientTools.Localization.lookup("FollowUp"), selectedItem._Name, Uniconta.ClientTools.Localization.lookup("Accounts"));
                    AddDockItem(TabControls.CrmFollowUpPage, dgCreditorAccountGrid.syncEntity, followUpHeader);
                }
                break;

            case "AddNote":
                if (selectedItem != null)
                {
                    string hdr = string.Format("{0} : {1}", Uniconta.ClientTools.Localization.lookup("UserNotesInfo"), selectedItem._Account);
                    AddDockItem(TabControls.UserNotesPage, dgCreditorAccountGrid.syncEntity, hdr);
                }
                break;

            case "AddDoc":
                if (selectedItem != null)
                {
                    AddDockItem(TabControls.UserDocsPage, dgCreditorAccountGrid.syncEntity, string.Format("{0}: {1}", Uniconta.ClientTools.Localization.lookup("Documents"), selectedItem._Name));
                }
                break;

            case "InvTran":
                if (selectedItem != null)
                {
                    AddDockItem(TabControls.InvTransactions, dgCreditorAccountGrid.syncEntity);
                }
                break;

            case "Invoices":
                if (selectedItem == null)
                {
                    return;
                }
                string header = string.Format("{0}/{1}", Uniconta.ClientTools.Localization.lookup("CreditorInvoice"), selectedItem._Account);
                AddDockItem(TabControls.CreditorInvoice, dgCreditorAccountGrid.syncEntity, header);
                break;

            case "RefreshGrid":
                if (gridControl.Visibility == Visibility.Visible)
                {
                    gridRibbon_BaseActions(ActionType);
                }
                break;

            case "AccountStat":
                if (selectedItem != null)
                {
                    AddDockItem(TabControls.InventoryTotals, selectedItem, string.Format("{0}:{1}", Uniconta.ClientTools.Localization.lookup("CreditorAccountStat"), selectedItem._Account));
                }
                break;

            case "CreditorStatement":
                if (selectedItem != null)
                {
                    AddDockItem(TabControls.CreditorStatement, dgCreditorAccountGrid.syncEntity);
                }
                break;

            case "CopyRecord":
                CopyRecord(selectedItem);
                break;

            case "UndoDelete":
                dgCreditorAccountGrid.UndoDeleteRow();
                break;

                /*
                 * Code from John which is not completed
                 * case "CreditorPrices":
                 *  if (selectedItem != null)
                 *      AddDockItem(TabControls.CreditorPrices, dgCreditorAccountGrid.syncEntity);
                 *  break;
                 */
#if !SILVERLIGHT
            case "CreditorTransPivot":
                if (selectedItem != null)
                {
                    AddDockItem(TabControls.CreditorInvoiceLinesPivotReport, selectedItem, string.Format("{0}: {1}", Uniconta.ClientTools.Localization.lookup("Pivot"), selectedItem._Name));
                }
                break;
#endif
            default:
                gridRibbon_BaseActions(ActionType);
                break;
            }
        }