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