Exemplo n.º 1
0
        public Account CreateAccount(string name = "", Account parent = null)
        {
            if (AcctTemps == null)
            {
                AcctTemps = new List <Account>();
            }

            Account temp = new Account(parent, name);

            AcctTemps.Add(temp);
            temp.IsTempAccount = true;

            if (parent != null)
            {
                parent.AddAccount(temp);
            }

            return(temp);
        }
Exemplo n.º 2
0
        public void Clear()
        {
            if (PostTemps != null)
            {
                foreach (Post post in PostTemps)
                {
                    if (!post.Xact.Flags.HasFlag(SupportsFlagsEnum.ITEM_TEMP))
                    {
                        post.Xact.RemovePost(post);
                    }

                    if (post.Account != null && !post.Account.IsTempAccount)
                    {
                        post.Account.RemovePost(post);
                    }
                }
                PostTemps.Clear();
            }

            if (XactTemps != null)
            {
                XactTemps.Clear();
            }

            if (AcctTemps != null)
            {
                foreach (Account acct in AcctTemps)
                {
                    if (acct.Parent != null && !acct.Parent.IsTempAccount)
                    {
                        acct.Parent.RemoveAccount(acct);
                    }
                }
                AcctTemps.Clear();
            }
        }