Exemple #1
0
            /// <summary>
            ///
            /// </summary>
            /// <remarks>NB: this assumes that the user interfaces only lets the user delete one at a time.
            /// that is, if the user interface was going to let them delete the last two items of
            /// a required the sequence,
            /// this would mistakenly say it was OK.</remarks>
            /// <param name="hvoDeleteOwner"></param>
            /// <param name="flidDelete"></param>
            /// <param name="isAtomic"></param>
            /// <returns></returns>
            protected bool OkToDelete(int hvoDeleteOwner, int flidDelete, bool isAtomic)
            {
                ICmObject owner = CmObject.CreateFromDBObject(this.m_cache, hvoDeleteOwner);

                if (!owner.IsFieldRequired(flidDelete))
                {
                    return(true);
                }
                if (isAtomic)
                {
                    return(false);
                }
                else                    //still OK to delete so long as it is not the last item.
                {
                    return(this.m_cache.GetVectorSize(hvoDeleteOwner, flidDelete) > 1);
                }
            }