Esempio n. 1
0
        void chkDetailIsSummary_CheckedChanged(object sender, EventArgs e)
        {
            if ((FCurrentAccount != null) && (FIAmUpdating == 0)) // Only look into this if the user has changed it...
            {
                FCurrentAccount.GetAttrributes();

                if (chkDetailIsSummary.Checked) // I can't allow this to be made a summary if it has transactions posted:
                {
                    if (!FCurrentAccount.CanHaveChildren.Value)
                    {
                        MessageBox.Show(String.Format("Account {0} cannot be made summary because it has tranactions posted to it.",
                                                      FCurrentAccount.AccountRow.AccountCode), "Summary Account");
                        chkDetailIsSummary.Checked = false;
                    }
                }
                else // I can't allow this account to be a posting account if it has children:
                {
                    if (FCurrentAccount.linkedTreeNode.Nodes.Count > 0)
                    {
                        MessageBox.Show(String.Format("Account {0} cannot be made postable while it has children.",
                                                      FCurrentAccount.AccountRow.AccountCode), "Summary Account");
                        chkDetailIsSummary.Checked = true;
                    }
                }
            }
        }
Esempio n. 2
0
        private void treeView_DragOver(object sender, DragEventArgs e)
        {
            Point pt = trvAccounts.PointToClient(new Point(e.X, e.Y));

            FDragTarget = trvAccounts.GetNodeAt(pt);

            if (FDragTarget == null)
            {
                return;
            }

            ScrollIntoView(FDragTarget);

            // Is the referenced node a valid drop target?
            bool CantDropHere = (FDragTarget == FDragNode) || IsDescendantOf(FDragTarget, FDragNode);

            if (!CantDropHere)
            {
                AccountNodeDetails NodeDetails = (AccountNodeDetails)FDragTarget.Tag;
                NodeDetails.GetAttrributes();

                if (!NodeDetails.CanHaveChildren.Value)
                {
                    CantDropHere = true;
                }
            }

            if (CantDropHere)
            {
                e.Effect    = DragDropEffects.Scroll;
                FDragTarget = null;
            }
            else
            {
                e.Effect = DragDropEffects.Move | DragDropEffects.Scroll;
                ShowNodeSelected(FDragTarget);
            }
        }