public List <ApiOperationsGroup> GetOperationsGroups(ApiUser user, List <ApiOperation> operations, List <ApiFrequency> frequencies, List <ApiImportance> importances, List <ApiTransactionType> types, List <ApiTag> tags) { var groups = OperationsGroupAdapter.GetAll($"user_id={user.Id}"); var filter = ""; foreach (var group in groups) { filter += $"operation_group_id={group.Id} OR "; } if (filter.Length > 4) { filter = filter.Substring(0, filter.Length - 4); } var relations = OperationsGroupRelationAdapter.GetAll(filter).ToList(); OperationsGroupMapper.Update(OperationMapper, importances, tags, frequencies, operations, user, relations, types); return(OperationsGroupMapper.ConvertToApiEntitiesCollection(OperationsGroupAdapter.GetAll($"user_id={user.Id}")).ToList()); }
public static void LoadOperationsGroups() { OperationsGroupMapper.Update(User, Importances, Frequencies); OperationsGroups = OperationsGroupMapper.ConvertToBusinessLogicEntitiesCollection(OperationsGroupAdapter.GetAll($"user_id={User.Id}")).ToList(); if (OperationsGroups.Count > 0) { var filter = ""; foreach (var group in OperationsGroups) { filter += $"operation_group_id={group.Id} OR "; } filter = filter.Substring(0, filter.Length - 4); OperationsGroupRelationMapper.Update(Tags); var relations = OperationsGroupRelationMapper.ConvertToBusinessLogicEntitiesCollection(OperationsGroupRelationAdapter.GetAll(filter)); foreach (var group in OperationsGroups) { group.SetTags(relations.Where(r => r.RelatedId == group.Id)); } } }