|
|
@@ -767,17 +767,98 @@
|
|
|
UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Add Models To Cart"];
|
|
|
|
|
|
|
|
|
- dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
|
|
+ if (self.addAll) {
|
|
|
+ AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
|
|
|
|
|
|
- NSDictionary* return_json = nil;
|
|
|
- if (self.addAll) {
|
|
|
- AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
|
|
|
- return_json = [RANetwork Category_addall:self.categoryid customid:0 price_template:0 sort:0 filter:nil keyword:nil offset:self.offset limit:20 alert:self.p_alert qty:self.p_QTY available:self.p_available price:self.p_price bestseller:self.p_bestseller modelname:self.modelname modeldescrip:self.modeldescrip orderCode:appDelegate.order_code addTo:@"cart"];
|
|
|
- } else {
|
|
|
- return_json = [RANetwork add_toCart_byName:ids withScreen:ScreenCodeCategory];
|
|
|
- }
|
|
|
+ [RANetwork request_addall_category:self.categoryid customid:0 price_template:0 sort:0 filter:nil keyword:nil offset:self.offset limit:20 alert:self.p_alert qty:self.p_QTY available:self.p_available price:self.p_price bestseller:self.p_bestseller modelname:self.modelname modeldescrip:self.modeldescrip orderCode:appDelegate.order_code addTo:@"cart" completionHandler:^(NSMutableDictionary *result) {
|
|
|
+
|
|
|
+ NSDictionary* return_json = result;
|
|
|
+
|
|
|
+ [waitalert dismissViewControllerAnimated:YES completion:nil];
|
|
|
+ self.addCartBtn.enabled = true;
|
|
|
+
|
|
|
+ if([[return_json valueForKey:@"result"] intValue]==2)
|
|
|
+ {
|
|
|
+ int result=[[return_json valueForKey:@"result"] intValue];
|
|
|
+ if(result==2)
|
|
|
+ {
|
|
|
+ //successed.
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ // NSString* order_code = [return_json valueForKey:@"order_code"];
|
|
|
+
|
|
|
+ // appDelegate.order_code = order_code;
|
|
|
+
|
|
|
+#ifdef RA_NOTIFICATION
|
|
|
+ [ActiveViewController Notify:@"CartViewController,OrderListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
|
|
|
+#else
|
|
|
+ AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
|
|
|
+
|
|
|
+ [((MainViewController*)appDelegate.main_vc) reloadCart:true immediately:false];
|
|
|
+ [((MainViewController*)appDelegate.main_vc) reloadOrder:true immediately:false];
|
|
|
+#endif
|
|
|
+ NSString * msg = nil;
|
|
|
+ if (self.addAll) {
|
|
|
+
|
|
|
+ unsigned long checkedCount = [return_json[@"count"] integerValue];
|
|
|
+
|
|
|
+ msg=[NSString stringWithFormat:@"%lu items added to Cart",checkedCount];
|
|
|
+ } else {
|
|
|
+
|
|
|
+ if(checked.count==1)
|
|
|
+ {
|
|
|
+ msg=@"1 item added to Cart";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ msg=[NSString stringWithFormat:@"%lu items added to Cart",(unsigned long)checked.count];
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ [RAUtils message_alert:nil title:msg controller:self] ;
|
|
|
+
|
|
|
+ [self end_select:2];
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if([[return_json valueForKey:@"result"] intValue]==8)
|
|
|
+ {
|
|
|
+
|
|
|
+
|
|
|
+#ifdef RA_NOTIFICATION
|
|
|
+ [ActiveViewController Notify:@"CartViewController,OrderListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
|
|
|
+#else
|
|
|
+ AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
|
|
|
+ // appDelegate.order_code = order_code;
|
|
|
+ [((MainViewController*)appDelegate.main_vc) reloadCart:true immediately:false];
|
|
|
+ [((MainViewController*)appDelegate.main_vc) reloadOrder:true immediately:false];
|
|
|
+#endif
|
|
|
+
|
|
|
+ [self end_select:2];
|
|
|
+ [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Add To Cart" controller:self] ;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Add To Cart" controller:self] ;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }];
|
|
|
|
|
|
- dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
+
|
|
|
+ } else {
|
|
|
+ [RANetwork request_addto_cart_byname:ids withScreen:ScreenCodeCategory completionHandler:^(NSMutableDictionary *result) {
|
|
|
+
|
|
|
+ NSDictionary* return_json = result;
|
|
|
|
|
|
[waitalert dismissViewControllerAnimated:YES completion:nil];
|
|
|
self.addCartBtn.enabled = true;
|
|
|
@@ -793,7 +874,7 @@
|
|
|
|
|
|
|
|
|
// NSString* order_code = [return_json valueForKey:@"order_code"];
|
|
|
-
|
|
|
+
|
|
|
// appDelegate.order_code = order_code;
|
|
|
|
|
|
#ifdef RA_NOTIFICATION
|
|
|
@@ -809,7 +890,7 @@
|
|
|
|
|
|
unsigned long checkedCount = [return_json[@"count"] integerValue];
|
|
|
|
|
|
- msg=[NSString stringWithFormat:@"%lu items added to Cart",checkedCount];
|
|
|
+ msg=[NSString stringWithFormat:@"%lu items added to Cart",checkedCount];
|
|
|
} else {
|
|
|
|
|
|
if(checked.count==1)
|
|
|
@@ -820,7 +901,7 @@
|
|
|
{
|
|
|
msg=[NSString stringWithFormat:@"%lu items added to Cart",(unsigned long)checked.count];
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
|
|
|
}
|
|
|
[RAUtils message_alert:nil title:msg controller:self] ;
|
|
|
@@ -833,7 +914,7 @@
|
|
|
}
|
|
|
else if([[return_json valueForKey:@"result"] intValue]==8)
|
|
|
{
|
|
|
-
|
|
|
+
|
|
|
|
|
|
#ifdef RA_NOTIFICATION
|
|
|
[ActiveViewController Notify:@"CartViewController,OrderListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
|
|
|
@@ -855,8 +936,104 @@
|
|
|
|
|
|
|
|
|
|
|
|
- });
|
|
|
- });
|
|
|
+
|
|
|
+
|
|
|
+ }];
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+// dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
|
|
+//
|
|
|
+// NSDictionary* return_json = nil;
|
|
|
+// if (self.addAll) {
|
|
|
+// AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
|
|
|
+// return_json = [RANetwork Category_addall:self.categoryid customid:0 price_template:0 sort:0 filter:nil keyword:nil offset:self.offset limit:20 alert:self.p_alert qty:self.p_QTY available:self.p_available price:self.p_price bestseller:self.p_bestseller modelname:self.modelname modeldescrip:self.modeldescrip orderCode:appDelegate.order_code addTo:@"cart"];
|
|
|
+// } else {
|
|
|
+// return_json = [RANetwork add_toCart_byName:ids withScreen:ScreenCodeCategory];
|
|
|
+// }
|
|
|
+//
|
|
|
+// dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
+//
|
|
|
+// [waitalert dismissViewControllerAnimated:YES completion:nil];
|
|
|
+// self.addCartBtn.enabled = true;
|
|
|
+//
|
|
|
+// if([[return_json valueForKey:@"result"] intValue]==2)
|
|
|
+// {
|
|
|
+// int result=[[return_json valueForKey:@"result"] intValue];
|
|
|
+// if(result==2)
|
|
|
+// {
|
|
|
+// //successed.
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+// // NSString* order_code = [return_json valueForKey:@"order_code"];
|
|
|
+//
|
|
|
+// // appDelegate.order_code = order_code;
|
|
|
+//
|
|
|
+//#ifdef RA_NOTIFICATION
|
|
|
+// [ActiveViewController Notify:@"CartViewController,OrderListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
|
|
|
+//#else
|
|
|
+// AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
|
|
|
+//
|
|
|
+// [((MainViewController*)appDelegate.main_vc) reloadCart:true immediately:false];
|
|
|
+// [((MainViewController*)appDelegate.main_vc) reloadOrder:true immediately:false];
|
|
|
+//#endif
|
|
|
+// NSString * msg = nil;
|
|
|
+// if (self.addAll) {
|
|
|
+//
|
|
|
+// unsigned long checkedCount = [return_json[@"count"] integerValue];
|
|
|
+//
|
|
|
+// msg=[NSString stringWithFormat:@"%lu items added to Cart",checkedCount];
|
|
|
+// } else {
|
|
|
+//
|
|
|
+// if(checked.count==1)
|
|
|
+// {
|
|
|
+// msg=@"1 item added to Cart";
|
|
|
+// }
|
|
|
+// else
|
|
|
+// {
|
|
|
+// msg=[NSString stringWithFormat:@"%lu items added to Cart",(unsigned long)checked.count];
|
|
|
+// }
|
|
|
+//
|
|
|
+//
|
|
|
+// }
|
|
|
+// [RAUtils message_alert:nil title:msg controller:self] ;
|
|
|
+//
|
|
|
+// [self end_select:2];
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+// }
|
|
|
+// }
|
|
|
+// else if([[return_json valueForKey:@"result"] intValue]==8)
|
|
|
+// {
|
|
|
+//
|
|
|
+//
|
|
|
+//#ifdef RA_NOTIFICATION
|
|
|
+// [ActiveViewController Notify:@"CartViewController,OrderListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
|
|
|
+//#else
|
|
|
+// AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
|
|
|
+// // appDelegate.order_code = order_code;
|
|
|
+// [((MainViewController*)appDelegate.main_vc) reloadCart:true immediately:false];
|
|
|
+// [((MainViewController*)appDelegate.main_vc) reloadOrder:true immediately:false];
|
|
|
+//#endif
|
|
|
+//
|
|
|
+// [self end_select:2];
|
|
|
+// [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Add To Cart" controller:self] ;
|
|
|
+// }
|
|
|
+// else
|
|
|
+// {
|
|
|
+// [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Add To Cart" controller:self] ;
|
|
|
+// }
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+// });
|
|
|
+// });
|
|
|
}
|
|
|
-(void) addtoportfolio
|
|
|
{
|
|
|
@@ -906,73 +1083,195 @@
|
|
|
|
|
|
UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Add Models To Portfolio"];
|
|
|
|
|
|
-
|
|
|
- dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
|
|
-
|
|
|
- NSDictionary* return_json = nil;
|
|
|
- if (self.addAll) {
|
|
|
-// AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
|
|
|
- return_json = [RANetwork Category_addall:self.categoryid customid:0 price_template:0 sort:0 filter:nil keyword:nil offset:self.offset limit:20 alert:self.p_alert qty:self.p_QTY available:self.p_available price:self.p_price bestseller:self.p_bestseller modelname:self.modelname modeldescrip:self.modeldescrip orderCode:nil addTo:@"portfolio"];
|
|
|
- } else {
|
|
|
- return_json = [RANetwork add_toPortfolio:ids withScreen:ScreenCodeCategory];
|
|
|
- }
|
|
|
-
|
|
|
- dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
- [waitalert dismissViewControllerAnimated:YES completion:nil];
|
|
|
- self.addPortfolioBtn.enabled =true;
|
|
|
-
|
|
|
- if([[return_json valueForKey:@"result"] intValue]==2)
|
|
|
- {
|
|
|
- // int result=[[return_json valueForKey:@"result"] intValue];
|
|
|
- // if(result==2)
|
|
|
- // {
|
|
|
- // //successed.
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- #ifdef RA_NOTIFICATION
|
|
|
- [ActiveViewController Notify:@"PortfolioViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
|
|
|
- #else
|
|
|
- AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
|
|
|
- [((MainViewController*)appDelegate.main_vc) reloadPortfolio:true immediately:false];
|
|
|
- #endif
|
|
|
-
|
|
|
- NSString * msg = nil;
|
|
|
-
|
|
|
- if (self.addAll) {
|
|
|
+
|
|
|
+ if (self.addAll) {
|
|
|
+ // AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
|
|
|
+ [RANetwork request_addall_category:self.categoryid customid:0 price_template:0 sort:0 filter:nil keyword:nil offset:self.offset limit:20 alert:self.p_alert qty:self.p_QTY available:self.p_available price:self.p_price bestseller:self.p_bestseller modelname:self.modelname modeldescrip:self.modeldescrip orderCode:nil addTo:@"portfolio" completionHandler:^(NSMutableDictionary *result) {
|
|
|
|
|
|
- unsigned long checkedCount = [return_json[@"count"] integerValue];
|
|
|
+ NSDictionary* return_json = result;
|
|
|
+ [waitalert dismissViewControllerAnimated:YES completion:nil];
|
|
|
+ self.addPortfolioBtn.enabled =true;
|
|
|
|
|
|
- msg=[NSString stringWithFormat:@"%lu items added to Portfolio",checkedCount];
|
|
|
- } else {
|
|
|
-
|
|
|
- if(checked.count==1)
|
|
|
+ if([[return_json valueForKey:@"result"] intValue]==2)
|
|
|
{
|
|
|
- msg=@"1 item added to Portfolio";
|
|
|
+ // int result=[[return_json valueForKey:@"result"] intValue];
|
|
|
+ // if(result==2)
|
|
|
+ // {
|
|
|
+ // //successed.
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ #ifdef RA_NOTIFICATION
|
|
|
+ [ActiveViewController Notify:@"PortfolioViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
|
|
|
+ #else
|
|
|
+ AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
|
|
|
+ [((MainViewController*)appDelegate.main_vc) reloadPortfolio:true immediately:false];
|
|
|
+ #endif
|
|
|
+
|
|
|
+ NSString * msg = nil;
|
|
|
+
|
|
|
+ if (self.addAll) {
|
|
|
+
|
|
|
+ unsigned long checkedCount = [return_json[@"count"] integerValue];
|
|
|
+
|
|
|
+ msg=[NSString stringWithFormat:@"%lu items added to Portfolio",checkedCount];
|
|
|
+ } else {
|
|
|
+
|
|
|
+ if(checked.count==1)
|
|
|
+ {
|
|
|
+ msg=@"1 item added to Portfolio";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ msg=[NSString stringWithFormat:@"%lu items added to Portfolio",(unsigned long)checked.count];
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ [RAUtils message_alert:nil title:msg controller:self] ;
|
|
|
+
|
|
|
+
|
|
|
+ [self end_select:3 ];
|
|
|
+
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- msg=[NSString stringWithFormat:@"%lu items added to Portfolio",(unsigned long)checked.count];
|
|
|
+ [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Add To Portfolio" controller:self] ;
|
|
|
}
|
|
|
- }
|
|
|
-
|
|
|
- [RAUtils message_alert:nil title:msg controller:self] ;
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }];
|
|
|
|
|
|
- [self end_select:3 ];
|
|
|
|
|
|
+ } else {
|
|
|
+ [RANetwork request_addto_portfolio:ids withScreen:ScreenCodeCategory completionHandler:^(NSMutableDictionary *result) {
|
|
|
+
|
|
|
+ NSDictionary* return_json = result;
|
|
|
+ [waitalert dismissViewControllerAnimated:YES completion:nil];
|
|
|
+ self.addPortfolioBtn.enabled =true;
|
|
|
+
|
|
|
+ if([[return_json valueForKey:@"result"] intValue]==2)
|
|
|
+ {
|
|
|
+ // int result=[[return_json valueForKey:@"result"] intValue];
|
|
|
+ // if(result==2)
|
|
|
+ // {
|
|
|
+ // //successed.
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ #ifdef RA_NOTIFICATION
|
|
|
+ [ActiveViewController Notify:@"PortfolioViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
|
|
|
+ #else
|
|
|
+ AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
|
|
|
+ [((MainViewController*)appDelegate.main_vc) reloadPortfolio:true immediately:false];
|
|
|
+ #endif
|
|
|
+
|
|
|
+ NSString * msg = nil;
|
|
|
+
|
|
|
+ if (self.addAll) {
|
|
|
+
|
|
|
+ unsigned long checkedCount = [return_json[@"count"] integerValue];
|
|
|
+
|
|
|
+ msg=[NSString stringWithFormat:@"%lu items added to Portfolio",checkedCount];
|
|
|
+ } else {
|
|
|
+
|
|
|
+ if(checked.count==1)
|
|
|
+ {
|
|
|
+ msg=@"1 item added to Portfolio";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ msg=[NSString stringWithFormat:@"%lu items added to Portfolio",(unsigned long)checked.count];
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ [RAUtils message_alert:nil title:msg controller:self] ;
|
|
|
+
|
|
|
+
|
|
|
+ [self end_select:3 ];
|
|
|
+
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Add To Portfolio" controller:self] ;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }];
|
|
|
+
|
|
|
}
|
|
|
- else
|
|
|
- {
|
|
|
- [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Add To Portfolio" controller:self] ;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- });
|
|
|
- });
|
|
|
+
|
|
|
+// dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
|
|
+//
|
|
|
+// NSDictionary* return_json = nil;
|
|
|
+// if (self.addAll) {
|
|
|
+//// AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
|
|
|
+// return_json = [RANetwork Category_addall:self.categoryid customid:0 price_template:0 sort:0 filter:nil keyword:nil offset:self.offset limit:20 alert:self.p_alert qty:self.p_QTY available:self.p_available price:self.p_price bestseller:self.p_bestseller modelname:self.modelname modeldescrip:self.modeldescrip orderCode:nil addTo:@"portfolio"];
|
|
|
+// } else {
|
|
|
+// return_json = [RANetwork add_toPortfolio:ids withScreen:ScreenCodeCategory];
|
|
|
+// }
|
|
|
+//
|
|
|
+// dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
+// [waitalert dismissViewControllerAnimated:YES completion:nil];
|
|
|
+// self.addPortfolioBtn.enabled =true;
|
|
|
+//
|
|
|
+// if([[return_json valueForKey:@"result"] intValue]==2)
|
|
|
+// {
|
|
|
+// // int result=[[return_json valueForKey:@"result"] intValue];
|
|
|
+// // if(result==2)
|
|
|
+// // {
|
|
|
+// // //successed.
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+// #ifdef RA_NOTIFICATION
|
|
|
+// [ActiveViewController Notify:@"PortfolioViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
|
|
|
+// #else
|
|
|
+// AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
|
|
|
+// [((MainViewController*)appDelegate.main_vc) reloadPortfolio:true immediately:false];
|
|
|
+// #endif
|
|
|
+//
|
|
|
+// NSString * msg = nil;
|
|
|
+//
|
|
|
+// if (self.addAll) {
|
|
|
+//
|
|
|
+// unsigned long checkedCount = [return_json[@"count"] integerValue];
|
|
|
+//
|
|
|
+// msg=[NSString stringWithFormat:@"%lu items added to Portfolio",checkedCount];
|
|
|
+// } else {
|
|
|
+//
|
|
|
+// if(checked.count==1)
|
|
|
+// {
|
|
|
+// msg=@"1 item added to Portfolio";
|
|
|
+// }
|
|
|
+// else
|
|
|
+// {
|
|
|
+// msg=[NSString stringWithFormat:@"%lu items added to Portfolio",(unsigned long)checked.count];
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// [RAUtils message_alert:nil title:msg controller:self] ;
|
|
|
+//
|
|
|
+//
|
|
|
+// [self end_select:3 ];
|
|
|
+//
|
|
|
+// }
|
|
|
+// else
|
|
|
+// {
|
|
|
+// [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Add To Portfolio" controller:self] ;
|
|
|
+// }
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+// });
|
|
|
+// });
|
|
|
}
|
|
|
-(void) addtowish
|
|
|
{
|
|
|
@@ -1009,21 +1308,10 @@
|
|
|
|
|
|
UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Add Models To Wish List"];
|
|
|
|
|
|
-
|
|
|
-
|
|
|
- dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
|
|
-
|
|
|
-
|
|
|
- NSDictionary* return_json = nil;
|
|
|
- if (self.addAll) {
|
|
|
- return_json = [RANetwork Category_addall:self.categoryid customid:0 price_template:0 sort:0 filter:nil keyword:nil offset:self.offset limit:20 alert:self.p_alert qty:self.p_QTY available:self.p_available price:self.p_price bestseller:self.p_bestseller modelname:self.modelname modeldescrip:self.modeldescrip orderCode:nil addTo:@"wishlist"];
|
|
|
- } else {
|
|
|
- return_json = [RANetwork add_toWatchList:ids withScreen:ScreenCodeCategory];
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
+ if (self.addAll) {
|
|
|
|
|
|
- dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
+ [RANetwork request_addall_category:self.categoryid customid:0 price_template:0 sort:0 filter:nil keyword:nil offset:self.offset limit:20 alert:self.p_alert qty:self.p_QTY available:self.p_available price:self.p_price bestseller:self.p_bestseller modelname:self.modelname modeldescrip:self.modeldescrip orderCode:nil addTo:@"wishlist" completionHandler:^(NSMutableDictionary *result) {
|
|
|
+ NSDictionary* return_json = result;
|
|
|
[waitalert dismissViewControllerAnimated:YES completion:nil];
|
|
|
self.addWishBtn.enabled =true;
|
|
|
|
|
|
@@ -1033,7 +1321,7 @@
|
|
|
//successed.
|
|
|
|
|
|
// NSString* order_code = [return_json valueForKey:@"order_code"];
|
|
|
-
|
|
|
+
|
|
|
|
|
|
#ifdef RA_NOTIFICATION
|
|
|
[ActiveViewController Notify:@"WatchListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
|
|
|
@@ -1051,7 +1339,7 @@
|
|
|
|
|
|
msg=[NSString stringWithFormat:@"%lu items added to \nWish List",checkedCount];
|
|
|
} else {
|
|
|
-
|
|
|
+
|
|
|
if(checked.count==1)
|
|
|
{
|
|
|
msg=@"1 item added to \nWish List";
|
|
|
@@ -1077,8 +1365,140 @@
|
|
|
|
|
|
|
|
|
|
|
|
- });
|
|
|
- });
|
|
|
+ }];
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ } else {
|
|
|
+
|
|
|
+ [RANetwork request_addto_wishlist:ids withScreen:ScreenCodeCategory completionHandler:^(NSMutableDictionary *result) {
|
|
|
+ NSDictionary* return_json = result;
|
|
|
+ [waitalert dismissViewControllerAnimated:YES completion:nil];
|
|
|
+ self.addWishBtn.enabled =true;
|
|
|
+
|
|
|
+ if([[return_json valueForKey:@"result"] intValue]==2)
|
|
|
+ {
|
|
|
+
|
|
|
+ //successed.
|
|
|
+
|
|
|
+ // NSString* order_code = [return_json valueForKey:@"order_code"];
|
|
|
+
|
|
|
+
|
|
|
+ #ifdef RA_NOTIFICATION
|
|
|
+ [ActiveViewController Notify:@"WatchListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
|
|
|
+ #else
|
|
|
+ AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
|
|
|
+
|
|
|
+ [((MainViewController*)appDelegate.main_vc) reloadWish:true immediately:false];
|
|
|
+ #endif
|
|
|
+
|
|
|
+ NSString * msg = nil;
|
|
|
+
|
|
|
+ if (self.addAll) {
|
|
|
+
|
|
|
+ unsigned long checkedCount = [return_json[@"count"] integerValue];
|
|
|
+
|
|
|
+ msg=[NSString stringWithFormat:@"%lu items added to \nWish List",checkedCount];
|
|
|
+ } else {
|
|
|
+
|
|
|
+ if(checked.count==1)
|
|
|
+ {
|
|
|
+ msg=@"1 item added to \nWish List";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ msg=[NSString stringWithFormat:@"%lu items added to \nWish List",(unsigned long)checked.count];
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ [RAUtils message_alert:nil title:msg controller:self] ;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ [self end_select:1];
|
|
|
+
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Add To Wish List" controller:self] ;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }];
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+// dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
|
|
+//
|
|
|
+//
|
|
|
+// NSDictionary* return_json = nil;
|
|
|
+// if (self.addAll) {
|
|
|
+// return_json = [RANetwork Category_addall:self.categoryid customid:0 price_template:0 sort:0 filter:nil keyword:nil offset:self.offset limit:20 alert:self.p_alert qty:self.p_QTY available:self.p_available price:self.p_price bestseller:self.p_bestseller modelname:self.modelname modeldescrip:self.modeldescrip orderCode:nil addTo:@"wishlist"];
|
|
|
+// } else {
|
|
|
+// return_json = [RANetwork add_toWatchList:ids withScreen:ScreenCodeCategory];
|
|
|
+// }
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+// dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
+// [waitalert dismissViewControllerAnimated:YES completion:nil];
|
|
|
+// self.addWishBtn.enabled =true;
|
|
|
+//
|
|
|
+// if([[return_json valueForKey:@"result"] intValue]==2)
|
|
|
+// {
|
|
|
+//
|
|
|
+// //successed.
|
|
|
+//
|
|
|
+// // NSString* order_code = [return_json valueForKey:@"order_code"];
|
|
|
+//
|
|
|
+//
|
|
|
+//#ifdef RA_NOTIFICATION
|
|
|
+// [ActiveViewController Notify:@"WatchListViewController" Message:RA_NOTIFICATION_RELOAD_DATA];
|
|
|
+//#else
|
|
|
+// AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
|
|
|
+//
|
|
|
+// [((MainViewController*)appDelegate.main_vc) reloadWish:true immediately:false];
|
|
|
+//#endif
|
|
|
+//
|
|
|
+// NSString * msg = nil;
|
|
|
+//
|
|
|
+// if (self.addAll) {
|
|
|
+//
|
|
|
+// unsigned long checkedCount = [return_json[@"count"] integerValue];
|
|
|
+//
|
|
|
+// msg=[NSString stringWithFormat:@"%lu items added to \nWish List",checkedCount];
|
|
|
+// } else {
|
|
|
+//
|
|
|
+// if(checked.count==1)
|
|
|
+// {
|
|
|
+// msg=@"1 item added to \nWish List";
|
|
|
+// }
|
|
|
+// else
|
|
|
+// {
|
|
|
+// msg=[NSString stringWithFormat:@"%lu items added to \nWish List",(unsigned long)checked.count];
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// [RAUtils message_alert:nil title:msg controller:self] ;
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+// [self end_select:1];
|
|
|
+//
|
|
|
+// }
|
|
|
+// else
|
|
|
+// {
|
|
|
+// [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Add To Wish List" controller:self] ;
|
|
|
+// }
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+// });
|
|
|
+// });
|
|
|
}
|
|
|
#pragma mark get data
|
|
|
-(void)operation_loadMore
|