· 6 years ago · Feb 20, 2019, 04:54 PM
1NSMutableArray * vcardIDList = [[[NSMutableArray alloc] initWithCapacity:0] autorelease];
2 for (int i = 0; i < [[CardManager sharedInstance] businessCardCount]; i++) {
3
4 BusinessCard * myBusinessCard = [[CardManager sharedInstance] getBusinessCardAtIndex:i];
5 if (myBusinessCard.isSelected == YES) {
6 NSMutableDictionary *userID = [[[NSMutableDictionary alloc] initWithCapacity:0] autorelease];
7 DataObject * firstObject = [[[DataObject alloc] init] autorelease];
8 firstObject.data = [NSNumber numberWithInt:[myBusinessCard cardId]];
9 firstObject.type = EDataTypeNumber;
10 [userID setObject:firstObject forKey:@"vcardID"];
11[commMngr deleteVcardList:@"3.0.0" userID:[[NSUserDefaults standardUserDefaults] objectForKey:@"acceptUserID"] vcardIDList:vcardIDList SecretKey:[[NSUserDefaults standardUserDefaults] objectForKey:@"SecurityKey"]];
12//Using this method call object
13
14-(void)deleteVcardList:(NSString *)versionID userID:(NSString *)userID vcardIDList:(NSArray *)vcardIDList SecretKey:(NSString *)SecretKey{
15 if(versionID || vcardIDList ||SecretKey ||userID){
16 WYRequest * pRequest = [[[WYRequest alloc] init] autorelease];
17 pRequest.type = ERequestTypeDeleteVcardList;
18 NSMutableDictionary *dataDic = [pRequest passInData];
19
20
21
22 if (versionID) {
23 DataObject * verData = [[[DataObject alloc] init] autorelease];
24 verData.data = versionID;
25 verData.type = EDataTypeString;
26 [dataDic setObject:verData forKey:@"versionID"];
27 }
28
29 if (userID) {
30 DataObject * useridData = [[[DataObject alloc] init] autorelease];
31 useridData.data = userID;
32 useridData.type = EDataTypeNumber;
33 [dataDic setObject:useridData forKey:@"userID"];
34 }
35
36 if (vcardIDList) {
37 DataObject * vcardListData = [[[DataObject alloc] init] autorelease];
38 vcardListData.data = vcardIDList;
39 vcardListData.type = EDataTypeArrayJSONObj;
40 [dataDic setObject:vcardListData forKey:@"vcardIDList"];
41 }
42
43 if (SecretKey) {
44 DataObject * SecretKeyData = [[[DataObject alloc] init] autorelease];
45 SecretKeyData.data = SecretKey;
46 SecretKeyData.type = EDataTypeString;
47 [dataDic setObject:SecretKeyData forKey:@"SecretKey"];
48 }
49
50 [self addRequest:pRequest];
51 } else {
52 //need log
53 NSLog(@"%@", @"Invalid deleteVcardList");
54 }
55
56Case of success here ::: parameters of the request to the server to remove the contact print out this
57{"versionID":"3.0.0","userID":18,"SecretKey":"C9998D538ADF240CCE71CBB52552A107","vcardIDList":[{"vcardID":350},{"vcardID":215},{"vcardID":212}]}
58
59 I also use this mode do I click statistics I was doing
60
61
62ï½› NSDate * now = [NSDate date];
63 NSDateFormatter* formatter = [[NSDateFormatter alloc] init];
64 [formatter setDateFormat:@"yyyy-MM-dd hh:mm:ss"];
65 NSString* receiveTime = [formatter stringFromDate:now];
66 Action *action=[[Action alloc] init];
67 action.userType = [NSNumber numberWithInt:0];
68 action.functionNo = @"A2012080002";
69 action.actionData = receiveTime;
70 action.actionName = @"VIPCard"
71
72NSMutableDictionary *employes = [NSMutableDictionary dictionary];
73 [employes setObject:action.userType forKey:@"userType"];
74 [employes setObject:action.functionNo forKey:@"functionNo"];
75 [employes setObject:action.actionData forKey:@"actionData"];
76 [employes setObject:action.actionName forKey:@"actionName"];
77 NSMutableDictionary *employes1 = [NSMutableDictionary dictionary];
78 DataObject * firstObject = [[[DataObject alloc] init] autorelease];
79 firstObject.data = [NSNumber numberWithInt:[employes count]];
80 firstObject.type = EDataTypeNumber;
81 [employes1 setObject:firstObject forKey:@"logList"] ;
82
83
84 [[FunctionArray shareFunctionArray].addCard addObject:employes1];
85 [action release];
86
87- (void)applicationWillEnterForeground:(UIApplication *)application {
88
89[commMngr functionLog:@"3.0.0" userID:[[NSUserDefaults standardUserDefaults] objectForKey:@"acceptUserID"]SecretKey:[[NSUserDefaults standardUserDefaults] objectForKey:@"SecurityKey"]logList:temp.addCard];
90ï½
91
92//temp Is a global variable
93//addCard Is a variable array
94@interface WAVEYNO2AppDelegate : NSObject <UIApplicationDelegate> {FunctionArray *temp;
95
96}
97- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
98temp=[FunctionArray shareFunctionArray];
99ï½
100
101
102
103//Call this method
104
105 -(void)functionLog:(NSString *)versionID userID:(NSString *)userID SecretKey:(NSString *)SecretKey logList:(NSArray *)logList{
106if(versionID || logList ||SecretKey ||userID){
107 WYRequest * pRequest = [[[WYRequest alloc] init] autorelease];
108 pRequest.type = ERequestTypeSubmitFunctionLog;
109 NSMutableDictionary *dataDic = [pRequest passInData];
110
111
112
113 if (versionID) {
114 DataObject * verData = [[[DataObject alloc] init] autorelease];
115 verData.data = versionID;
116 verData.type = EDataTypeString;
117 [dataDic setObject:verData forKey:@"versionID"];
118 }
119
120 if (userID) {
121 DataObject * useridData = [[[DataObject alloc] init] autorelease];
122 useridData.data = userID;
123 useridData.type = EDataTypeNumber;
124 [dataDic setObject:useridData forKey:@"userID"];
125 }
126
127 if (logList) {
128 DataObject * logListData = [[[DataObject alloc] init] autorelease];
129 logListData.data = logList;
130 logListData.type = EDataTypeArrayJSONObj;
131 [dataDic setObject:logListData forKey:@"logList"];
132 }
133
134 if (SecretKey) {
135 DataObject * SecretKeyData = [[[DataObject alloc] init] autorelease];
136 SecretKeyData.data = SecretKey;
137 SecretKeyData.type = EDataTypeString;
138 [dataDic setObject:SecretKeyData forKey:@"SecretKey"];
139 }
140
141 [self addRequest:pRequest];
142} else {
143
144}
145
146//Classes involved here
147 enum DataType {
148 EDataTypeNone = 0,
149 EDataTypeString,
150 EDataTypeNumber,
151 EDataTypeArray,
152 EDataTypeArrayJSONObj
153};
154
155@interface DataObject : NSObject {
156 enum DataType myType;
157 id myData;
158}
159
160-(id)init;
161@property (nonatomic, readwrite, assign) enum DataType type;
162@property (nonatomic, readwrite, retain) id data;
163@end
164
165
166
167#import "FunctionArray.h"
168static FunctionArray *_functionArray = nil;
169
170@implementation FunctionArray
171
172@synthesize addCard;
173
174+(FunctionArray *)shareFunctionArray
175{
176 if (!_functionArray) {
177 _functionArray = [[FunctionArray alloc]init];
178
179 }
180 return _functionArray;
181}
182
183Pass the value of my network server format so
184{“userIDâ€:17,â€userTypeâ€:0,SecretKey":"C9998D538ADF240CCE71CBB52552A107"â€logListâ€:[{â€functionNoâ€:20120005,â€actionDateâ€: "2012-08-26 16:19:47",â€actionNameâ€;â€seeâ€},{â€functionNoâ€:20120005,â€actionDateâ€: "2012-08-26 16:19:47",â€actionNameâ€;â€shopâ€},{â€functionNoâ€:20120005,â€actionDateâ€: "2012-08-26 16:19:47",â€actionNameâ€;â€busâ€},{â€functionNoâ€:20120005,â€actionDateâ€: "2012-08-26 16:19:47",â€actionNameâ€;â€vioâ€},{â€functionNoâ€:20120005,â€actionDateâ€: "2012-08-26 16:19:47",â€actionNameâ€;â€vipâ€},{â€functionNoâ€:20120005,â€actionDateâ€: "2012-08-26 16:19:47",â€actionNameâ€;â€exitâ€}]}