public void ValidatePositions(int organizationID) { ActivityTypes ActivityTypes = new ActivityTypes(LoginUser); ActivityTypes.LoadAllPositions(organizationID); int i = 0; foreach (ActivityType ActivityType in ActivityTypes) { ActivityType.Position = i; i++; } ActivityTypes.Save(); }
public void MovePositionUp(int ActivityTypeID) { ActivityTypes types1 = new ActivityTypes(LoginUser); types1.LoadByActivityTypeID(ActivityTypeID); if (types1.IsEmpty || types1[0].Position < 1) { return; } ActivityTypes types2 = new ActivityTypes(LoginUser); types2.LoadByPosition(types1[0].OrganizationID, types1[0].Position - 1); if (!types2.IsEmpty) { types2[0].Position = types2[0].Position + 1; types2.Save(); } types1[0].Position = types1[0].Position - 1; types1.Save(); ValidatePositions(LoginUser.OrganizationID); }