Esempio n. 1
0
        private void removeClient()
        {
            try
            {
                if (ClientTo.SelectedItem != null)
                {
                    List <Clients>     removeList = new List <Clients>();
                    ClientProductProxy thisRecord = (ClientProductProxy)ClientTo.SelectedItem;
                    Clients            thisClient = ClientFunctions.GetClientByID(thisRecord.ClientID);
                    removeList.Add(thisClient);

                    bool success = ClientFunctions.ToggleProductClients(removeList, false, selectedProduct);
                    if (success)
                    {
                        refreshClientSummaries(false);
                        CommitButton.IsEnabled = true;
                    }
                }
                else
                {
                    MessageFunctions.Error("Error removing client from Product: no client selected.", null);
                }
            }
            catch (Exception generalException)
            {
                MessageFunctions.Error("Error removing client from Product", generalException);
            }
        }
        // -------------- Data updates -------------- //



        // --------- Other/shared functions --------- //

        private void setCurrentClient(Clients client, ClientProxy clientProxy = null)
        {
            try
            {
                if (client == null && clientProxy == null)
                {
                    Globals.SelectedClient = null;
                    PageHeader.Content     = defaultHeader;
                    if (!projectSelected)
                    {
                        MessageFunctions.CancelInfoAlert();
                    }
                }
                else
                {
                    if (client == null)
                    {
                        client = ClientFunctions.GetClientByID(clientProxy.ID);
                    }
                    Globals.SelectedClient = client;
                    PageHeader.Content     = defaultHeader + " for Client " + client.ClientCode + " (" + client.ClientName + ")";
                    if (!projectSelected)
                    {
                        MessageFunctions.InfoAlert("This effectively sets the current client to " + client.ClientName + " until the name filter is changed/cleared "
                                                   + " or a different project is selected (the projects drop-down list is unaffected)", "Client " + client.ClientCode + " selected");
                    }
                }
            }
            catch (Exception generalException) { MessageFunctions.Error("Error processing project client selection", generalException); }
        }
 public string ClientName()
 {
     if (Project == null)
     {
         return("");
     }
     else if (ClientID <= 0)
     {
         return("");
     }
     return(ClientFunctions.GetClientByID(ClientID).ClientName);
 }
 private void ClientProductButton_Click(object sender, RoutedEventArgs e)
 {
     if (!ProjectFunctions.IgnoreAnyChanges())
     {
         return;
     }
     clearChanges();
     if (internalProjectSelected())
     {
         Globals.ProductSourcePage = "ProjectProductsPage";
         PageFunctions.ShowProductPage(pageMode);
     }
     else
     {
         if (editMode == modeType.ProductsOfProject && Globals.SelectedProjectProxy != null && Globals.SelectedProjectProxy.Client != null)
         {
             int clientID = Globals.SelectedProjectProxy.Client.ID;
             Globals.SelectedClient = ClientFunctions.GetClientByID(clientID);
         }
         Globals.ClientSourcePage = "ProjectProductsPage";
         PageFunctions.ShowClientProductsPage(selectedProductID);
     }
 }