|
|
@@ -561,102 +561,102 @@
|
|
|
return nil;
|
|
|
|
|
|
}
|
|
|
-+(PageData*) get_pagedata: (NSMutableDictionary *) params
|
|
|
-{
|
|
|
-
|
|
|
- DebugLog(@"get_pagedata");
|
|
|
- if(![NetworkUtils IsNetworkAvailable])
|
|
|
- return nil;
|
|
|
- AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
|
|
|
- [params setValue:@"handset_search" forKey:@"action"];
|
|
|
-// [params setValue:appDelegate.sessionid forKey:@"sessionid"];
|
|
|
- NSData* json=[self get_json:URL_REQUEST_RECORDS parameters:params file:nil];
|
|
|
- if (json==nil)
|
|
|
- {
|
|
|
- DebugLog(@"json is wrong");
|
|
|
- return nil;
|
|
|
- }
|
|
|
-
|
|
|
- NSError *error=nil;
|
|
|
- NSDictionary *jsobj = [NSJSONSerialization JSONObjectWithData:json options:NSJSONReadingMutableLeaves error:&error];
|
|
|
- if(jsobj)
|
|
|
- {
|
|
|
- int result = [[jsobj valueForKey:@"result"] intValue];
|
|
|
- if(result== AP_SESSION_EXPIRED)
|
|
|
- {
|
|
|
- [self Authorize:appDelegate.user password:appDelegate.password];
|
|
|
- json=[self get_json:URL_REQUEST_RECORDS parameters:params file:nil];
|
|
|
- if (json==nil)
|
|
|
- {
|
|
|
- DebugLog(@"json is wrong");
|
|
|
- return nil;
|
|
|
- }
|
|
|
- jsobj = [NSJSONSerialization JSONObjectWithData:json options:NSJSONReadingMutableLeaves error:&error];
|
|
|
- result = [[jsobj valueForKey:@"result"] intValue];
|
|
|
-
|
|
|
- }
|
|
|
- if(result!=AP_USER_AUTH)
|
|
|
- {
|
|
|
- DebugLog(@"USER NOT AUTHORIZED CODE=%d ",result);
|
|
|
- return nil;
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- NSDictionary* objrecords = [jsobj objectForKey:@"records"];
|
|
|
-
|
|
|
- PageData * pageData = [[PageData alloc] initWithRecords:objrecords];
|
|
|
- return pageData;
|
|
|
-
|
|
|
- }
|
|
|
- return nil;
|
|
|
-
|
|
|
-}
|
|
|
-+(int) get_recordcount: (NSMutableDictionary *) params// delegate:(id < NSURLConnectionDelegate >)delegate
|
|
|
-{
|
|
|
- DebugLog(@"get_recordcount");
|
|
|
- if(![NetworkUtils IsNetworkAvailable])
|
|
|
- return RESULT_NET_NOTAVAILABLE;
|
|
|
- AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
|
|
|
- [params setValue:@"handset_search_count" forKey:@"action"];
|
|
|
-// [params setValue:appDelegate.sessionid forKey:@"sessionid"];
|
|
|
-
|
|
|
- NSData* json=[self get_json:URL_REQUEST_COUNT parameters:params file:nil];
|
|
|
- if (json==nil)
|
|
|
- {
|
|
|
- DebugLog(@"json is wrong");
|
|
|
- return RESULT_NET_ERROR;
|
|
|
- }
|
|
|
-
|
|
|
- NSError *error=nil;
|
|
|
- NSDictionary *jsobj = [NSJSONSerialization JSONObjectWithData:json options:NSJSONReadingMutableLeaves error:&error];
|
|
|
- if(jsobj)
|
|
|
- {
|
|
|
- int result = [[jsobj valueForKey:@"result"] intValue];
|
|
|
- if(result== AP_SESSION_EXPIRED)
|
|
|
- {
|
|
|
- [self Authorize:appDelegate.user password:appDelegate.password];
|
|
|
- json=[self get_json:URL_REQUEST_COUNT parameters:params file:nil];
|
|
|
- if (json==nil)
|
|
|
- {
|
|
|
- DebugLog(@"json is wrong");
|
|
|
- return RESULT_NET_ERROR;
|
|
|
- }
|
|
|
- jsobj = [NSJSONSerialization JSONObjectWithData:json options:NSJSONReadingMutableLeaves error:&error];
|
|
|
- result = [[jsobj valueForKey:@"result"] intValue];
|
|
|
-
|
|
|
- }
|
|
|
- if(result!=AP_USER_AUTH)
|
|
|
- {
|
|
|
- DebugLog(@"USER NOT AUTHORIZED CODE=%d ",result);
|
|
|
- return RESULT_USERAUTH_ERROR;
|
|
|
-
|
|
|
- }
|
|
|
- else
|
|
|
- return [[jsobj valueForKey:@"count" ] intValue];
|
|
|
- }
|
|
|
-
|
|
|
- return RESULT_ERROR;
|
|
|
-}
|
|
|
+//+(PageData*) get_pagedata: (NSMutableDictionary *) params
|
|
|
+//{
|
|
|
+//
|
|
|
+// DebugLog(@"get_pagedata");
|
|
|
+// if(![NetworkUtils IsNetworkAvailable])
|
|
|
+// return nil;
|
|
|
+// AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
|
|
|
+// [params setValue:@"handset_search" forKey:@"action"];
|
|
|
+//// [params setValue:appDelegate.sessionid forKey:@"sessionid"];
|
|
|
+// NSData* json=[self get_json:URL_REQUEST_RECORDS parameters:params file:nil];
|
|
|
+// if (json==nil)
|
|
|
+// {
|
|
|
+// DebugLog(@"json is wrong");
|
|
|
+// return nil;
|
|
|
+// }
|
|
|
+//
|
|
|
+// NSError *error=nil;
|
|
|
+// NSDictionary *jsobj = [NSJSONSerialization JSONObjectWithData:json options:NSJSONReadingMutableLeaves error:&error];
|
|
|
+// if(jsobj)
|
|
|
+// {
|
|
|
+// int result = [[jsobj valueForKey:@"result"] intValue];
|
|
|
+// if(result== AP_SESSION_EXPIRED)
|
|
|
+// {
|
|
|
+// [self Authorize:appDelegate.user password:appDelegate.password];
|
|
|
+// json=[self get_json:URL_REQUEST_RECORDS parameters:params file:nil];
|
|
|
+// if (json==nil)
|
|
|
+// {
|
|
|
+// DebugLog(@"json is wrong");
|
|
|
+// return nil;
|
|
|
+// }
|
|
|
+// jsobj = [NSJSONSerialization JSONObjectWithData:json options:NSJSONReadingMutableLeaves error:&error];
|
|
|
+// result = [[jsobj valueForKey:@"result"] intValue];
|
|
|
+//
|
|
|
+// }
|
|
|
+// if(result!=AP_USER_AUTH)
|
|
|
+// {
|
|
|
+// DebugLog(@"USER NOT AUTHORIZED CODE=%d ",result);
|
|
|
+// return nil;
|
|
|
+//
|
|
|
+// }
|
|
|
+//
|
|
|
+// NSDictionary* objrecords = [jsobj objectForKey:@"records"];
|
|
|
+//
|
|
|
+// PageData * pageData = [[PageData alloc] initWithRecords:objrecords];
|
|
|
+// return pageData;
|
|
|
+//
|
|
|
+// }
|
|
|
+// return nil;
|
|
|
+//
|
|
|
+//}
|
|
|
+//+(int) get_recordcount: (NSMutableDictionary *) params// delegate:(id < NSURLConnectionDelegate >)delegate
|
|
|
+//{
|
|
|
+// DebugLog(@"get_recordcount");
|
|
|
+// if(![NetworkUtils IsNetworkAvailable])
|
|
|
+// return RESULT_NET_NOTAVAILABLE;
|
|
|
+// AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
|
|
|
+// [params setValue:@"handset_search_count" forKey:@"action"];
|
|
|
+//// [params setValue:appDelegate.sessionid forKey:@"sessionid"];
|
|
|
+//
|
|
|
+// NSData* json=[self get_json:URL_REQUEST_COUNT parameters:params file:nil];
|
|
|
+// if (json==nil)
|
|
|
+// {
|
|
|
+// DebugLog(@"json is wrong");
|
|
|
+// return RESULT_NET_ERROR;
|
|
|
+// }
|
|
|
+//
|
|
|
+// NSError *error=nil;
|
|
|
+// NSDictionary *jsobj = [NSJSONSerialization JSONObjectWithData:json options:NSJSONReadingMutableLeaves error:&error];
|
|
|
+// if(jsobj)
|
|
|
+// {
|
|
|
+// int result = [[jsobj valueForKey:@"result"] intValue];
|
|
|
+// if(result== AP_SESSION_EXPIRED)
|
|
|
+// {
|
|
|
+// [self Authorize:appDelegate.user password:appDelegate.password];
|
|
|
+// json=[self get_json:URL_REQUEST_COUNT parameters:params file:nil];
|
|
|
+// if (json==nil)
|
|
|
+// {
|
|
|
+// DebugLog(@"json is wrong");
|
|
|
+// return RESULT_NET_ERROR;
|
|
|
+// }
|
|
|
+// jsobj = [NSJSONSerialization JSONObjectWithData:json options:NSJSONReadingMutableLeaves error:&error];
|
|
|
+// result = [[jsobj valueForKey:@"result"] intValue];
|
|
|
+//
|
|
|
+// }
|
|
|
+// if(result!=AP_USER_AUTH)
|
|
|
+// {
|
|
|
+// DebugLog(@"USER NOT AUTHORIZED CODE=%d ",result);
|
|
|
+// return RESULT_USERAUTH_ERROR;
|
|
|
+//
|
|
|
+// }
|
|
|
+// else
|
|
|
+// return [[jsobj valueForKey:@"count" ] intValue];
|
|
|
+// }
|
|
|
+//
|
|
|
+// return RESULT_ERROR;
|
|
|
+//}
|
|
|
//+(bool) IsHostAvailable : (NSString*) url
|
|
|
//{
|
|
|
// Reachability *r = [Reachability reachabilityWithHostName:url];
|
|
|
@@ -1214,6 +1214,8 @@
|
|
|
|
|
|
+(void)Logout
|
|
|
{
|
|
|
+ return [self request_logout];
|
|
|
+
|
|
|
if(![NetworkUtils IsNetworkAvailable])
|
|
|
return ;//RESULT_NET_NOTAVAILABLE;
|
|
|
NSMutableDictionary* params = [[NSMutableDictionary alloc] init];
|
|
|
@@ -2456,4 +2458,163 @@
|
|
|
//
|
|
|
// return resultDic;
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
++(void) request_changepassword : (NSString*) newpass user:(NSString*) user oldpass:(NSString*) oldpass completionHandler:(resultHandler)result
|
|
|
+{
|
|
|
+
|
|
|
+// if(![NetworkUtils IsNetworkAvailable])
|
|
|
+// return RESULT_NET_NOTAVAILABLE;
|
|
|
+
|
|
|
+ AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
|
|
|
+
|
|
|
+
|
|
|
+ NSMutableDictionary * params = [[NSMutableDictionary alloc] init];
|
|
|
+ [params setValue:user forKey:@"user"];
|
|
|
+ [params setValue:oldpass forKey:@"oldpass"];
|
|
|
+ [params setValue:newpass forKey:@"newpass"];
|
|
|
+ [params setValue:@"Change Password" forKey:@"module_name"];
|
|
|
+ [params setValue:@"handset_search" forKey:@"action"];
|
|
|
+// [params setValue:appDelegate.sessionid forKey:@"sessionid"];
|
|
|
+
|
|
|
+
|
|
|
+ [self request_interface:URL_RETRIEVE_PASS parameters:params err_record_url:nil completionHandler:result retry:0];
|
|
|
+
|
|
|
+
|
|
|
+ return;
|
|
|
+// NSData* json=[self get_json:URL_RETRIEVE_PASS parameters:params file:nil];
|
|
|
+//
|
|
|
+//
|
|
|
+// if (json==nil)
|
|
|
+// {
|
|
|
+// DebugLog(@"json is wrong");
|
|
|
+// return RESULT_NET_ERROR;
|
|
|
+// }
|
|
|
+//
|
|
|
+// NSError *error=nil;
|
|
|
+// NSDictionary *jsobj = [NSJSONSerialization JSONObjectWithData:json options:NSJSONReadingMutableLeaves error:&error];
|
|
|
+// if(jsobj)
|
|
|
+// {
|
|
|
+// int result = [[jsobj valueForKey:@"result"] intValue];
|
|
|
+// if(result== AP_SESSION_EXPIRED)
|
|
|
+// {
|
|
|
+// [self Authorize:appDelegate.user password:appDelegate.password];
|
|
|
+// json=[self get_json:URL_RETRIEVE_PASS parameters:params file:nil];
|
|
|
+// if (json==nil)
|
|
|
+// {
|
|
|
+// DebugLog(@"json is wrong");
|
|
|
+// return RESULT_NET_ERROR;
|
|
|
+// }
|
|
|
+// jsobj = [NSJSONSerialization JSONObjectWithData:json options:NSJSONReadingMutableLeaves error:&error];
|
|
|
+// result = [[jsobj valueForKey:@"result"] intValue];
|
|
|
+//
|
|
|
+// }
|
|
|
+// if(result!=AP_USER_AUTH)
|
|
|
+// {
|
|
|
+// DebugLog(@"USER NOT AUTHORIZED CODE=%d ",result);
|
|
|
+// return RESULT_FALSE;
|
|
|
+//
|
|
|
+// }
|
|
|
+// return RESULT_TRUE;
|
|
|
+//
|
|
|
+// }
|
|
|
+// return RESULT_NET_ERROR;
|
|
|
+
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
++(void) request_retrievepassword : (NSString*) user email:(NSString*) email completionHandler:(resultHandler)result
|
|
|
+{
|
|
|
+
|
|
|
+// if(![NetworkUtils IsNetworkAvailable])
|
|
|
+// return RESULT_NET_NOTAVAILABLE;
|
|
|
+ NSMutableDictionary * params = [[NSMutableDictionary alloc] init];
|
|
|
+ [params setValue:user forKey:@"user"];
|
|
|
+ [params setValue:email forKey:@"email"];
|
|
|
+ [params setValue:@"Retrieve Password" forKey:@"module_name"];
|
|
|
+ [params setValue:@"handset_search" forKey:@"action"];
|
|
|
+
|
|
|
+ [self request_interface:URL_RETRIEVE_PASS parameters:params err_record_url:nil completionHandler:result retry:0];
|
|
|
+
|
|
|
+ return;
|
|
|
+//
|
|
|
+// NSData* json=[self get_json:URL_RETRIEVE_PASS parameters:params file:nil];
|
|
|
+// if (json==nil)
|
|
|
+// {
|
|
|
+// DebugLog(@"json is wrong");
|
|
|
+// return RESULT_NET_ERROR;
|
|
|
+// }
|
|
|
+//
|
|
|
+// NSError *error=nil;
|
|
|
+// NSDictionary *jsobj = [NSJSONSerialization JSONObjectWithData:json options:NSJSONReadingMutableLeaves error:&error];
|
|
|
+// if(jsobj)
|
|
|
+// {
|
|
|
+// int result = [[jsobj valueForKey:@"result"] intValue];
|
|
|
+// if(result!=AP_USER_AUTH)
|
|
|
+// {
|
|
|
+// DebugLog(@"USER NOT AUTHORIZED CODE=%d ",result);
|
|
|
+// return RESULT_FALSE;
|
|
|
+//
|
|
|
+// }
|
|
|
+// return RESULT_TRUE;
|
|
|
+//
|
|
|
+// }
|
|
|
+// return RESULT_NET_ERROR;
|
|
|
+//
|
|
|
+//
|
|
|
+}
|
|
|
+
|
|
|
++(void)request_logout
|
|
|
+{
|
|
|
+// if(![NetworkUtils IsNetworkAvailable])
|
|
|
+// return ;//RESULT_NET_NOTAVAILABLE;
|
|
|
+ NSMutableDictionary* params = [[NSMutableDictionary alloc] init];
|
|
|
+ AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
|
|
|
+ if(appDelegate.duid !=nil)
|
|
|
+ [params setValue:appDelegate.duid forKey:@"udid"];
|
|
|
+ [params setValue:@"handset_logout" forKey:@"action"];
|
|
|
+
|
|
|
+ [self request_interface:URL_UPDATE_AUTH parameters:params err_record_url:nil completionHandler:nil retry:0];
|
|
|
+ return;
|
|
|
+// [self post_without_return :URL_UPDATE_AUTH parameters:params];
|
|
|
+}
|
|
|
+
|
|
|
++ (void)request_sendemail:(NSString *)email CC:(NSString *)cc SerialNo:(NSString *)serialNo completionHandler:(resultHandler)result
|
|
|
+{
|
|
|
+
|
|
|
+ if (!email) {
|
|
|
+ email = @"";
|
|
|
+ }
|
|
|
+ if (!serialNo) {
|
|
|
+ serialNo = @"";
|
|
|
+ }
|
|
|
+
|
|
|
+ NSMutableDictionary *params = [NSMutableDictionary dictionary];
|
|
|
+ [params setObject:@"handset_search" forKey:@"action"];
|
|
|
+ [params setObject:@"save_communication_email" forKey:@"action_type"];
|
|
|
+ [params setObject:serialNo forKey:@"serial_no"];
|
|
|
+ [params setObject:email forKey:@"msg"];
|
|
|
+
|
|
|
+ if (cc) {
|
|
|
+ [params setObject:cc forKey:@"cc"];
|
|
|
+ }
|
|
|
+
|
|
|
+ [self request_interface:URL_SEND_COMM_EMAIL parameters:params err_record_url:nil completionHandler:result retry:0];
|
|
|
+//
|
|
|
+// NSData* json=[self get_json:URL_SEND_COMM_EMAIL parameters:params file:nil];
|
|
|
+//
|
|
|
+// if (json==nil)
|
|
|
+// {
|
|
|
+// return @{
|
|
|
+// @"result" : @RESULT_NET_ERROR,
|
|
|
+// @"err_msg" : MSG_NET_ERROR
|
|
|
+// };
|
|
|
+// }
|
|
|
+//
|
|
|
+// NSDictionary *resultDic = [NSJSONSerialization JSONObjectWithData:json options:NSJSONReadingMutableLeaves error:nil];
|
|
|
+//
|
|
|
+// return resultDic;
|
|
|
+
|
|
|
+}
|
|
|
@end
|