CustomerInfoViewController.m 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700
  1. //
  2. // CustomerInfoViewController.m
  3. // RedAnt ERP Mobile
  4. //
  5. // Created by Ray on 9/10/15.
  6. // Copyright (c) 2015 United Software Applications, Inc. All rights reserved.
  7. //
  8. #import "CustomerInfoViewController.h"
  9. #import "iSalesNetwork.h"
  10. #import "CustomerEditViewController.h"
  11. #import "MainViewController.h"
  12. @interface CustomerInfoViewController ()
  13. @end
  14. @implementation CustomerInfoViewController
  15. - (void)onEditClick:(id)sender {
  16. NSMutableDictionary * params= [[NSMutableDictionary alloc] init];
  17. [params setValue:self.contactId forKey:@"contact_id"];
  18. CustomerEditViewController * cuseditVC =[ self.storyboard instantiateViewControllerWithIdentifier:@"CustomerEditViewController"];
  19. cuseditVC.bnewcustomer=false;
  20. cuseditVC.url_type = URL_REMOTE;
  21. cuseditVC.request_url=URL_EDIT_CUSTOMER;
  22. cuseditVC.params = params;
  23. cuseditVC.delegate=self;
  24. [[self navigationController] setNavigationBarHidden:NO animated:NO];
  25. [self.navigationController pushViewController:cuseditVC animated:false];
  26. }
  27. - (void)onAssignClick:(id)sender {
  28. [self.lastedit endEditing:true];
  29. [self.lasttextview endEditing:true];
  30. // [self.navigationController popViewControllerAnimated:(false)];
  31. int section_count=[[self.content_data_download valueForKey:@"section_count"] intValue];
  32. // NSMutableDictionary* data = [[self.data_init objectForKey:@"customerInfo"] mutableCopy];
  33. for(int i=0;i<section_count;i++)
  34. {
  35. NSDictionary * sectionjson= [self.content_data_download objectForKey:[NSString stringWithFormat:@"section_%d",i]] ;
  36. int count = [[sectionjson valueForKey:@"count"] intValue];
  37. for(int j=0;j<count;j++)
  38. {
  39. NSDictionary * itemjson=[sectionjson objectForKey:[NSString stringWithFormat:@"item_%d",j]];
  40. NSString* name = [itemjson valueForKey:@"name"];
  41. NSString* value = [itemjson valueForKey:@"value"];
  42. [self.data_init setValue:value forKey:name];
  43. }
  44. }
  45. //---------------- construct customer_contact----------------------
  46. NSString* customer_first_name = [self.data_init valueForKey:@"customer_first_name"];
  47. if(customer_first_name==nil)
  48. customer_first_name=@"";
  49. NSString* customer_last_name= [self.data_init valueForKey:@"customer_last_name"];
  50. if(customer_last_name==nil)
  51. customer_last_name=@"";
  52. NSString* customer_contact = [NSString stringWithFormat:@"%@ %@",customer_first_name,customer_last_name];
  53. customer_contact=[customer_contact stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
  54. [self.data_init setValue:customer_contact forKey:@"customer_contact"];
  55. //---------------- finish construct customer_contact----------------------
  56. AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
  57. if(self.update_order && appDelegate.order_code!=nil)
  58. {
  59. dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
  60. NSDictionary* editor_json = [iSalesNetwork update_OrderCustomer:appDelegate.order_code customerinfo:self.data_init];
  61. dispatch_async(dispatch_get_main_queue(), ^{
  62. if([[editor_json valueForKey:@"result"] intValue]==2)
  63. {
  64. [self.navigationController popViewControllerAnimated:false];
  65. if(self.returnValue)
  66. {
  67. self.returnValue(self.data_init);
  68. }
  69. }
  70. else
  71. {
  72. [RAUtils message_alert:[editor_json valueForKey:@"err_msg"] title:@"Update Order Customer Infomation" controller:self] ;
  73. }
  74. });
  75. });
  76. }
  77. else
  78. {
  79. [self.navigationController popViewControllerAnimated:false];
  80. if(self.returnValue)
  81. {
  82. self.returnValue(self.data_init);
  83. }
  84. }
  85. }
  86. - (void)onResetClick:(id)sender {
  87. AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
  88. if(appDelegate.order_code.length>0)
  89. {
  90. //当前已打开订单则关闭订单。
  91. UIAlertController *alertControl = [UIAlertController alertControllerWithTitle:@"Are you sure to release order and reset contact?" message:nil preferredStyle:UIAlertControllerStyleAlert];
  92. //block代码块取代了delegate
  93. UIAlertAction *actionOne = [UIAlertAction actionWithTitle:@"Yes" style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action) {
  94. UIAlertView * waitalert = [RAUtils waiting_alert:@"Please wait" title:@"Release Order"];
  95. dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
  96. NSDictionary* order_json = [iSalesNetwork release_Order:appDelegate.order_code];
  97. dispatch_async(dispatch_get_main_queue(), ^{
  98. [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
  99. if([[order_json valueForKey:@"result"] intValue]==2)
  100. {
  101. AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
  102. // appDelegate.order_code = nil;
  103. [appDelegate closeOrder];
  104. [((MainViewController*)appDelegate.main_vc) reloadOrder:true immediately:false];
  105. [((MainViewController*)appDelegate.main_vc) reloadCart:true immediately:false];
  106. [((MainViewController*)appDelegate.main_vc) reloadContact:false immediately:false];
  107. [self.navigationController popToRootViewControllerAnimated:false];
  108. }
  109. else
  110. {
  111. [RAUtils message_alert:[order_json valueForKey:@"err_msg"] title:@"Release Order" controller:self] ;
  112. }
  113. });
  114. });
  115. }];
  116. UIAlertAction *alertthree = [UIAlertAction actionWithTitle:@"No" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
  117. NSLog(@"Cancel");
  118. }];
  119. [alertControl addAction:actionOne];
  120. [alertControl addAction:alertthree];
  121. [self presentViewController:alertControl animated:YES completion:nil];
  122. }
  123. else
  124. {
  125. //询问并清空当前的全局contact_id、customer
  126. UIAlertController *alertControl = [UIAlertController alertControllerWithTitle:@"Are you sure to reset contact?" message:nil preferredStyle:UIAlertControllerStyleAlert];
  127. UIAlertAction *actionOne = [UIAlertAction actionWithTitle:@"Yes" style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action) {
  128. appDelegate.contact_id=nil;
  129. appDelegate.customerInfo = nil;
  130. [self.navigationController popViewControllerAnimated:(false)];
  131. }];
  132. UIAlertAction *alertthree = [UIAlertAction actionWithTitle:@"No" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
  133. NSLog(@"Cancel");
  134. }];
  135. [alertControl addAction:actionOne];
  136. [alertControl addAction:alertthree];
  137. [self presentViewController:alertControl animated:YES completion:nil];
  138. }
  139. }
  140. - (void)viewDidLoad {
  141. [super viewDidLoad];
  142. [[self navigationController] setNavigationBarHidden:NO animated:NO];
  143. if(self.rightbtn_title!=nil)
  144. [ self.right_btn setTitle:self.rightbtn_title];
  145. // UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Back", nil) style:UIBarButtonItemStylePlain target:self action:@selector(onBackClick:)];
  146. // // closeButton.title = @"Close";
  147. UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithImage:[[UIImage imageNamed:@"back"] imageWithRenderingMode:UIImageRenderingModeAutomatic]
  148. style:UIBarButtonItemStylePlain
  149. target:self
  150. action:@selector( onBackClick:)];
  151. self.navigationItem.leftBarButtonItem = backButton;
  152. NSMutableArray * items = [[NSMutableArray alloc]init];
  153. self.btn_edit = [[UIBarButtonItem alloc] initWithImage:[[UIImage imageNamed:@"edit"] imageWithRenderingMode:UIImageRenderingModeAutomatic]
  154. style:UIBarButtonItemStylePlain
  155. target:self
  156. action:@selector(onEditClick:)];//[[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Download", nil) style:UIBarButtonItemStylePlain target:self action:@selector(onDownloadOrderClick:)];
  157. // self.btn_edit.tintColor = UIColorFromRGB(0x996633);
  158. self.btn_assign = [[UIBarButtonItem alloc] initWithImage:[[UIImage imageNamed:@"assign"] imageWithRenderingMode:UIImageRenderingModeAutomatic]
  159. style:UIBarButtonItemStylePlain
  160. target:self
  161. action:@selector(onAssignClick:)];//[[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Download", nil) style:UIBarButtonItemStylePlain target:self action:@selector(onDownloadOrderClick:)];
  162. // self.btn_assign.tintColor = UIColorFromRGB(0x996633);
  163. self.btn_reset = [[UIBarButtonItem alloc] initWithImage:[[UIImage imageNamed:@"reset"] imageWithRenderingMode:UIImageRenderingModeAutomatic]
  164. style:UIBarButtonItemStylePlain
  165. target:self
  166. action:@selector(onResetClick:)];//[[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Download", nil) style:UIBarButtonItemStylePlain target:self action:@selector(onDownloadOrderClick:)];
  167. // self.btn_reset.tintColor = UIColorFromRGB(0x996633);
  168. // AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
  169. if(self.edit_icon)
  170. [items addObject:self.btn_edit];
  171. if(self.assig_icon)
  172. [items addObject:self.btn_assign];
  173. if(self.reset_icon)
  174. [items addObject:self.btn_reset];
  175. self.navigationItem.rightBarButtonItems=items;
  176. if (self.data_init==nil) {
  177. UIAlertView * waitalert = [RAUtils waiting_alert:@"Please wait..." title:@"Loading Contact information"];
  178. dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
  179. NSDictionary* editor_json = [iSalesNetwork request_CustomerInfo:self.contactId];
  180. dispatch_async(dispatch_get_main_queue(), ^{
  181. [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
  182. if([[editor_json valueForKey:@"result"] intValue]==2)
  183. {
  184. self.data_init = [[editor_json objectForKey:@"customerInfo" ] mutableCopy];
  185. [self fillData];
  186. self.btn_assign.enabled=true;
  187. }
  188. else
  189. {
  190. [RAUtils message_alert:[editor_json valueForKey:@"err_msg"] title:@"Loading Contact Information" controller:self] ;
  191. self.btn_assign.enabled=false;
  192. }
  193. });
  194. });
  195. }
  196. else
  197. {
  198. [self fillData];
  199. }
  200. // Do any additional setup after loading the view.
  201. }
  202. - (void)onBackClick:(UIButton *)sender {
  203. [self.lastedit endEditing:true];
  204. [self.lasttextview endEditing:true];
  205. NSMutableDictionary* back_data = [self.data_init mutableCopy];
  206. // [self.navigationController popViewControllerAnimated:(false)];
  207. int section_count=[[self.content_data_download valueForKey:@"section_count"] intValue];
  208. // NSMutableDictionary* data = [[self.data_init objectForKey:@"customerInfo"] mutableCopy];
  209. for(int i=0;i<section_count;i++)
  210. {
  211. NSDictionary * sectionjson= [self.content_data_download objectForKey:[NSString stringWithFormat:@"section_%d",i]] ;
  212. int count = [[sectionjson valueForKey:@"count"] intValue];
  213. for(int j=0;j<count;j++)
  214. {
  215. NSDictionary * itemjson=[sectionjson objectForKey:[NSString stringWithFormat:@"item_%d",j]];
  216. NSString* name = [itemjson valueForKey:@"name"];
  217. NSString* value = [itemjson valueForKey:@"value"];
  218. [back_data setValue:value forKey:name];
  219. }
  220. }
  221. //---------------- construct customer_contact----------------------
  222. NSString* customer_first_name = [back_data valueForKey:@"customer_first_name"];
  223. if(customer_first_name==nil)
  224. customer_first_name=@"";
  225. NSString* customer_last_name= [back_data valueForKey:@"customer_last_name"];
  226. if(customer_last_name==nil)
  227. customer_last_name=@"";
  228. NSString* customer_contact = [NSString stringWithFormat:@"%@ %@",customer_first_name,customer_last_name];
  229. customer_contact=[customer_contact stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
  230. [back_data setValue:customer_contact forKey:@"customer_contact"];
  231. if(self.onClose)
  232. {
  233. self.onClose(back_data);
  234. }
  235. [self.navigationController popViewControllerAnimated:(false)];
  236. // [self.navigationController dismissViewControllerAnimated:true completion:^{
  237. // ;
  238. // }];
  239. }
  240. - (void) fillData
  241. {
  242. int section_count=[[self.content_data_download valueForKey:@"section_count"] intValue];
  243. // NSDictionary* data = [self.data_init objectForKey:@"customerInfo"];
  244. for(int i=0;i<section_count;i++)
  245. {
  246. NSMutableDictionary * sectionjson= [[self.content_data_download objectForKey:[NSString stringWithFormat:@"section_%d",i]] mutableCopy];
  247. int count = [[sectionjson valueForKey:@"count"] intValue];
  248. for(int j=0;j<count;j++)
  249. {
  250. NSMutableDictionary * itemjson=[[sectionjson objectForKey:[NSString stringWithFormat:@"item_%d",j]] mutableCopy];
  251. NSString* control=[itemjson valueForKey:@"control"];
  252. NSString* name = [itemjson valueForKey:@"name"];
  253. NSString* value = [self.data_init valueForKey:name];
  254. [itemjson setValue:value forKey:@"value"];
  255. if([control isEqualToString:@"img"])
  256. {
  257. {
  258. NSString* img_url = [itemjson valueForKey:@"img_url_0"];
  259. NSString* url_value = [self.data_init valueForKey:img_url];
  260. [itemjson setValue:url_value forKey:@"img_url_0"];
  261. }
  262. {
  263. NSString* img_url = [itemjson valueForKey:@"img_url_1"];
  264. NSString* url_value = [self.data_init valueForKey:img_url];
  265. [itemjson setValue:url_value forKey:@"img_url_1"];
  266. }
  267. {
  268. NSString* img_url = [itemjson valueForKey:@"img_url_2"];
  269. NSString* url_value = [self.data_init valueForKey:img_url];
  270. [itemjson setValue:url_value forKey:@"img_url_2"];
  271. }
  272. }
  273. [sectionjson setObject:itemjson forKey:[NSString stringWithFormat:@"item_%d",j]];
  274. }
  275. [self.content_data_download setObject:sectionjson forKey:[NSString stringWithFormat:@"section_%d",i]];
  276. }
  277. self.content_data_control=[self translate_json:self.content_data_download changed:self.changed_data];
  278. // self.navigationItem.title = [self.content_data_download valueForKey:@"title"] ;
  279. [self.editorTable reloadData];
  280. }
  281. //- (IBAction)onEditClick:(id)sender {
  282. //
  283. //
  284. // NSMutableDictionary * params= [[NSMutableDictionary alloc] init];
  285. //
  286. //
  287. // [params setValue:self.contactId forKey:@"contactId"];
  288. // CustomerEditViewController * cuseditVC =[ self.storyboard instantiateViewControllerWithIdentifier:@"CustomerEditViewController"];
  289. //
  290. // cuseditVC.bnewcustomer=false;
  291. // cuseditVC.url_type = URL_REMOTE;
  292. // cuseditVC.request_url=URL_EDIT_CUSTOMER;
  293. //
  294. // cuseditVC.params = params;
  295. //
  296. // cuseditVC.delegate=self;
  297. // //
  298. // // if(checked.count==count)
  299. // // {
  300. // // orderinfoVC.have_tail = true
  301. // // }
  302. // [[self navigationController] setNavigationBarHidden:NO animated:NO];
  303. // [self.navigationController pushViewController:cuseditVC animated:false];
  304. //
  305. //}
  306. //- (IBAction)onSetClick:(id)sender {
  307. //
  308. // [self.lastedit endEditing:true];
  309. // [self.lasttextview endEditing:true];
  310. //
  311. //
  312. //
  313. //
  314. //
  315. // // [self.navigationController popViewControllerAnimated:(false)];
  316. // int section_count=[[self.content_data_download valueForKey:@"section_count"] intValue];
  317. //// NSMutableDictionary* data = [[self.data_init objectForKey:@"customerInfo"] mutableCopy];
  318. //
  319. // for(int i=0;i<section_count;i++)
  320. // {
  321. // NSDictionary * sectionjson= [self.content_data_download objectForKey:[NSString stringWithFormat:@"section_%d",i]] ;
  322. // int count = [[sectionjson valueForKey:@"count"] intValue];
  323. // for(int j=0;j<count;j++)
  324. // {
  325. // NSDictionary * itemjson=[sectionjson objectForKey:[NSString stringWithFormat:@"item_%d",j]];
  326. //
  327. // NSString* name = [itemjson valueForKey:@"name"];
  328. //
  329. // NSString* value = [itemjson valueForKey:@"value"];
  330. //
  331. // [self.data_init setValue:value forKey:name];
  332. //
  333. //
  334. //
  335. // }
  336. //
  337. // }
  338. // //---------------- construct customer_contact----------------------
  339. // NSString* customer_first_name = [self.data_init valueForKey:@"customer_first_name"];
  340. // if(customer_first_name==nil)
  341. // customer_first_name=@"";
  342. //
  343. // NSString* customer_last_name= [self.data_init valueForKey:@"customer_last_name"];
  344. // if(customer_last_name==nil)
  345. // customer_last_name=@"";
  346. // NSString* customer_contact = [NSString stringWithFormat:@"%@ %@",customer_first_name,customer_last_name];
  347. // customer_contact=[customer_contact stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
  348. // [self.data_init setValue:customer_contact forKey:@"customer_contact"];
  349. // //---------------- finish construct customer_contact----------------------
  350. //
  351. // AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
  352. // if(self.update_order && appDelegate.order_code!=nil)
  353. // {
  354. //
  355. //
  356. //
  357. // dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
  358. //
  359. // NSDictionary* editor_json = [iSalesNetwork update_OrderCustomer:appDelegate.order_code customerinfo:self.data_init];
  360. //
  361. // dispatch_async(dispatch_get_main_queue(), ^{
  362. //
  363. //
  364. // if([[editor_json valueForKey:@"result"] intValue]==2)
  365. // {
  366. //
  367. // [self.navigationController popViewControllerAnimated:false];
  368. // if(self.returnValue)
  369. // {
  370. //
  371. // self.returnValue(self.data_init);
  372. // }
  373. //
  374. //
  375. //
  376. // }
  377. // else
  378. // {
  379. // [RAUtils message_alert:[editor_json valueForKey:@"err_msg"] title:@"Update Order Customer Infomation" controller:self] ;
  380. // }
  381. //
  382. //
  383. //
  384. // });
  385. // });
  386. //
  387. //
  388. // }
  389. // else
  390. // {
  391. //
  392. // [self.navigationController popViewControllerAnimated:false];
  393. // if(self.returnValue)
  394. // {
  395. // self.returnValue(self.data_init);
  396. //
  397. // }
  398. // // [self.data_init setObject:data forKey:@"customerInfo"];
  399. //
  400. //
  401. // /*
  402. // AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
  403. // appDelegate.contact_id=self.contactId;
  404. // appDelegate.customerInfo = self.data_init;
  405. // */
  406. //
  407. //// [self.navigationController popToRootViewControllerAnimated:false];
  408. // }
  409. //
  410. //
  411. //
  412. //}
  413. #pragma mark- img changed
  414. // image 改变时执行
  415. - (void) imgIsChanged:(NSString *)url_down url_up:(NSString *)url_up indexPath: (NSIndexPath *) indexPath{
  416. // int aaa = 0;
  417. // NSDictionary* aaa = self.content_data_download;
  418. UIAlertView * waitalert = [RAUtils waiting_alert:@"Please wait" title:@"Create Order"];
  419. dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
  420. NSString* cid=[self getValue:@"customer_cid"];
  421. NSDictionary* return_json = [iSalesNetwork update_customer_img:cid img_url:url_up];
  422. dispatch_async(dispatch_get_main_queue(), ^{
  423. [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
  424. if([[return_json valueForKey:@"result"] intValue]==2)
  425. {
  426. int result=[[return_json valueForKey:@"result"] intValue];
  427. if(result==2)
  428. {
  429. UIAlertView * alert = [[UIAlertView alloc] initWithTitle: @"Upload successful." message:nil delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
  430. [alert show];
  431. }
  432. }
  433. else
  434. {
  435. [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Add To Cart" controller:self] ;
  436. }
  437. });
  438. });
  439. // // NSLog(@"Sender is = %@", url);
  440. //
  441. //
  442. //
  443. //
  444. // NSMutableDictionary* section_json=nil;
  445. //
  446. //
  447. // // NSLog(@"endedit %d_%d",indexPath.section,indexPath.row);
  448. // NSMutableDictionary* item_json =[((NSMutableArray*)self.content_data_control[indexPath.section])[indexPath.row] mutableCopy];
  449. //
  450. // int refresh = [[item_json valueForKey:@"refresh"] intValue];
  451. //
  452. // NSString* subid=[item_json valueForKey:@"subid"];
  453. //
  454. // item_json[@"img_url"]=url_down;
  455. // item_json[@"avalue"]=url_up;
  456. //
  457. // if(subid==nil)
  458. // {
  459. // section_json = [[self.content_data_download objectForKey:[NSString stringWithFormat:@"section_%ld",(long)indexPath.section ]] mutableCopy];
  460. // int count=0;
  461. //
  462. // count=[[section_json valueForKey:@"count"] intValue];
  463. //
  464. // for(int i=0;i<count;i++)
  465. // {
  466. // NSDictionary * olditem=[section_json objectForKey:[NSString stringWithFormat:@"item_%d",i ]];
  467. // if([[olditem valueForKey:@"name"] isEqualToString:[item_json valueForKey:@"name" ]])
  468. // [section_json setObject:item_json forKey:[NSString stringWithFormat:@"item_%d",i ]];
  469. //
  470. //
  471. // }
  472. //
  473. // }
  474. // else
  475. // {
  476. // NSArray* idarr=[subid componentsSeparatedByString:@"_"];
  477. // int section = [(NSString*)idarr[0] intValue];
  478. // int item=[(NSString*)idarr[1] intValue];
  479. //
  480. //
  481. // section_json = [[self.content_data_download objectForKey:[NSString stringWithFormat:@"section_%d", section]] mutableCopy];
  482. // NSDictionary * olditem=[section_json objectForKey:[NSString stringWithFormat:@"item_%d",item ]];
  483. // item_json= [self enum_subitem_changed:[olditem mutableCopy] subid:idarr value:item_json step:2];
  484. // [item_json setValue:@"true" forKey:@"dirty"];
  485. // [section_json setObject:item_json forKey:[NSString stringWithFormat:@"item_%d",item ]];
  486. // }
  487. //
  488. //
  489. //
  490. // [self.content_data_download setObject:section_json forKey:[NSString stringWithFormat:@"section_%ld",(long)indexPath.section ]];
  491. //
  492. // self.content_data_control = [self translate_json:self.content_data_download changed: self.changed_data];
  493. //
  494. // NSRange range = NSMakeRange(indexPath.section, 1);
  495. // NSIndexSet *sectionToReload = [NSIndexSet indexSetWithIndexesInRange:range];
  496. // // [self.editorTable reloadSections:sectionToReload withRowAnimation:UITableViewRowAnimationAutomatic];
  497. //
  498. //
  499. // if(refresh==1)
  500. // {
  501. // [self refresh];
  502. // }
  503. }
  504. - (void)didReceiveMemoryWarning {
  505. [super didReceiveMemoryWarning];
  506. // Dispose of any resources that can be recreated.
  507. }
  508. /*
  509. #pragma mark - Navigation
  510. // In a storyboard-based application, you will often want to do a little preparation before navigation
  511. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  512. // Get the new view controller using [segue destinationViewController].
  513. // Pass the selected object to the new view controller.
  514. }
  515. */
  516. @end