Exemple #1
0
		public void Update(BEGroups dsGroups)
		{
			DAGroups da = new DAGroups();
			DAUserGroups daUserGroups = new DAUserGroups();
			DAGroupPermissions daGroupPerms = new DAGroupPermissions();

			//delete has be be called before if a usergroup is being deleted
			DataTable deletedUserGroups = dsGroups.tbl_UserGroups.GetChanges(DataRowState.Deleted);
			DataTable modifiedUserGroups = dsGroups.tbl_UserGroups.GetChanges(DataRowState.Modified);
			DataTable addUserGroups = dsGroups.tbl_UserGroups.GetChanges(DataRowState.Added);
			
			if (deletedUserGroups!= null)
			{
				daUserGroups.Update(deletedUserGroups);
			}
			daGroupPerms.Update( dsGroups.tbl_GroupPermissions);
			da.Update( dsGroups.tbl_Groups);
			if (modifiedUserGroups!= null)
			{
				daUserGroups.Update(modifiedUserGroups);
			}
			if (addUserGroups!= null)
			{
				daUserGroups.Update(addUserGroups);
			}
			//if (dsGroups.tbl_Groups.Count > 0)
			//{
			//cache the first user record incase update groups is called.
			//	_UpdateUserInfo(dsGroups);
			//}
		}
Exemple #2
0
		public BEGroups SelectByIDWithUserGroups(int GroupID)
		{
			DAGroups da = new DAGroups();
			BEGroups ds = new BEGroups();
			da.SelectByID(GroupID.ToString(), ds.tbl_Groups);

			return ds;
		}
Exemple #3
0
		public BEGroups SelectAllAdminGroups()
		{
			DAGroups da = new DAGroups();
			BEGroups ds = new BEGroups();
			da.SelectAllAdminGroups(  ds.tbl_Groups);

			return ds;
		}
Exemple #4
0
		public BEGroups SelectGroupsByUserID(int UserID)
		{
			DAGroups da = new DAGroups();
			BEGroups ds = new BEGroups();
			ds.EnforceConstraints = false;
			da.SelectGroupsByUserID(UserID, ds.tbl_Groups);

			return ds;
		}
Exemple #5
0
		public BEGroups SelectGroupPermissionsByGroupID(int GroupID)
		{
			DAGroups daGroups = new DAGroups();
			DAGroupPermissions daGroupPerms = new DAGroupPermissions();
			DAPermissions daPerms = new DAPermissions();
			DAPermissionValues daPermValues = new DAPermissionValues();
			
			BEGroups ds = new BEGroups();

			//ds.EnforceConstraints = false;

			daGroups.SelectByID(GroupID.ToString(), ds.tbl_Groups);
			daPerms.SelectAll(ds.tbl_Permissions);
			daGroupPerms.SelectByID(GroupID.ToString(), ds.tbl_GroupPermissions);
			daPermValues.SelectAll(ds.tbl_PermissionValues);

			return ds;
		}
Exemple #6
0
		public void UpdateUsers (int GroupID, int[] InstIDS)
		{
			ArrayList userList = new ArrayList(InstIDS);

			ArrayList currentUserList;

			BPGroups bp = new BPGroups();
			BEGroups DSGroups = new BEGroups();
			
			DSGroups = bp.SelectUsersByGroupID(GroupID);

			_CurrentUserGroupIDS = new int[DSGroups.Tables["tbl_UserGroups"].Rows.Count];			
			
			for (int i=0; i < DSGroups.Tables["tbl_UserGroups"].Rows.Count; i++)
			{
				_CurrentUserGroupIDS[i] = Convert.ToInt32(DSGroups.Tables["tbl_UserGroups"].Rows[i]["UserID"]);
			}
			currentUserList = new ArrayList(_CurrentUserGroupIDS);

			DAGroups da = new DAGroups();
			DAUserGroups daUserGroups = new DAUserGroups();

			userList.Sort();
			currentUserList.Sort();

			//Insert the records that are new
			foreach (int userID in userList)
			{
				if (currentUserList.BinarySearch(userID) < 0)
				{
					//not found in the current users, add it.
					daUserGroups.InsertByID(userID, GroupID);
				}
			}

			//delete the old records
			foreach (int userID in currentUserList)
			{
				if (userList.BinarySearch(userID) < 0)
				{
					//not found in the current groups, add it.
					daUserGroups.DeleteByID(userID, GroupID);
				}
			}
		}
Exemple #7
0
		public void UpdateGroupPermissions(BEGroups dsGroups)
		{
			DAGroupPermissions daGroupPerm = new DAGroupPermissions();

			daGroupPerm.Update( dsGroups.tbl_GroupPermissions);
		}