示例#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);
            }
        }
示例#2
0
        private void removeProduct()
        {
            try
            {
                if (ProductTo.SelectedItem != null)
                {
                    List <Products>    removeList  = new List <Products>();
                    ClientProductProxy thisRecord  = (ClientProductProxy)ProductTo.SelectedItem;
                    Products           thisProduct = ProductFunctions.GetProductByID(thisRecord.ProductID);
                    removeList.Add(thisProduct);

                    bool success = ClientFunctions.ToggleClientProducts(removeList, false, Globals.SelectedClient);
                    if (success)
                    {
                        refreshProductSummaries(false);
                        CommitButton.IsEnabled = true;
                    }
                }
                else
                {
                    MessageFunctions.Error("Error removing products from client: no product selected.", null);
                }
            }
            catch (Exception generalException)
            {
                MessageFunctions.Error("Error removing products from client", generalException);
            }
        }
示例#3
0
        private void toActivated(bool ClientList)
        {
            try
            {
                bool clientSelected  = (ClientList && ClientTo.SelectedItem != null);
                bool productSelected = (!ClientList && ProductTo.SelectedItem != null);

                if (clientSelected)
                {
                    selectedClientProduct = (ClientProductProxy)ClientTo.SelectedItem;
                }
                else if (productSelected)
                {
                    selectedClientProduct = (ClientProductProxy)ProductTo.SelectedItem;
                }
                else
                {
                    selectedClientProduct = null;
                }

                if (selectedClientProduct != null)
                {
                    Version.Text            = selectedClientProduct.ClientVersion.ToString("#0.0");
                    RemoveButton.IsEnabled  = Version.IsEnabled = true;
                    DisableButton.IsEnabled = (Globals.MyPermissions.Allow("ActivateClientProducts"));
                    toggleDisableButton(selectedClientProduct.Live);
                }
                else
                {
                    Version.Text           = "";
                    RemoveButton.IsEnabled = DisableButton.IsEnabled = Version.IsEnabled = false;
                }
            }
            catch (Exception generalException) { MessageFunctions.Error("Error activating the 'Remove' and 'Active' buttons", generalException); }
        }
        private void removeProduct()
        {
            try
            {
                if (ProductTo.SelectedItem != null)
                {
                    List <ClientProductProxy> removeList  = new List <ClientProductProxy>();
                    ClientProductProxy        thisProduct = null;
                    ProjectProductProxy       thisRecord  = (ProjectProductProxy)ProductTo.SelectedItem;
                    if (thisRecord.ClientID > 0)
                    {
                        thisProduct = ClientFunctions.ClientsWithProduct(false, thisRecord.ProductID).FirstOrDefault(cwp => cwp.ClientID == thisRecord.ClientID);
                        if (thisProduct == null)
                        {
                            MessageFunctions.InfoAlert("No client product record found for client " + thisRecord.ClientName() + " with product " + thisRecord.ProductName
                                                       + ". A 'dummy' record will be used instead.", null);
                            thisProduct = ProjectFunctions.DummyClientProduct(thisRecord.Product);
                        }
                    }
                    else
                    {
                        thisProduct = ProjectFunctions.DummyClientProduct(thisRecord.Product);
                    }

                    removeList.Add(thisProduct);

                    bool success = ProjectFunctions.ToggleProjectProducts(removeList, false, Globals.SelectedProjectProxy);
                    if (success)
                    {
                        refreshProductSummaries(false);
                        CommitButton.IsEnabled = true;
                    }
                }
                else
                {
                    MessageFunctions.Error("Error removing products from project: no product selected.", null);
                }
            }
            catch (Exception generalException)
            {
                MessageFunctions.Error("Error removing products from project", generalException);
            }
        }
示例#5
0
 private void clearChanges()
 {
     ClientFunctions.ClearAnyChanges();
     selectedClientProduct = null;
 }