示例#1
0
文件: IMGroup.cs 项目: alex765022/IBN
        public static int Clone(int FromIMGroupId, string IMGroupName, string Color, byte[] IMGroupLogo, ArrayList YouCanSeeGroups, ArrayList CanSeeYouGroups)
        {
            if (!Company.CheckDiskSpace())
            {
                throw new MaxDiskSpaceException();
            }

            if (!CanCreate())
            {
                throw new AccessDeniedException();
            }

            int IMGroupId = -1;

            using (DbTransaction tran = DbTransaction.Begin())
            {
                IMGroupId = DBIMGroup.CreateUpdate(-1, IMGroupName, Color, false);

                if (IMGroupLogo != null)
                {
                    DBIMGroup.UpdateIMGroupLogo(IMGroupId, IMGroupLogo);
                }
                else
                {
                    DBIMGroup.CloneIMGroupLogo(FromIMGroupId, IMGroupId);
                }

                // You Can See Groups
                foreach (int GroupId in YouCanSeeGroups)
                {
                    DBIMGroup.AddDependences(IMGroupId, GroupId);
                }

                // Can See You Groups
                foreach (int GroupId in CanSeeYouGroups)
                {
                    DBIMGroup.AddDependences(GroupId, IMGroupId);
                }
                tran.Commit();
            }

            return(IMGroupId);
        }