CartUtils.m 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758
  1. //
  2. // CartUtils.m
  3. // iSales-NPD
  4. //
  5. // Created by Ray on 12/26/16.
  6. // Copyright © 2016 United Software Applications, Inc. All rights reserved.
  7. //
  8. #import "CartUtils.h"
  9. #import "RAUtils.h"
  10. #import "AppDelegate.h"
  11. #import "iSalesNetwork.h"
  12. #import "LoginViewController.h"
  13. #import "MainViewController.h"
  14. @implementation CartUtils
  15. +(void) neworder:(UIViewController*) vc selectorholder:(id)holder selector:(SEL)addtocart
  16. {
  17. UIAlertView * waitalert = [RAUtils waiting_alert:@"Please wait" title:@"Create Order"];
  18. dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
  19. NSDictionary* return_json = [iSalesNetwork new_Order];
  20. dispatch_async(dispatch_get_main_queue(), ^{
  21. [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
  22. if([[return_json valueForKey:@"result"] intValue]==2)
  23. {
  24. int result=[[return_json valueForKey:@"result"] intValue];
  25. if(result==2)
  26. {
  27. //successed.
  28. NSString* order_code = [return_json valueForKey:@"orderCode"];
  29. AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
  30. appDelegate.order_code = order_code;
  31. appDelegate.order_status = [[return_json valueForKey:@"orderStatus"] intValue];
  32. [holder performSelector:addtocart];
  33. // [self ReloadData];
  34. // if(self.shopCartBlock!=nil)
  35. // {
  36. // UIImage* img=[self photoStackView:self.photoStack photoForIndex:0];
  37. //
  38. //
  39. // CGRect iv_rect = CGRectMake(self.btnaddCart.center.x-50, self.btnaddCart.center.y-50, 100, 100);
  40. // UIImageView* iv = [[UIImageView alloc] initWithFrame:iv_rect];
  41. // iv.image = img;
  42. // // [self.contentView addSubview:iv];
  43. // self.shopCartBlock(iv);
  44. //
  45. // }
  46. }
  47. }
  48. else
  49. {
  50. [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Create Order" controller:vc] ;
  51. }
  52. });
  53. });
  54. }
  55. +(void) add_to_cart:(UIViewController*) vc selectorholder:(id)holder selector:(SEL)addtocart
  56. {
  57. UIApplication * app = [UIApplication sharedApplication];
  58. AppDelegate *appDelegate = (AppDelegate *)[app delegate];
  59. MainViewController* main_vc=(MainViewController*)appDelegate.main_vc;
  60. if(appDelegate.bLogin==false)
  61. {
  62. LoginViewController * loginvc =[ vc.storyboard instantiateViewControllerWithIdentifier:@"LoginViewController"];
  63. loginvc.returnValue = ^(bool blogin){
  64. if(blogin)
  65. {
  66. if(/*appDelegate.user_type==USER_ROLE_EMPLOYEE*/ true)
  67. {
  68. [main_vc checklogin:YES];
  69. NSString* msg =@"";
  70. // if(appDelegate.contact_id.length>0)
  71. // {
  72. // msg = [msg stringByAppendingString:@"Customer:"];
  73. // msg = [msg stringByAppendingString:appDelegate.customerInfo[@"customer_name"]];
  74. //
  75. // }
  76. UIAlertController *alertControl = [UIAlertController alertControllerWithTitle:@"Add to cart" message:msg preferredStyle:UIAlertControllerStyleAlert];
  77. //block代码块取代了delegate
  78. UIAlertAction *actionOne = [UIAlertAction actionWithTitle:@"Check for saved order" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
  79. // vc.disable_refresh = true;
  80. OrderListViewController* ovc =[ vc.storyboard instantiateViewControllerWithIdentifier:@"OrderListViewController"];
  81. ovc.showNavibar = true;
  82. //ovc.customer_id = appDelegate.contact_id;
  83. ovc.selectOrder = ^(NSMutableDictionary* order_detail){
  84. [holder performSelector:addtocart];
  85. };
  86. ovc.init_style = OL_OPEN;
  87. ovc.onCancel = ^(){
  88. // self.disable_refresh = false;
  89. };
  90. [vc.navigationController pushViewController:ovc animated:true];
  91. }];
  92. UIAlertAction *alertthree = [UIAlertAction actionWithTitle:@"Create new order" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
  93. {
  94. //create new;
  95. // self.disable_refresh = true;
  96. if(appDelegate.customerInfo==nil)// select contact if current contact not exist
  97. {
  98. ContactListViewController* cvc = [vc.storyboard instantiateViewControllerWithIdentifier:@"ContactListViewController" ];
  99. cvc.showNavibar = true;
  100. cvc.contact_type = @"Sales_Order_Customer";
  101. cvc.returnValue = ^(NSMutableDictionary* value,NSIndexPath* source){
  102. appDelegate.contact_id=[value valueForKey:@"customer_cid"];
  103. appDelegate.customerInfo = value;
  104. if(appDelegate.order_code==nil)
  105. [self neworder:vc selectorholder:holder selector:addtocart];
  106. // neworder();
  107. // [main_vc checklogin:true];
  108. // [self handle_action_return:value indexPath:indexPath action:ACTION_FILL_SECTION];
  109. //
  110. // if(self.returnValue)
  111. // self.returnValue(value);
  112. };
  113. cvc.onCancel = ^(){
  114. [RAUtils message_alert:@"Cannot create order without cursomer infomation." title:@"New Order Error" controller:vc];
  115. // self.disable_refresh = false;
  116. };
  117. cvc.onReset = ^(){
  118. // [main_vc checklogin:true];
  119. };
  120. [vc.navigationController pushViewController:cvc animated:true];
  121. }
  122. else
  123. {
  124. [self neworder:vc selectorholder:holder selector:addtocart];
  125. }
  126. }
  127. DebugLog(@"No");
  128. }];
  129. [alertControl addAction:actionOne];
  130. [alertControl addAction:alertthree];
  131. UIAlertAction *alertcancel = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
  132. }];
  133. [alertControl addAction:alertcancel];
  134. //UIAlertControllerStyle类型为UIAlertControllerStyleAlert可以添加addTextFieldWithConfigurationHandler:^(UITextField *textField)
  135. [vc presentViewController:alertControl animated:YES completion:nil];
  136. }
  137. else
  138. {
  139. //customer login;
  140. [main_vc checklogin:false];
  141. //[self addtocart];
  142. [holder performSelector:addtocart];
  143. }
  144. }
  145. };
  146. UINavigationController* navi = [[UINavigationController alloc] initWithRootViewController:loginvc] ;
  147. // [self hackModalSheetSize:CGSizeMake(450, 200) ofVC:navi];
  148. navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
  149. [vc presentViewController:navi animated:YES completion:^{
  150. // navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);
  151. DebugLog(@"LoginViewController present.........");
  152. // self.btop = false;
  153. // <#code#>
  154. }];
  155. }
  156. else
  157. {
  158. if(/*appDelegate.user_type==USER_ROLE_EMPLOYEE&&/*appDelegate.contact_id==nil&&*/appDelegate.order_code==nil)
  159. {
  160. if(appDelegate.contact_id.length==0)
  161. {
  162. NSString* msg =@"";
  163. UIAlertController *alertControl = [UIAlertController alertControllerWithTitle:@"Add to cart" message:msg preferredStyle:UIAlertControllerStyleAlert];
  164. //block代码块取代了delegate
  165. UIAlertAction *actionOne = [UIAlertAction actionWithTitle:@"Check for saved order" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
  166. // vc.disable_refresh = true;
  167. OrderListViewController* ovc =[ vc.storyboard instantiateViewControllerWithIdentifier:@"OrderListViewController"];
  168. ovc.showNavibar = true;
  169. //ovc.customer_id = appDelegate.contact_id;
  170. ovc.selectOrder = ^(NSMutableDictionary* order_detail){
  171. [holder performSelector:addtocart];
  172. };
  173. ovc.init_style = OL_OPEN;
  174. ovc.onCancel = ^(){
  175. // self.disable_refresh = false;
  176. };
  177. [vc.navigationController pushViewController:ovc animated:true];
  178. }];
  179. UIAlertAction *alertthree = [UIAlertAction actionWithTitle:@"Create new order" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
  180. {
  181. //create new;
  182. // self.disable_refresh = true;
  183. if(appDelegate.customerInfo==nil)// select contact if current contact not exist
  184. {
  185. ContactListViewController* cvc = [vc.storyboard instantiateViewControllerWithIdentifier:@"ContactListViewController" ];
  186. cvc.showNavibar = true;
  187. cvc.contact_type = @"Sales_Order_Customer";
  188. cvc.returnValue = ^(NSMutableDictionary* value,NSIndexPath* source){
  189. appDelegate.contact_id=[value valueForKey:@"customer_cid"];
  190. appDelegate.customerInfo = value;
  191. if(appDelegate.order_code==nil)
  192. [self neworder:vc selectorholder:holder selector:addtocart];
  193. // neworder();
  194. // [main_vc checklogin:true];
  195. // [self handle_action_return:value indexPath:indexPath action:ACTION_FILL_SECTION];
  196. //
  197. // if(self.returnValue)
  198. // self.returnValue(value);
  199. };
  200. cvc.onCancel = ^(){
  201. [RAUtils message_alert:@"Cannot create order without cursomer infomation." title:@"New Order Error" controller:vc];
  202. // self.disable_refresh = false;
  203. };
  204. cvc.onReset = ^(){
  205. // [main_vc checklogin:true];
  206. };
  207. [vc.navigationController pushViewController:cvc animated:true];
  208. }
  209. else
  210. {
  211. [self neworder:vc selectorholder:holder selector:addtocart];
  212. }
  213. }
  214. DebugLog(@"No");
  215. }];
  216. [alertControl addAction:actionOne];
  217. [alertControl addAction:alertthree];
  218. UIAlertAction *alertcancel = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
  219. }];
  220. [alertControl addAction:alertcancel];
  221. //UIAlertControllerStyle类型为UIAlertControllerStyleAlert可以添加addTextFieldWithConfigurationHandler:^(UITextField *textField)
  222. [vc presentViewController:alertControl animated:YES completion:nil];
  223. }
  224. else
  225. {
  226. UIAlertView * waitalert = [RAUtils waiting_alert:@"Please wait..." title:@"Checking Pending Order"];
  227. dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
  228. NSDictionary* return_json = [iSalesNetwork request_PendingOrder:appDelegate.contact_id];
  229. dispatch_async(dispatch_get_main_queue(), ^{
  230. [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
  231. if([[return_json valueForKey:@"result"] intValue]==2)
  232. {
  233. bool openPendingOrder= [[return_json valueForKey:@"hasPending"] boolValue];
  234. bool createNewOrder=appDelegate.can_create_order;
  235. if(openPendingOrder&&createNewOrder)
  236. {
  237. NSString* msg =@"";
  238. if(appDelegate.contact_id.length>0)
  239. {
  240. msg = [msg stringByAppendingString:@"Customer:"];
  241. msg = [msg stringByAppendingString:appDelegate.customerInfo[@"customer_name"]];
  242. }
  243. UIAlertController *alertControl = [UIAlertController alertControllerWithTitle:@"Add to cart" message:msg preferredStyle:UIAlertControllerStyleAlert];
  244. //block代码块取代了delegate
  245. UIAlertAction *actionOne = [UIAlertAction actionWithTitle:@"Check for saved order" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
  246. // vc.disable_refresh = true;
  247. OrderListViewController* ovc =[ vc.storyboard instantiateViewControllerWithIdentifier:@"OrderListViewController"];
  248. ovc.showNavibar = true;
  249. ovc.customer_id = appDelegate.contact_id;
  250. ovc.selectOrder = ^(NSMutableDictionary* order_detail){
  251. [holder performSelector:addtocart];
  252. };
  253. ovc.init_style = OL_OPEN;
  254. ovc.onCancel = ^(){
  255. // self.disable_refresh = false;
  256. };
  257. [vc.navigationController pushViewController:ovc animated:true];
  258. }];
  259. UIAlertAction *alertthree = [UIAlertAction actionWithTitle:@"Create new order" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
  260. {
  261. //create new;
  262. // self.disable_refresh = true;
  263. if(appDelegate.customerInfo==nil)// select contact if current contact not exist
  264. {
  265. ContactListViewController* cvc = [vc.storyboard instantiateViewControllerWithIdentifier:@"ContactListViewController" ];
  266. cvc.showNavibar = true;
  267. cvc.contact_type = @"Sales_Order_Customer";
  268. cvc.returnValue = ^(NSMutableDictionary* value,NSIndexPath* source){
  269. appDelegate.contact_id=[value valueForKey:@"customer_cid"];
  270. appDelegate.customerInfo = value;
  271. if(appDelegate.order_code==nil)
  272. [self neworder:vc selectorholder:holder selector:addtocart];
  273. // neworder();
  274. // [main_vc checklogin:true];
  275. // [self handle_action_return:value indexPath:indexPath action:ACTION_FILL_SECTION];
  276. //
  277. // if(self.returnValue)
  278. // self.returnValue(value);
  279. };
  280. cvc.onCancel = ^(){
  281. [RAUtils message_alert:@"Cannot create order without cursomer infomation." title:@"New Order Error" controller:vc];
  282. // self.disable_refresh = false;
  283. };
  284. cvc.onReset = ^(){
  285. // [main_vc checklogin:true];
  286. };
  287. [vc.navigationController pushViewController:cvc animated:true];
  288. }
  289. else
  290. {
  291. [self neworder:vc selectorholder:holder selector:addtocart];
  292. }
  293. }
  294. DebugLog(@"No");
  295. }];
  296. [alertControl addAction:actionOne];
  297. [alertControl addAction:alertthree];
  298. UIAlertAction *alertcancel = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
  299. }];
  300. [alertControl addAction:alertcancel];
  301. //UIAlertControllerStyle类型为UIAlertControllerStyleAlert可以添加addTextFieldWithConfigurationHandler:^(UITextField *textField)
  302. [vc presentViewController:alertControl animated:YES completion:nil];
  303. }
  304. else
  305. {
  306. if(openPendingOrder)
  307. {
  308. NSString* msg =@"";
  309. if(appDelegate.contact_id.length>0)
  310. {
  311. msg = [msg stringByAppendingString:@"Customer:"];
  312. msg = [msg stringByAppendingString:appDelegate.customerInfo[@"customer_name"]];
  313. }
  314. UIAlertController *alertControl = [UIAlertController alertControllerWithTitle:@"Add to cart" message:msg preferredStyle:UIAlertControllerStyleAlert];
  315. //block代码块取代了delegate
  316. UIAlertAction *actionOne = [UIAlertAction actionWithTitle:@"Check for saved order" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
  317. // vc.disable_refresh = true;
  318. OrderListViewController* ovc =[ vc.storyboard instantiateViewControllerWithIdentifier:@"OrderListViewController"];
  319. ovc.showNavibar = true;
  320. ovc.customer_id = appDelegate.contact_id;
  321. ovc.selectOrder = ^(NSMutableDictionary* order_detail){
  322. [holder performSelector:addtocart];
  323. };
  324. ovc.init_style = OL_OPEN;
  325. ovc.onCancel = ^(){
  326. // self.disable_refresh = false;
  327. };
  328. [vc.navigationController pushViewController:ovc animated:true];
  329. }];
  330. [alertControl addAction:actionOne];
  331. UIAlertAction *alertcancel = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
  332. }];
  333. [alertControl addAction:alertcancel];
  334. // [alertControl addAction:alertthree];
  335. //UIAlertControllerStyle类型为UIAlertControllerStyleAlert可以添加addTextFieldWithConfigurationHandler:^(UITextField *textField)
  336. [vc presentViewController:alertControl animated:YES completion:nil];
  337. }
  338. else if(createNewOrder)
  339. {
  340. NSString* msg =@"";
  341. if(appDelegate.contact_id.length>0)
  342. {
  343. msg = [msg stringByAppendingString:@"Customer:"];
  344. msg = [msg stringByAppendingString:appDelegate.customerInfo[@"customer_name"]];
  345. }
  346. UIAlertController *alertControl = [UIAlertController alertControllerWithTitle:@"Add to cart" message:msg preferredStyle:UIAlertControllerStyleAlert];
  347. //block代码块取代了delegate
  348. UIAlertAction *alertthree = [UIAlertAction actionWithTitle:@"Create new order" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
  349. {
  350. //create new;
  351. // self.disable_refresh = true;
  352. if(appDelegate.customerInfo==nil)// select contact if current contact not exist
  353. {
  354. ContactListViewController* cvc = [vc.storyboard instantiateViewControllerWithIdentifier:@"ContactListViewController" ];
  355. cvc.showNavibar = true;
  356. cvc.contact_type = @"Sales_Order_Customer";
  357. cvc.returnValue = ^(NSMutableDictionary* value,NSIndexPath* source){
  358. appDelegate.contact_id=[value valueForKey:@"customer_cid"];
  359. appDelegate.customerInfo = value;
  360. if(appDelegate.order_code==nil)
  361. [self neworder:vc selectorholder:holder selector:addtocart];
  362. // neworder();
  363. // [main_vc checklogin:true];
  364. // [self handle_action_return:value indexPath:indexPath action:ACTION_FILL_SECTION];
  365. //
  366. // if(self.returnValue)
  367. // self.returnValue(value);
  368. };
  369. cvc.onCancel = ^(){
  370. [RAUtils message_alert:@"Cannot create order without cursomer infomation." title:@"New Order Error" controller:vc];
  371. // self.disable_refresh = false;
  372. };
  373. cvc.onReset = ^(){
  374. // [main_vc checklogin:true];
  375. };
  376. [vc.navigationController pushViewController:cvc animated:true];
  377. }
  378. else
  379. {
  380. [self neworder:vc selectorholder:holder selector:addtocart];
  381. }
  382. }
  383. DebugLog(@"No");
  384. }];
  385. // [alertControl addAction:actionOne];
  386. [alertControl addAction:alertthree];
  387. UIAlertAction *alertcancel = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
  388. }];
  389. [alertControl addAction:alertcancel];
  390. //UIAlertControllerStyle类型为UIAlertControllerStyleAlert可以添加addTextFieldWithConfigurationHandler:^(UITextField *textField)
  391. [vc presentViewController:alertControl animated:YES completion:nil];
  392. }
  393. else
  394. {
  395. [RAUtils message_alert:[return_json valueForKey:@"You donot have permission to access order"] title:@"Add To Cart" controller:vc];
  396. }
  397. }
  398. }
  399. else
  400. {
  401. [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Check Pending Order" controller:vc] ;
  402. }
  403. });
  404. });
  405. }
  406. // // [main_vc checklogin:false];
  407. //
  408. // if(appDelegate.can_create_order)
  409. // {
  410. // NSString* msg =@"";
  411. // if(appDelegate.contact_id.length>0)
  412. // {
  413. // msg = [msg stringByAppendingString:@"\n\nCustomer:"];
  414. // msg = [msg stringByAppendingString:appDelegate.customerInfo[@"customer_name"]];
  415. //
  416. // }
  417. // UIAlertView * alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Add to cart", nil) message:msg delegate:self cancelButtonTitle:NSLocalizedString(@"Cancel", nil) otherButtonTitles:NSLocalizedString(@"Check for saved order", nil),NSLocalizedString(@"Create new order", nil), nil];
  418. //
  419. // // alert.
  420. // [alert show];
  421. // }
  422. // else
  423. // {
  424. // UIAlertView * alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Add to cart", nil) message:NSLocalizedString(@"", nil) delegate:self cancelButtonTitle:NSLocalizedString(@"Cancel", nil) otherButtonTitles:NSLocalizedString(@"Check for saved order", nil), nil];
  425. //
  426. // // alert.
  427. // [alert show];
  428. // }
  429. }
  430. else
  431. {
  432. // if(appDelegate.order_code==nil)
  433. // [ self neworder];
  434. // else
  435. [holder performSelector:addtocart];
  436. }
  437. }
  438. }
  439. +(void) add_recent_model:(NSDictionary*) model
  440. {
  441. NSMutableDictionary * newdict = [[NSMutableDictionary alloc]init];
  442. [newdict setObject:model forKey:@"item_0"];
  443. AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
  444. int count=[appDelegate.recent_model[@"count"] intValue];
  445. for(int i=0;i<count;i++)
  446. {
  447. NSMutableDictionary * mitem= appDelegate.recent_model[[NSString stringWithFormat:@"item_%d",i]];
  448. NSString *mitemProductID = [NSString stringWithFormat:@"%@",mitem[@"product_id"]];
  449. NSString *modelProductID = [NSString stringWithFormat:@"%@",model[@"product_id"]];
  450. if([mitemProductID isEqualToString:modelProductID])
  451. continue;
  452. [newdict setObject:mitem forKey:[NSString stringWithFormat:@"item_%lu",(unsigned long)newdict.allKeys.count]];
  453. }
  454. newdict[@"count"]=[NSString stringWithFormat:@"%lu",(unsigned long)newdict.allKeys.count];
  455. appDelegate.recent_model = newdict;
  456. //
  457. //
  458. // if(!bexist)
  459. // {
  460. // [appDelegate.recent_model setObject:item forKey:[NSString stringWithFormat:@"item_%d",count]];
  461. // appDelegate.recent_model[@"count"]=[NSString stringWithFormat:@"%d",count+1];
  462. // }
  463. }
  464. @end