Untitled

mail@pastecode.io avatar
unknown
plain_text
5 months ago
2.0 kB
2
Indexable
{
    NSMutableArray *arrFilteredGroup = [[NSMutableArray alloc] init];
    if([arrProductGrpCategoryList count] > 0)
    {
        arrFilteredCategory = [[NSMutableArray alloc] init];
        self.strGroupId = @"";
        for (ExibitorGroupCategoryModel *obj in arrProductGrpCategoryList)
        {
            NSArray<SpeakerCategoryModel *> *arrTempCategories = obj.arrCategoriesList;
            BOOL isCategorySelected = NO;
            for (SpeakerCategoryModel *objTemp in arrTempCategories) {
                if ([objTemp.isSelected isEqualToString:@"1"])
                {
                    [arrFilteredCategory addObject:CHECK_NULL_STRING(objTemp.iid)];
                    isCategorySelected = YES;
                }
            }
            if (isCategorySelected){
                [arrFilteredGroup addObject:CHECK_NULL_STRING(obj.strGrpID)];
            }
        }
    }
    
    if ([arrFilteredCategory count ] > 0){
        self.isFilter = YES;
        pageNumber = 1;
        self.strCategories = [self getStringFromArray:arrFilteredCategory];
        self.strGroupId = [self getStringFromArray:arrFilteredGroup];
        [self getExhibitorProductList];
    }
}

- (NSString *)getStringFromArray:(NSMutableArray *)arrFilteredArray
{
    NSString *strTemp = @"";
    for (int i = 0; i <= ([arrFilteredArray count] - 1); i++) {
        if (i == 0) {
            if (i == ([arrFilteredArray count] - 1)) {
                strTemp = [NSString stringWithFormat:@"[%@]",[arrFilteredArray objectAtIndex:i]];
            }else {
                strTemp = [NSString stringWithFormat:@"[%@",[arrFilteredArray objectAtIndex:i]];
            }
        }else if (i == ([arrFilteredArray count] - 1)){
            strTemp = [NSString stringWithFormat:@"%@,%@]",strTemp,[arrFilteredArray objectAtIndex:i]];
        }else {
            strTemp = [NSString stringWithFormat:@"%@,%@",strTemp,[arrFilteredArray objectAtIndex:i]];
        }
    }
    return strTemp;
}
Leave a Comment