//
//  ViewController.m
//  NepenthesClient
//
//  Created by XIAOHUI LI on 2016/5/7.
//  Copyright © 2016年 Everdow Ltd. All rights reserved.
//

#import "ViewController.h"

@implementation ViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    
    //Create BLSyncUser Object
    BLSyncUser *blSyncUser = [BLSyncUser new];
    
    //Create UserJson Object
    UserJson *userJson = [UserJson new];
    userJson.ID = @"0";
    userJson.Name = @"Nepenthes";
    userJson.Gender = @"M";
    userJson.Age = @"6";
    userJson.Height = @"1.71";
    userJson.Birthdate = @"1981-11-18";
    userJson.Memo = @"Memo";
    userJson.RegisterTime = @"2016-04-22 18:00:00";
    
    //insert
    BOOL flag = [blSyncUser insert:userJson];
    NSLog(@"insert:%d",flag);
    
    //update
    //userJson.ID = @"12";
    //userJson.Memo = @"test";
    //BOOL flag = [blSyncUser update:userJson];
    //NSLog(@"update:%d",flag);
    
    //getCount
    //NSString *whereClause = @"1=1";
    //NSInteger count = [blSyncUser getCount:whereClause];
    //NSLog(@"getCount:%ld",(long)count);
    
    //getJson
    //NSString *ID = @"12";
    //userJson = [blSyncUser getJson:ID];
    //NSLog(@"getJson:%@",[userJson toJsonStr]);
    
    //select
    /*NSString *whereClause = @"1=1";
     NSArray *result = [blSyncUser select:whereClause];
     for(NSDictionary *record in result)
     {
     UserJson *json = [UserJson getJson:record];
     NSLog(@"%@",[json toJsonStr]);
     }*/
    
    //delete
    //NSString *whereClause = @"ID=12";
    //BOOL flag = [blSyncUser delete:whereClause];
    //NSLog(@"delete:%d",flag);
    
    //deleteByID
    //NSString *ID = @"13";
    //BOOL flag = [blSyncUser deleteByID:ID];
    //NSLog(@"deleteByID:%d",flag);
}

- (void)setRepresentedObject:(id)representedObject {
    [super setRepresentedObject:representedObject];

    // Update the view, if already loaded.
}

@end
