예제 #1
0
        public Post CreatePost(Xact xact, Account account, bool bidirLink = true)
        {
            if (PostTemps == null)
            {
                PostTemps = new List <Post>();
            }

            Post temp = new Post(account);

            temp.Flags  |= SupportsFlagsEnum.ITEM_TEMP;
            temp.Account = account;
            temp.Account.AddPost(temp);

            PostTemps.Add(temp);

            if (bidirLink)
            {
                xact.AddPost(temp);
            }
            else
            {
                temp.Xact = xact;
            }

            return(temp);
        }
예제 #2
0
        public Post CopyPost(Post origin, Xact xact, Account account = null)
        {
            if (PostTemps == null)
            {
                PostTemps = new List <Post>();
            }

            Post temp = new Post(origin);

            PostTemps.Add(temp);
            temp.Flags |= SupportsFlagsEnum.ITEM_TEMP;

            if (account != null)
            {
                temp.Account = account;
            }

            temp.Account.AddPost(temp);
            xact.AddPost(temp);

            return(temp);
        }
예제 #3
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();
            }
        }