|
|
@@ -43,6 +43,11 @@
|
|
|
|
|
|
#import "AppDelegate.h"
|
|
|
|
|
|
+#import "FileCache.h"
|
|
|
+#import "RAConvertor.h"
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
@interface subitem_data ()
|
|
|
|
|
|
@end
|
|
|
@@ -1616,7 +1621,7 @@
|
|
|
[self.content_data_download setObject:section_json forKey:[NSString stringWithFormat:@"section_%ld",(long)indexPath.section ]];
|
|
|
}
|
|
|
|
|
|
- DebugLog(@"CONTENT UPDATE:%@",[RANetwork DataTOjsonString:self.content_data_download]);
|
|
|
+ DebugLog(@"CONTENT UPDATE:%@",[RAConvertor DataTOjsonString:self.content_data_download]);
|
|
|
self.content_data_control = [self translate_json:self.content_data_download changed:self.changed_data];
|
|
|
|
|
|
|
|
|
@@ -1803,7 +1808,7 @@
|
|
|
[self.content_data_download setObject:section_json forKey:[NSString stringWithFormat:@"section_%ld",(long)indexPath.section ]];
|
|
|
}
|
|
|
|
|
|
- DebugLog(@"CONTENT UPDATE:%@",[RANetwork DataTOjsonString:self.content_data_download]);
|
|
|
+ DebugLog(@"CONTENT UPDATE:%@",[RAConvertor DataTOjsonString:self.content_data_download]);
|
|
|
self.content_data_control = [self translate_json:self.content_data_download changed:self.changed_data];
|
|
|
|
|
|
|
|
|
@@ -2248,196 +2253,8 @@
|
|
|
}
|
|
|
return ret;
|
|
|
}
|
|
|
--(NSMutableDictionary*)create_value_map:(NSDictionary*)key_map
|
|
|
-{
|
|
|
- NSMutableDictionary* ret= [[NSMutableDictionary alloc] init];
|
|
|
- NSArray *keys= [key_map allKeys];
|
|
|
- //遍历keys
|
|
|
- for(int i=0;i<[keys count];i++)
|
|
|
- {
|
|
|
- //得到当前key
|
|
|
- NSString *key=[keys objectAtIndex:i];
|
|
|
- //如果key不是pic,说明value是字符类型,比如name:Boris
|
|
|
- NSString* valuefrom = [key_map valueForKey:key];
|
|
|
-
|
|
|
- if(valuefrom.length==0)
|
|
|
- continue;
|
|
|
- NSString* value=[self getValue:valuefrom];
|
|
|
-
|
|
|
- [ret setValue:value forKey:valuefrom];
|
|
|
- }
|
|
|
- NSDictionary * customerinfo =[self create_cusromer_info_from_table];
|
|
|
- [ret setValue:[self create_customer_ext:customerinfo] forKey:@"customer_contact_ext"];
|
|
|
- [ret setValue:customerinfo[@"customer_first_name"] forKey:@"customer_first_name"];
|
|
|
- [ret setValue:customerinfo[@"customer_last_name"] forKey:@"customer_last_name"];
|
|
|
- // AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
|
|
|
- // // self.labelContact.text=appDelegate.contact_name;
|
|
|
- //
|
|
|
- // NSDictionary * customerinfo = appDelegate.customerInfo;
|
|
|
- //
|
|
|
- //
|
|
|
- // keys= [customerinfo allKeys];
|
|
|
- // //遍历keys
|
|
|
- // for(int i=0;i<[keys count];i++)
|
|
|
- // {
|
|
|
- // //得到当前key
|
|
|
- // NSString *key=[keys objectAtIndex:i];
|
|
|
- // //如果key不是pic,说明value是字符类型,比如name:Boris
|
|
|
- // NSString* valuefrom = key;
|
|
|
- // NSString* value=[customerinfo valueForKey:key];
|
|
|
- //
|
|
|
- // [ret setValue:value forKey:valuefrom];
|
|
|
- // }
|
|
|
- //// add customer_contact_ext
|
|
|
- // [ret setValue:[self create_customer_ext:customerinfo] forKey:@"customer_contact_ext"];
|
|
|
-
|
|
|
- // NSString *string = [array componentsJoinedByString:@" "];
|
|
|
- return ret;
|
|
|
-}
|
|
|
|
|
|
--(NSMutableDictionary*)create_cusromer_info_from_table
|
|
|
-{
|
|
|
-
|
|
|
- AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
|
|
|
-
|
|
|
- NSMutableDictionary* ret= [appDelegate.customerInfo mutableCopy] ;
|
|
|
-
|
|
|
- [ret setValue:[self getValue:@"customer_country"] forKey:@"customer_country"];
|
|
|
- [ret setValue:[self getValue:@"customer_phone"] forKey:@"customer_phone"];
|
|
|
- [ret setValue:[self getValue:@"customer_email"] forKey:@"customer_email"];
|
|
|
- [ret setValue:[self getValue:@"customer_name"] forKey:@"customer_name"];
|
|
|
- [ret setValue:[self getValue:@"customer_address4"] forKey:@"customer_address4"];
|
|
|
- [ret setValue:[self getValue:@"customer_address3"] forKey:@"customer_address3"];
|
|
|
- [ret setValue:[self getValue:@"customer_address2"] forKey:@"customer_address2"];
|
|
|
- [ret setValue:[self getValue:@"customer_address1"] forKey:@"customer_address1"];
|
|
|
- [ret setValue:[self getValue:@"customer_zipcode"] forKey:@"customer_zipcode"];
|
|
|
- [ret setValue:[self getValue:@"customer_city"] forKey:@"customer_city"];
|
|
|
- [ret setValue:[self getValue:@"customer_state"] forKey:@"customer_state"];
|
|
|
- [ret setValue:[self getValue:@"customer_cid"] forKey:@"customer_cid"];
|
|
|
- [ret setValue:[self getValue:@"customer_state"] forKey:@"customer_state"];
|
|
|
- [ret setValue:[self getValue:@"customer_contact"] forKey:@"customer_contact"];
|
|
|
- [ret setValue:[self getValue:@"customer_fax"] forKey:@"customer_fax"];
|
|
|
-
|
|
|
- NSString * firstname =nil;
|
|
|
-
|
|
|
- NSString* lastname = nil;
|
|
|
- NSString* contact_name = [self getValue:@"customer_contact"];
|
|
|
- if(contact_name!=nil)
|
|
|
- {
|
|
|
- NSArray *_arr = [contact_name componentsSeparatedByString:NSLocalizedString(@" ", nil)];
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- if(_arr.count>=1)
|
|
|
- {
|
|
|
- firstname =_arr[0];
|
|
|
- if(_arr.count>1)
|
|
|
- {
|
|
|
-
|
|
|
- lastname=[[_arr subarrayWithRange:NSMakeRange(1, _arr.count-1)] componentsJoinedByString:@" "];
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- [ret setValue:firstname forKey:@"customer_first_name"];
|
|
|
- [ret setValue:lastname forKey:@"customer_last_name"];
|
|
|
-
|
|
|
- // [ret setValue:[self create_customer_ext:ret] forKey:@"customer_contact_ext"];
|
|
|
-
|
|
|
- return ret;
|
|
|
-}
|
|
|
--(NSString* )create_customer_ext:(NSDictionary*)customerinfo
|
|
|
-{
|
|
|
- NSString* ret=nil;
|
|
|
- NSString* customer_address1= [customerinfo valueForKey:@"customer_address1"];
|
|
|
- NSString* customer_address2= [customerinfo valueForKey:@"customer_address2"];
|
|
|
- NSString* customer_address3= [customerinfo valueForKey:@"customer_address3"];
|
|
|
- NSString* customer_address4= [customerinfo valueForKey:@"customer_address4"];
|
|
|
-
|
|
|
- NSMutableArray* arraddr = [[NSMutableArray alloc] init];
|
|
|
- if(customer_address1.length>0)
|
|
|
- [arraddr addObject:customer_address1];
|
|
|
- if(customer_address2.length>0)
|
|
|
- [arraddr addObject:customer_address2];
|
|
|
- if(customer_address3.length>0)
|
|
|
- [arraddr addObject:customer_address3];
|
|
|
- if(customer_address4.length>0)
|
|
|
- [arraddr addObject:customer_address4];
|
|
|
- NSString *addr_string = [arraddr componentsJoinedByString:@"\r\n"];
|
|
|
-
|
|
|
-
|
|
|
- NSString* customer_city= [customerinfo valueForKey:@"customer_city"];
|
|
|
- NSString* customer_country= [customerinfo valueForKey:@"customer_country"];
|
|
|
- NSString* customer_zipcode= [customerinfo valueForKey:@"customer_zipcode"];
|
|
|
- NSString* customer_state= [customerinfo valueForKey:@"customer_state"];
|
|
|
-
|
|
|
- NSMutableArray* arrcty = [[NSMutableArray alloc] init];
|
|
|
- if(customer_city.length>0)
|
|
|
- [arrcty addObject:customer_city];
|
|
|
- if(customer_state.length>0)
|
|
|
- [arrcty addObject:customer_state];
|
|
|
- if(customer_zipcode.length>0)
|
|
|
- [arrcty addObject:customer_zipcode];
|
|
|
- if(customer_country.length>0)
|
|
|
- [arrcty addObject:customer_country];
|
|
|
- NSString *cty_string = [arrcty componentsJoinedByString:@", "];
|
|
|
-
|
|
|
-
|
|
|
- // NSString* customer_phone= [customerinfo valueForKey:@"customer_phone"];
|
|
|
- // NSString* customer_fax= [customerinfo valueForKey:@"customer_fax"];
|
|
|
- //
|
|
|
- // NSMutableArray* arrpho = [[NSMutableArray alloc] init];
|
|
|
- // if(customer_phone.length>0)
|
|
|
- // {
|
|
|
- // customer_phone = [NSString stringWithFormat:@"TEL: %@",customer_phone];
|
|
|
- // [arrpho addObject:customer_phone];
|
|
|
- // }
|
|
|
- // if(customer_fax.length>0)
|
|
|
- // {
|
|
|
- // customer_fax = [NSString stringWithFormat:@"FAX: %@",customer_fax];
|
|
|
- // [arrpho addObject:customer_fax];
|
|
|
- // }
|
|
|
- // NSString *phone_string = [arrpho componentsJoinedByString:@", "];
|
|
|
- //
|
|
|
- //
|
|
|
- // NSString* customer_contact= [customerinfo valueForKey:@"customer_contact"];
|
|
|
- // if(customer_contact.length>0)
|
|
|
- // {
|
|
|
- // customer_contact = [NSString stringWithFormat:@"ATTN: %@",customer_contact];
|
|
|
- //
|
|
|
- // }
|
|
|
- // NSString *contact_string = customer_contact;
|
|
|
- //
|
|
|
- //
|
|
|
- // NSString* customer_email= [customerinfo valueForKey:@"customer_email"];
|
|
|
- // if(customer_email.length>0)
|
|
|
- // {
|
|
|
- // customer_email = [NSString stringWithFormat:@"Email: %@",customer_email];
|
|
|
- //
|
|
|
- // }
|
|
|
- // NSString *email_string = customer_email;
|
|
|
-
|
|
|
-
|
|
|
- NSMutableArray* arrext = [[NSMutableArray alloc] init];
|
|
|
- if(addr_string.length>0)
|
|
|
- [arrext addObject:addr_string];
|
|
|
- if(cty_string.length>0)
|
|
|
- [arrext addObject:cty_string];
|
|
|
- // if(phone_string.length>0)
|
|
|
- // [arrext addObject:phone_string];
|
|
|
- // if(contact_string.length>0)
|
|
|
- // [arrext addObject:contact_string];
|
|
|
- // if(email_string.length>0)
|
|
|
- // [arrext addObject:email_string];
|
|
|
-
|
|
|
- ret = [arrext componentsJoinedByString:@"\r\n"];
|
|
|
-
|
|
|
- // NSString *string = [array componentsJoinedByString:@" "];
|
|
|
-
|
|
|
- // NSString* customer_name= [customerinfo valueForKey:@"customer_name"];
|
|
|
-
|
|
|
-
|
|
|
- return ret;
|
|
|
-}
|
|
|
+
|
|
|
#pragma mark - hide section button clicked
|
|
|
- (void)HideSction:(UIButton *)sender {
|
|
|
|
|
|
@@ -2922,7 +2739,7 @@
|
|
|
img_url_up=@"";
|
|
|
cell.imgs[0]=img_url_up;
|
|
|
NSString* file_name=[img_url0 lastPathComponent];
|
|
|
- NSData* img_data=[iSalesDB load_cached_img:file_name loadFrom:img_url0];
|
|
|
+ NSData* img_data=[FileCache load_cached_img:file_name loadFrom:img_url0];
|
|
|
if(img_data!=nil)
|
|
|
{
|
|
|
|
|
|
@@ -2947,7 +2764,7 @@
|
|
|
if(downloadimg_data!=nil)
|
|
|
{
|
|
|
|
|
|
- [iSalesDB cache_img:downloadimg_data filename:file_name saveTo:img_url0];
|
|
|
+ [FileCache cache_img:downloadimg_data filename:file_name saveTo:img_url0];
|
|
|
|
|
|
UIImage * img =[UIImage imageWithData:downloadimg_data];
|
|
|
cell.touchImageView0.image=img;
|
|
|
@@ -2983,7 +2800,7 @@
|
|
|
|
|
|
cell.imgs[1]=img_url_up;
|
|
|
NSString* file_name=[img_url1 lastPathComponent];
|
|
|
- NSData* img_data=[iSalesDB load_cached_img:file_name loadFrom:img_url1];
|
|
|
+ NSData* img_data=[FileCache load_cached_img:file_name loadFrom:img_url1];
|
|
|
if(img_data!=nil)
|
|
|
{
|
|
|
|
|
|
@@ -3009,7 +2826,7 @@
|
|
|
if(downloadimg_data!=nil)
|
|
|
{
|
|
|
|
|
|
- [iSalesDB cache_img:downloadimg_data filename:file_name saveTo:img_url1];
|
|
|
+ [FileCache cache_img:downloadimg_data filename:file_name saveTo:img_url1];
|
|
|
|
|
|
UIImage * img =[UIImage imageWithData:downloadimg_data];
|
|
|
cell.touchImageView1.image=img;
|
|
|
@@ -3042,7 +2859,7 @@
|
|
|
img_url_up=@"";
|
|
|
cell.imgs[2]=img_url_up;
|
|
|
NSString* file_name=[img_url2 lastPathComponent];
|
|
|
- NSData* img_data=[iSalesDB load_cached_img:file_name loadFrom:img_url2];
|
|
|
+ NSData* img_data=[FileCache load_cached_img:file_name loadFrom:img_url2];
|
|
|
if(img_data!=nil)
|
|
|
{
|
|
|
|
|
|
@@ -3067,7 +2884,7 @@
|
|
|
if(downloadimg_data!=nil)
|
|
|
{
|
|
|
|
|
|
- [iSalesDB cache_img:downloadimg_data filename:file_name saveTo:img_url2];
|
|
|
+ [FileCache cache_img:downloadimg_data filename:file_name saveTo:img_url2];
|
|
|
|
|
|
UIImage * img =[UIImage imageWithData:downloadimg_data];
|
|
|
cell.touchImageView2.image=img;
|
|
|
@@ -3751,7 +3568,7 @@
|
|
|
cell.imgModel.image = [UIImage imageNamed:@"loading_s"];
|
|
|
|
|
|
NSString* file_name=[img_url lastPathComponent];
|
|
|
- NSData* img_data=[iSalesDB load_cached_img:file_name loadFrom:img_url];
|
|
|
+ NSData* img_data=[FileCache load_cached_img:file_name loadFrom:img_url];
|
|
|
if(img_data!=nil)
|
|
|
{
|
|
|
|
|
|
@@ -3772,7 +3589,7 @@
|
|
|
if(downloadimg_data!=nil)
|
|
|
{
|
|
|
|
|
|
- [iSalesDB cache_img:downloadimg_data filename:file_name saveTo:img_url];
|
|
|
+ [FileCache cache_img:downloadimg_data filename:file_name saveTo:img_url];
|
|
|
|
|
|
UIImage * img =[UIImage imageWithData:downloadimg_data];
|
|
|
cell.imgModel.image = img;
|
|
|
@@ -3946,7 +3763,7 @@
|
|
|
|
|
|
|
|
|
NSString* file_name=[img_url lastPathComponent];
|
|
|
- NSData* img_data=[iSalesDB load_cached_img:file_name loadFrom:img_url];
|
|
|
+ NSData* img_data=[FileCache load_cached_img:file_name loadFrom:img_url];
|
|
|
if(img_data!=nil)
|
|
|
{
|
|
|
|
|
|
@@ -3967,7 +3784,7 @@
|
|
|
if(downloadimg_data!=nil)
|
|
|
{
|
|
|
|
|
|
- [iSalesDB cache_img:downloadimg_data filename:file_name saveTo:img_url];
|
|
|
+ [FileCache cache_img:downloadimg_data filename:file_name saveTo:img_url];
|
|
|
|
|
|
UIImage * img =[UIImage imageWithData:downloadimg_data];
|
|
|
cell.imageviewSignature.image=img ;
|
|
|
@@ -4685,7 +4502,7 @@
|
|
|
}
|
|
|
|
|
|
|
|
|
- DebugLog(@"CONTENT UPDATE:%@",[RANetwork DataTOjsonString:self.content_data_download]);
|
|
|
+ DebugLog(@"CONTENT UPDATE:%@",[RAConvertor DataTOjsonString:self.content_data_download]);
|
|
|
|
|
|
|
|
|
|