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); }
public static int Create(int parent_group_id, string name) { if (!CanCreate(parent_group_id)) { throw new AccessDeniedException(); } return(DBGroup.Create(parent_group_id, name)); }