Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- NSMutableArray * vcardIDList = [[[NSMutableArray alloc] initWithCapacity:0] autorelease];
- for (int i = 0; i < [[CardManager sharedInstance] businessCardCount]; i++) {
- BusinessCard * myBusinessCard = [[CardManager sharedInstance] getBusinessCardAtIndex:i];
- if (myBusinessCard.isSelected == YES) {
- NSMutableDictionary *userID = [[[NSMutableDictionary alloc] initWithCapacity:0] autorelease];
- DataObject * firstObject = [[[DataObject alloc] init] autorelease];
- firstObject.data = [NSNumber numberWithInt:[myBusinessCard cardId]];
- firstObject.type = EDataTypeNumber;
- [userID setObject:firstObject forKey:@"vcardID"];
- [commMngr deleteVcardList:@"3.0.0" userID:[[NSUserDefaults standardUserDefaults] objectForKey:@"acceptUserID"] vcardIDList:vcardIDList SecretKey:[[NSUserDefaults standardUserDefaults] objectForKey:@"SecurityKey"]];
- //Using this method call object
- -(void)deleteVcardList:(NSString *)versionID userID:(NSString *)userID vcardIDList:(NSArray *)vcardIDList SecretKey:(NSString *)SecretKey{
- if(versionID || vcardIDList ||SecretKey ||userID){
- WYRequest * pRequest = [[[WYRequest alloc] init] autorelease];
- pRequest.type = ERequestTypeDeleteVcardList;
- NSMutableDictionary *dataDic = [pRequest passInData];
- if (versionID) {
- DataObject * verData = [[[DataObject alloc] init] autorelease];
- verData.data = versionID;
- verData.type = EDataTypeString;
- [dataDic setObject:verData forKey:@"versionID"];
- }
- if (userID) {
- DataObject * useridData = [[[DataObject alloc] init] autorelease];
- useridData.data = userID;
- useridData.type = EDataTypeNumber;
- [dataDic setObject:useridData forKey:@"userID"];
- }
- if (vcardIDList) {
- DataObject * vcardListData = [[[DataObject alloc] init] autorelease];
- vcardListData.data = vcardIDList;
- vcardListData.type = EDataTypeArrayJSONObj;
- [dataDic setObject:vcardListData forKey:@"vcardIDList"];
- }
- if (SecretKey) {
- DataObject * SecretKeyData = [[[DataObject alloc] init] autorelease];
- SecretKeyData.data = SecretKey;
- SecretKeyData.type = EDataTypeString;
- [dataDic setObject:SecretKeyData forKey:@"SecretKey"];
- }
- [self addRequest:pRequest];
- } else {
- //need log
- NSLog(@"%@", @"Invalid deleteVcardList");
- }
- Case of success here ::: parameters of the request to the server to remove the contact print out this
- {"versionID":"3.0.0","userID":18,"SecretKey":"C9998D538ADF240CCE71CBB52552A107","vcardIDList":[{"vcardID":350},{"vcardID":215},{"vcardID":212}]}
- I also use this mode do I click statistics I was doing
- { NSDate * now = [NSDate date];
- NSDateFormatter* formatter = [[NSDateFormatter alloc] init];
- [formatter setDateFormat:@"yyyy-MM-dd hh:mm:ss"];
- NSString* receiveTime = [formatter stringFromDate:now];
- Action *action=[[Action alloc] init];
- action.userType = [NSNumber numberWithInt:0];
- action.functionNo = @"A2012080002";
- action.actionData = receiveTime;
- action.actionName = @"VIPCard"
- NSMutableDictionary *employes = [NSMutableDictionary dictionary];
- [employes setObject:action.userType forKey:@"userType"];
- [employes setObject:action.functionNo forKey:@"functionNo"];
- [employes setObject:action.actionData forKey:@"actionData"];
- [employes setObject:action.actionName forKey:@"actionName"];
- NSMutableDictionary *employes1 = [NSMutableDictionary dictionary];
- DataObject * firstObject = [[[DataObject alloc] init] autorelease];
- firstObject.data = [NSNumber numberWithInt:[employes count]];
- firstObject.type = EDataTypeNumber;
- [employes1 setObject:firstObject forKey:@"logList"] ;
- [[FunctionArray shareFunctionArray].addCard addObject:employes1];
- [action release];
- - (void)applicationWillEnterForeground:(UIApplication *)application {
- [commMngr functionLog:@"3.0.0" userID:[[NSUserDefaults standardUserDefaults] objectForKey:@"acceptUserID"]SecretKey:[[NSUserDefaults standardUserDefaults] objectForKey:@"SecurityKey"]logList:temp.addCard];
- }
- //temp Is a global variable
- //addCard Is a variable array
- @interface WAVEYNO2AppDelegate : NSObject <UIApplicationDelegate> {FunctionArray *temp;
- }
- - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
- temp=[FunctionArray shareFunctionArray];
- }
- //Call this method
- -(void)functionLog:(NSString *)versionID userID:(NSString *)userID SecretKey:(NSString *)SecretKey logList:(NSArray *)logList{
- if(versionID || logList ||SecretKey ||userID){
- WYRequest * pRequest = [[[WYRequest alloc] init] autorelease];
- pRequest.type = ERequestTypeSubmitFunctionLog;
- NSMutableDictionary *dataDic = [pRequest passInData];
- if (versionID) {
- DataObject * verData = [[[DataObject alloc] init] autorelease];
- verData.data = versionID;
- verData.type = EDataTypeString;
- [dataDic setObject:verData forKey:@"versionID"];
- }
- if (userID) {
- DataObject * useridData = [[[DataObject alloc] init] autorelease];
- useridData.data = userID;
- useridData.type = EDataTypeNumber;
- [dataDic setObject:useridData forKey:@"userID"];
- }
- if (logList) {
- DataObject * logListData = [[[DataObject alloc] init] autorelease];
- logListData.data = logList;
- logListData.type = EDataTypeArrayJSONObj;
- [dataDic setObject:logListData forKey:@"logList"];
- }
- if (SecretKey) {
- DataObject * SecretKeyData = [[[DataObject alloc] init] autorelease];
- SecretKeyData.data = SecretKey;
- SecretKeyData.type = EDataTypeString;
- [dataDic setObject:SecretKeyData forKey:@"SecretKey"];
- }
- [self addRequest:pRequest];
- } else {
- }
- //Classes involved here
- enum DataType {
- EDataTypeNone = 0,
- EDataTypeString,
- EDataTypeNumber,
- EDataTypeArray,
- EDataTypeArrayJSONObj
- };
- @interface DataObject : NSObject {
- enum DataType myType;
- id myData;
- }
- -(id)init;
- @property (nonatomic, readwrite, assign) enum DataType type;
- @property (nonatomic, readwrite, retain) id data;
- @end
- #import "FunctionArray.h"
- static FunctionArray *_functionArray = nil;
- @implementation FunctionArray
- @synthesize addCard;
- +(FunctionArray *)shareFunctionArray
- {
- if (!_functionArray) {
- _functionArray = [[FunctionArray alloc]init];
- }
- return _functionArray;
- }
- Pass the value of my network server format so
- {“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”}]}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement