Example #1
0
        public static int CreatePartner(string name, PrimaryKeyId contactUid, PrimaryKeyId orgUid, ArrayList VisibleGroups, byte[] IMGroupLogo)
        {
            if (!Security.IsUserInGroup(InternalSecureGroups.Administrator))
            {
                throw new AccessDeniedException();
            }

            int PartnerId = -1;

            using (DbTransaction tran = DbTransaction.Begin())
            {
                PartnerId = DBGroup.Create((int)InternalSecureGroups.Partner, name);
                foreach (int GroupId in VisibleGroups)
                {
                    DBGroup.AddPartnerGroup(PartnerId, GroupId);
                }

                int IMGroupId = IMGroup.Create(name, "2B6087", true, IMGroupLogo, new ArrayList(), new ArrayList());

                DBGroup.UpdateIMGroupId(PartnerId, IMGroupId);
                DBGroup.UpdateClient(PartnerId, contactUid, orgUid);

                tran.Commit();
            }

            return(PartnerId);
        }