/// <summary> /// DataTable contains columns: /// IMGroupId, IMGroupName /// </summary> /// <returns></returns> public static DataTable GetListIMGroupsYouCanSee(int IMGroupId) { return(DBIMGroup.GetListIMGroupsYouCanSee(IMGroupId, false)); }
public static void Update( int imGroupId , string imGroupName , string color , byte[] imGroupLogo , ArrayList youCanSeeGroups , ArrayList canSeeYouGroups) { if (!CanUpdate()) { throw new AccessDeniedException(); } // YouCanSeeGroups ArrayList newYouCanSeeGroups = new ArrayList(youCanSeeGroups); ArrayList deletedYouCanSeeGroups = new ArrayList(); SeparateIems(newYouCanSeeGroups, deletedYouCanSeeGroups, DBIMGroup.GetListIMGroupsYouCanSee(imGroupId, false), "IMGroupId"); // CanSeeYouGroups ArrayList newCanSeeYouGroups = new ArrayList(canSeeYouGroups); ArrayList deletedCanSeeYouGroups = new ArrayList(); SeparateIems(newCanSeeYouGroups, deletedCanSeeYouGroups, DBIMGroup.GetListIMGroupsCanSeeYou(imGroupId), "IMGroupId"); using (DbTransaction tran = DbTransaction.Begin()) { DBIMGroup.CreateUpdate(imGroupId, imGroupName, color, false); if (imGroupLogo != null) { DBIMGroup.UpdateIMGroupLogo(imGroupId, imGroupLogo); } // You Can See Groups foreach (int groupId in deletedYouCanSeeGroups) { DBIMGroup.DeleteDependences(imGroupId, groupId); } foreach (int groupId in newYouCanSeeGroups) { DBIMGroup.AddDependences(imGroupId, groupId); } // Can See You Groups foreach (int groupId in deletedCanSeeYouGroups) { DBIMGroup.DeleteDependences(groupId, imGroupId); } foreach (int groupId in newCanSeeYouGroups) { DBIMGroup.AddDependences(groupId, imGroupId); } // IBN try { IMManager.UpdateGroup(imGroupId); foreach (int groupId in deletedCanSeeYouGroups) { IMManager.UpdateGroup(groupId); } foreach (int groupId in newCanSeeYouGroups) { IMManager.UpdateGroup(groupId); } } catch (Exception) { } tran.Commit(); } }