|
|
@@ -51,7 +51,7 @@
|
|
|
|
|
|
|
|
|
NSString* sqlQuery = [NSString stringWithFormat:@"delete from wishlist where _id in (%@);",collectId];
|
|
|
- [iSalesDB execSql:sqlQuery];
|
|
|
+ [iSalesDB execSql:sqlQuery db:db];
|
|
|
int count=[iSalesDB get_recordcount:db table:@"wishlist" where:@"1=1"];
|
|
|
[iSalesDB close_db:db];
|
|
|
|
|
|
@@ -82,7 +82,7 @@
|
|
|
if(count==0)
|
|
|
{
|
|
|
NSString* sqlQuery = [NSString stringWithFormat:@"insert into wishlist(product_id) values('%@');",arr[i]];
|
|
|
- [iSalesDB execSql:sqlQuery];
|
|
|
+ [iSalesDB execSql:sqlQuery db:db];
|
|
|
}
|
|
|
}
|
|
|
int count=[iSalesDB get_recordcount:db table:@"wishlist" where:@"1=1"];
|
|
|
@@ -139,7 +139,7 @@
|
|
|
int item_id = sqlite3_column_double(statement, 2);
|
|
|
|
|
|
|
|
|
- NSString *nsurl=[self model_category_img:[NSString stringWithFormat:@"%@",[NSNumber numberWithInt:product_id]] model_name:nil];
|
|
|
+ NSString *nsurl=[self model_category_img:[NSString stringWithFormat:@"%@",[NSNumber numberWithInt:product_id]] model_name:nil db:db];
|
|
|
|
|
|
// char *url = (char*)sqlite3_column_text(statement, 3);
|
|
|
// if(url==nil)
|
|
|
@@ -237,20 +237,23 @@
|
|
|
|
|
|
[ret setValue:@"2" forKey:@"result"];
|
|
|
[ret setValue:@"Regular Mode" forKey:@"mode"];
|
|
|
- NSMutableDictionary* detail1_section = [[self model_NIYMAL:category] mutableCopy];
|
|
|
+ sqlite3* db= [iSalesDB get_db];
|
|
|
+ NSMutableDictionary* detail1_section = [[self model_NIYMAL:category db:db] mutableCopy];
|
|
|
+
|
|
|
+ [iSalesDB close_db:db];
|
|
|
|
|
|
[ret setObject:detail1_section forKey:@"detail_1"];
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
|
-+(NSMutableDictionary*) get_model_all_price:(NSString*) contact_id product_id:(int) product_id
|
|
|
++(NSMutableDictionary*) get_model_all_price:(NSString*) contact_id product_id:(int) product_id db:(sqlite3*)db
|
|
|
{
|
|
|
|
|
|
UIApplication * app = [UIApplication sharedApplication];
|
|
|
AppDelegate *appDelegate = (AppDelegate *)[app delegate];
|
|
|
|
|
|
// NSArray* arr1 = [self get_user_all_price_type];
|
|
|
- NSArray* arr2 = [self get_contact_default_price_type:contact_id];
|
|
|
+ NSArray* arr2 = [self get_contact_default_price_type:contact_id db:db];
|
|
|
|
|
|
// NSSet *set1 = [NSSet setWithArray:arr1];
|
|
|
// NSMutableSet *set2 = [[NSSet setWithArray:arr2] mutableCopy];
|
|
|
@@ -266,7 +269,7 @@
|
|
|
NSString* whereprice=[RAUtils arr2string:arr2 separator:@"," trim:true brackets:@"'"];
|
|
|
|
|
|
|
|
|
- sqlite3 *db = [iSalesDB get_db];
|
|
|
+ // sqlite3 *db = [iSalesDB get_db];
|
|
|
|
|
|
NSString* sqlQuery = nil;
|
|
|
if(appDelegate.contact_id==nil)
|
|
|
@@ -339,15 +342,15 @@
|
|
|
|
|
|
}
|
|
|
|
|
|
- [iSalesDB close_db:db];
|
|
|
+ // [iSalesDB close_db:db];
|
|
|
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
|
-+(NSNumber*) get_model_default_price:(NSString*) contact_id product_id:(int) product_id
|
|
|
++(NSNumber*) get_model_default_price:(NSString*) contact_id product_id:(int) product_id db:(sqlite3*)db
|
|
|
{
|
|
|
- NSArray* arr1 = [self get_user_all_price_type];
|
|
|
- NSArray* arr2 = [self get_contact_default_price_type:contact_id];
|
|
|
+ NSArray* arr1 = [self get_user_all_price_type:db];
|
|
|
+ NSArray* arr2 = [self get_contact_default_price_type:contact_id db:db];
|
|
|
|
|
|
// NSSet *set1 = [NSSet setWithArray:arr1];
|
|
|
// NSMutableSet *set2 = [[NSSet setWithArray:arr2] mutableCopy];
|
|
|
@@ -363,7 +366,7 @@
|
|
|
whereprice=[RAUtils arr2string:arr2 separator:@"," trim:true brackets:@"'"];
|
|
|
|
|
|
|
|
|
- sqlite3 *db = [iSalesDB get_db];
|
|
|
+ // sqlite3 *db = [iSalesDB get_db];
|
|
|
|
|
|
NSString* sqlQuery = [NSString stringWithFormat:@"select price from model_price where product_id='%d' and price_name in(%@);",product_id,whereprice];
|
|
|
sqlite3_stmt * statement;
|
|
|
@@ -403,7 +406,7 @@
|
|
|
|
|
|
}
|
|
|
|
|
|
- [iSalesDB close_db:db];
|
|
|
+ // [iSalesDB close_db:db];
|
|
|
|
|
|
if(dprice==DBL_MAX)
|
|
|
ret= nil;
|
|
|
@@ -412,12 +415,12 @@
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
|
-+(NSArray*) get_user_all_price_type
|
|
|
++(NSArray*) get_user_all_price_type:(sqlite3*)db
|
|
|
{
|
|
|
|
|
|
NSArray* ret=nil;
|
|
|
|
|
|
- sqlite3 *db = [iSalesDB get_db];
|
|
|
+ // sqlite3 *db = [iSalesDB get_db];
|
|
|
// no customer assigned , use login user contact_id
|
|
|
|
|
|
UIApplication * app = [UIApplication sharedApplication];
|
|
|
@@ -455,17 +458,17 @@
|
|
|
|
|
|
}
|
|
|
|
|
|
- [iSalesDB close_db:db];
|
|
|
+ // [iSalesDB close_db:db];
|
|
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
-+(NSArray*) get_contact_default_price_type:(NSString*) contact_id
|
|
|
++(NSArray*) get_contact_default_price_type:(NSString*) contact_id db:(sqlite3*)db
|
|
|
{
|
|
|
|
|
|
- sqlite3 *db = [iSalesDB get_db];
|
|
|
+ // sqlite3 *db = [iSalesDB get_db];
|
|
|
if(contact_id==nil)
|
|
|
{
|
|
|
// no customer assigned , use login user contact_id
|
|
|
@@ -507,7 +510,7 @@
|
|
|
|
|
|
if(contact_id.length<=0)
|
|
|
{
|
|
|
- [iSalesDB close_db:db];
|
|
|
+ // [iSalesDB close_db:db];
|
|
|
return nil;
|
|
|
}
|
|
|
|
|
|
@@ -545,20 +548,20 @@
|
|
|
sqlite3_finalize(statement);
|
|
|
}
|
|
|
|
|
|
- [iSalesDB close_db:db];
|
|
|
+ // [iSalesDB close_db:db];
|
|
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
|
}
|
|
|
-+(NSString*) model_category_img :(NSString *) product_id model_name:(NSString *) model_name
|
|
|
++(NSString*) model_category_img :(NSString *) product_id model_name:(NSString *) model_name db:(sqlite3*)db
|
|
|
{
|
|
|
|
|
|
|
|
|
NSString* ret= nil;
|
|
|
|
|
|
|
|
|
- sqlite3 *db = [iSalesDB get_db];
|
|
|
+ // sqlite3 *db = [iSalesDB get_db];
|
|
|
|
|
|
|
|
|
NSString *sqlQuery = nil;
|
|
|
@@ -600,7 +603,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
- [iSalesDB close_db:db];
|
|
|
+ // [iSalesDB close_db:db];
|
|
|
DebugLog(@"data string: %@",ret );
|
|
|
|
|
|
|
|
|
@@ -846,12 +849,12 @@
|
|
|
|
|
|
NSMutableDictionary* img_section = [[NSMutableDictionary alloc] init];
|
|
|
|
|
|
- NSString* model_s_img = [self model_category_img:[NSString stringWithFormat:@"%d",product_id] model_name:model_name];
|
|
|
+ NSString* model_s_img = [self model_category_img:[NSString stringWithFormat:@"%d",product_id] model_name:model_name db:db];
|
|
|
|
|
|
[img_section setValue:model_s_img forKey:@"model_s_img"];
|
|
|
- [img_section setObject:[self model_img:product_id] forKey:@"images"];
|
|
|
- [img_section setObject:[self model_property:product_id field:nsproperty_field] forKey:@"property"];
|
|
|
- [img_section setObject:[self model_selector:nsproduct_group field:nsselector_field] forKey:@"selector"];
|
|
|
+ [img_section setObject:[self model_img:product_id db:db] forKey:@"images"];
|
|
|
+ [img_section setObject:[self model_property:product_id field:nsproperty_field db:db] forKey:@"property"];
|
|
|
+ [img_section setObject:[self model_selector:nsproduct_group field:nsselector_field db:db] forKey:@"selector"];
|
|
|
|
|
|
|
|
|
NSString* Availability=nil;
|
|
|
@@ -871,7 +874,7 @@
|
|
|
Price=@"Must Sign in.";
|
|
|
else
|
|
|
{
|
|
|
- NSNumber* price= [self get_model_default_price:appDelegate.contact_id product_id:product_id];
|
|
|
+ NSNumber* price= [self get_model_default_price:appDelegate.contact_id product_id:product_id db:db];
|
|
|
if(price==nil)
|
|
|
Price=@"No Price.";
|
|
|
else
|
|
|
@@ -902,7 +905,7 @@
|
|
|
[detail0_section setObject:[self model_kvItem:@"Packaging" value:nspackaging] forKey:[NSString stringWithFormat:@"item_%d",detail0_item_count++]];
|
|
|
|
|
|
|
|
|
- NSDictionary* pricejson=[self get_model_all_price:appDelegate.contact_id product_id:product_id];
|
|
|
+ NSDictionary* pricejson=[self get_model_all_price:appDelegate.contact_id product_id:product_id db:db];
|
|
|
for(int l=0;l<[pricejson[@"count"] intValue];l++)
|
|
|
{
|
|
|
NSDictionary* price_item = pricejson[[NSString stringWithFormat:@"item_%d",l]];
|
|
|
@@ -919,7 +922,7 @@
|
|
|
[ret setObject:detail0_section forKey:@"detail_0"];
|
|
|
|
|
|
|
|
|
- NSMutableDictionary* detail1_section = [[self model_NIYMAL:category] mutableCopy];
|
|
|
+ NSMutableDictionary* detail1_section = [[self model_NIYMAL:category db:db] mutableCopy];
|
|
|
// [detail1_section setValue:@"detail" forKey:@"target"];
|
|
|
// [detail1_section setValue:@"popup" forKey:@"action"];
|
|
|
// [detail1_section setValue:@"content" forKey:@"type"];
|
|
|
@@ -1032,7 +1035,7 @@
|
|
|
int wid = sqlite3_column_int(statement, 3);
|
|
|
int closeout = sqlite3_column_int(statement, 4);
|
|
|
|
|
|
- NSMutableDictionary* imgjson=[self category_img:product_id];
|
|
|
+ NSMutableDictionary* imgjson=[self category_img:product_id db:db];
|
|
|
|
|
|
if(wid==0)
|
|
|
[item setValue:@"false" forKey:@"wish_exists"];
|
|
|
@@ -1176,7 +1179,7 @@
|
|
|
int wid = sqlite3_column_int(statement, 3);
|
|
|
int closeout = sqlite3_column_int(statement, 4);
|
|
|
|
|
|
- NSMutableDictionary* imgjson=[self category_img:product_id];
|
|
|
+ NSMutableDictionary* imgjson=[self category_img:product_id db:db];
|
|
|
|
|
|
if(wid==0)
|
|
|
[item setValue:@"false" forKey:@"wish_exists"];
|
|
|
@@ -2310,7 +2313,7 @@
|
|
|
|
|
|
return ret;
|
|
|
}
|
|
|
-+(NSDictionary*) model_NIYMAL:(NSString*) category
|
|
|
++(NSDictionary*) model_NIYMAL:(NSString*) category db:(sqlite3 *)db
|
|
|
{
|
|
|
// MODEL DETAIL NEW ITEM YOU MAY ALSO LIKE
|
|
|
|
|
|
@@ -2331,7 +2334,7 @@
|
|
|
[ret setValue:@"true" forKey:@"single_row"];
|
|
|
[ret setValue:@"true" forKey:@"partial_refresh"];
|
|
|
|
|
|
- sqlite3 *db = [iSalesDB get_db];
|
|
|
+ // sqlite3 *db = [iSalesDB get_db];
|
|
|
|
|
|
// int count = [iSalesDB get_recordcount:db table:@"model" where:[NSString stringWithFormat:@"category like'#%%%@%%#'",category]];
|
|
|
|
|
|
@@ -2383,7 +2386,7 @@
|
|
|
NSLog(@"count:%d",count);
|
|
|
|
|
|
|
|
|
- [iSalesDB close_db:db];
|
|
|
+ // [iSalesDB close_db:db];
|
|
|
|
|
|
|
|
|
return ret;
|
|
|
@@ -2398,13 +2401,13 @@
|
|
|
[ret setValue:value forKey:@"val"];
|
|
|
return ret;
|
|
|
}
|
|
|
-+(NSDictionary*) model_property :(int)product_id field:(NSString*) field
|
|
|
++(NSDictionary*) model_property :(int)product_id field:(NSString*) field db:(sqlite3 *)db
|
|
|
{
|
|
|
NSMutableDictionary* ret = [[NSMutableDictionary alloc] init];
|
|
|
|
|
|
[ret setValue:@"0" forKey:@"img_count"];
|
|
|
|
|
|
- sqlite3 *db = [iSalesDB get_db];
|
|
|
+ // sqlite3 *db = [iSalesDB get_db];
|
|
|
|
|
|
|
|
|
|
|
|
@@ -2451,17 +2454,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
- [iSalesDB close_db:db];
|
|
|
+ // [iSalesDB close_db:db];
|
|
|
|
|
|
return ret;
|
|
|
}
|
|
|
-+(NSDictionary*) model_selector :(NSString*)product_group field:(NSString*) field
|
|
|
++(NSDictionary*) model_selector :(NSString*)product_group field:(NSString*) field db:(sqlite3*)db
|
|
|
{
|
|
|
NSMutableDictionary* ret = [[NSMutableDictionary alloc] init];
|
|
|
|
|
|
[ret setValue:@"0" forKey:@"count"];
|
|
|
|
|
|
- sqlite3 *db = [iSalesDB get_db];
|
|
|
+ // sqlite3 *db = [iSalesDB get_db];
|
|
|
|
|
|
|
|
|
|
|
|
@@ -2502,7 +2505,7 @@
|
|
|
category="";
|
|
|
NSString *nscategory = [[NSString alloc]initWithUTF8String:category];
|
|
|
|
|
|
- NSString* url = [self model_category_img:[NSNumber numberWithInt:product_id].stringValue model_name:nil];//[self category_img:product_id];
|
|
|
+ NSString* url = [self model_category_img:[NSNumber numberWithInt:product_id].stringValue model_name:nil db:db];//[self category_img:product_id];
|
|
|
|
|
|
[item setValue:nsvalue forKey:@"title"];
|
|
|
[item setValue:url forKey:@"pic_url"];
|
|
|
@@ -2540,18 +2543,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
- [iSalesDB close_db:db];
|
|
|
+ // [iSalesDB close_db:db];
|
|
|
|
|
|
return ret;
|
|
|
}
|
|
|
-+(NSMutableDictionary*) category_img :(int)product_id
|
|
|
++(NSMutableDictionary*) category_img :(int)product_id db:(sqlite3 *)db
|
|
|
{
|
|
|
// model 在 category search 显示的图片。
|
|
|
NSMutableDictionary* ret =[[NSMutableDictionary alloc]init];
|
|
|
|
|
|
|
|
|
|
|
|
- sqlite3 *db = [iSalesDB get_db];
|
|
|
+ // sqlite3 *db = [iSalesDB get_db];
|
|
|
|
|
|
|
|
|
NSString *sqlQuery = [NSString stringWithFormat:@"select url,type from model_image where product_id=%d and type<2 order by default_img desc , _id asc limit 2;",product_id];
|
|
|
@@ -2582,17 +2585,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
- [iSalesDB close_db:db];
|
|
|
+ // [iSalesDB close_db:db];
|
|
|
|
|
|
return ret;
|
|
|
}
|
|
|
-+(NSDictionary*) model_img :(int)product_id
|
|
|
++(NSDictionary*) model_img :(int)product_id db:(sqlite3*)db
|
|
|
{
|
|
|
NSMutableDictionary* ret = [[NSMutableDictionary alloc] init];
|
|
|
|
|
|
[ret setValue:@"0" forKey:@"img_count"];
|
|
|
|
|
|
- sqlite3 *db = [iSalesDB get_db];
|
|
|
+ // sqlite3 *db = [iSalesDB get_db];
|
|
|
|
|
|
|
|
|
|
|
|
@@ -2634,7 +2637,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
- [iSalesDB close_db:db];
|
|
|
+ // [iSalesDB close_db:db];
|
|
|
|
|
|
return ret;
|
|
|
}
|
|
|
@@ -3657,7 +3660,7 @@
|
|
|
int wid = sqlite3_column_int(statement, 3);
|
|
|
int closeout = sqlite3_column_int(statement, 4);
|
|
|
|
|
|
- NSMutableDictionary* imgjson=[self category_img:product_id];
|
|
|
+ NSMutableDictionary* imgjson=[self category_img:product_id db:db];
|
|
|
|
|
|
if(wid==0)
|
|
|
[item setValue:@"false" forKey:@"wish_exists"];
|