|
|
@@ -41,7 +41,7 @@
|
|
|
#endif
|
|
|
self.showList = false;
|
|
|
|
|
|
-
|
|
|
+
|
|
|
self.bb_close.image=[[UIImage imageNamed:@"close"] imageWithRenderingMode:UIImageRenderingModeAutomatic];
|
|
|
|
|
|
[self.checkSavePassword setImage:[UIImage imageNamed:@"checkbox"] forState:UIControlStateNormal];
|
|
|
@@ -66,12 +66,12 @@
|
|
|
self.checkSavePassword.selected=true;
|
|
|
|
|
|
}
|
|
|
- // NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
|
|
|
-// [defaults removeObjectForKey:@"EnableOfflineMode"];
|
|
|
-// [defaults setBool:self.checkOfflineMode.selected forKey:@"EnableOfflineMode"];
|
|
|
+ // NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
|
|
|
+ // [defaults removeObjectForKey:@"EnableOfflineMode"];
|
|
|
+ // [defaults setBool:self.checkOfflineMode.selected forKey:@"EnableOfflineMode"];
|
|
|
self.checkOfflineMode.selected=[defaults boolForKey:@"EnableOfflineMode"];
|
|
|
|
|
|
- [self.checkOfflineMode addTarget:self action:@selector(checkboxClick:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
+ [self.checkOfflineMode addTarget:self action:@selector(checkboxClick:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
|
|
|
[self.checkSavePassword addTarget:self action:@selector(checkboxClick:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
self.checkOfflineMode.tag=999;
|
|
|
@@ -82,7 +82,7 @@
|
|
|
|
|
|
UIButton* combobutton=[[UIButton alloc] initWithFrame:CGRectMake(0, 0, 24, 24)];
|
|
|
[combobutton setBackgroundImage:[UIImage imageNamed:@"combo_24"] forState:UIControlStateNormal];
|
|
|
- [combobutton addTarget:self action:@selector(LoginList:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
+ [combobutton addTarget:self action:@selector(LoginList:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
|
|
|
self.edituser.rightView = combobutton;
|
|
|
self.edituser.rightViewMode=UITextFieldViewModeAlways;
|
|
|
@@ -91,7 +91,7 @@
|
|
|
|
|
|
self.Loginlist.layer.borderColor = [UIColor lightGrayColor].CGColor;
|
|
|
self.Loginlist.layer.borderWidth = 1.0;
|
|
|
- // self.Loginlist.layer.cornerRadius=15;
|
|
|
+ // self.Loginlist.layer.cornerRadius=15;
|
|
|
self.Loginlist.layer.masksToBounds=true;
|
|
|
// Do any additional setup after loading the view.
|
|
|
}
|
|
|
@@ -99,7 +99,7 @@
|
|
|
[self.edituser endEditing:true];
|
|
|
self.showList= !self.showList;
|
|
|
self.Loginlist.hidden = !self.showList;
|
|
|
-// showList;
|
|
|
+ // showList;
|
|
|
}
|
|
|
-(void)checkboxClick:(UIButton *)btn
|
|
|
{
|
|
|
@@ -131,7 +131,7 @@
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
|
|
|
+ NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
|
|
|
[defaults removeObjectForKey:@"EnableOfflineMode"];
|
|
|
[defaults setBool:self.checkOfflineMode.selected forKey:@"EnableOfflineMode"];
|
|
|
|
|
|
@@ -139,15 +139,34 @@
|
|
|
AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
|
|
|
appDelegate.offline_mode = self.checkOfflineMode.selected;
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if(!btn.selected)
|
|
|
+ {
|
|
|
+ NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
|
|
|
+ [defaults removeObjectForKey:@"user"];
|
|
|
+ [defaults removeObjectForKey:@"password"];
|
|
|
+ [defaults synchronize];
|
|
|
+
|
|
|
+
|
|
|
+ NSString* encryptu=[AESCrypt encrypt:self.edituser.text password:@"usai"];
|
|
|
+
|
|
|
+ NSString* sql=[NSString stringWithFormat:@"delete from login_info where name='%@'",encryptu];
|
|
|
+ [iSalesDB execSql:sql];
|
|
|
+ self.logindata = [iSalesDB get_saveduser];
|
|
|
+ [self.Loginlist reloadData];
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
- (IBAction)CloseClick:(id)sender {
|
|
|
|
|
|
[self dismissViewControllerAnimated:true completion:nil];
|
|
|
- if(self.returnValue)
|
|
|
- self.returnValue(false);
|
|
|
+ if(self.returnValue)
|
|
|
+ self.returnValue(false);
|
|
|
|
|
|
|
|
|
|
|
|
@@ -165,12 +184,12 @@
|
|
|
|
|
|
if(user.length==0||password.length==0)
|
|
|
{
|
|
|
-// UIAlertView * alert = [[UIAlertView alloc] initWithTitle: @"Error!" message:@"user or password can not be empty." delegate:nil cancelButtonTitle:NSLocalizedString(@"ok", nil) otherButtonTitles:nil, nil];
|
|
|
-// // UIAlertView *alert=[[UIAlertView alloc]initWithTitle:@"Error!" message:@"User&Password can not be empty!" delegate:nil cancelButtonTitle:NSLocalizedString(@"ok", nil) , nil];
|
|
|
-//
|
|
|
-//
|
|
|
-// //[[UILabel appearanceWhenContainedIn:UIAlertView.class, nil] setAppearanceFont:[UIFont boldSystemFontOfSize:10]];
|
|
|
-// [alert show];
|
|
|
+ // UIAlertView * alert = [[UIAlertView alloc] initWithTitle: @"Error!" message:@"user or password can not be empty." delegate:nil cancelButtonTitle:NSLocalizedString(@"ok", nil) otherButtonTitles:nil, nil];
|
|
|
+ // // UIAlertView *alert=[[UIAlertView alloc]initWithTitle:@"Error!" message:@"User&Password can not be empty!" delegate:nil cancelButtonTitle:NSLocalizedString(@"ok", nil) , nil];
|
|
|
+ //
|
|
|
+ //
|
|
|
+ // //[[UILabel appearanceWhenContainedIn:UIAlertView.class, nil] setAppearanceFont:[UIFont boldSystemFontOfSize:10]];
|
|
|
+ // [alert show];
|
|
|
|
|
|
|
|
|
[RAUtils alert_view:@"User or password cannot be empty." title:@"Input Error!"];
|
|
|
@@ -179,7 +198,7 @@
|
|
|
DebugLog(@"Login... user= %@ ; password= %@",user,password);
|
|
|
|
|
|
|
|
|
-
|
|
|
+
|
|
|
|
|
|
self.btnLogin.enabled = false;
|
|
|
UIAlertView * waitalert = [RAUtils waiting_alert:@"Please wait..." title:@"Sign in"];
|
|
|
@@ -196,11 +215,11 @@
|
|
|
|
|
|
{
|
|
|
|
|
|
-//
|
|
|
-// NSString* contactid=[self.content_data[indexPath.row] valueForKey:@"contact_id"] ;
|
|
|
+ //
|
|
|
+ // NSString* contactid=[self.content_data[indexPath.row] valueForKey:@"contact_id"] ;
|
|
|
AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
|
|
|
-// appDelegate.contact_id=contactid;
|
|
|
-// appDelegate.contact_name =[self.content_data[indexPath.row] valueForKey:@"name"];
|
|
|
+ // appDelegate.contact_id=contactid;
|
|
|
+ // appDelegate.contact_name =[self.content_data[indexPath.row] valueForKey:@"name"];
|
|
|
|
|
|
NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
|
|
|
[defaults removeObjectForKey:@"user"];
|
|
|
@@ -218,9 +237,9 @@
|
|
|
|
|
|
if(count==0)
|
|
|
{
|
|
|
-
|
|
|
- NSString * savelogin=[NSString stringWithFormat:@"insert into login_info(name,pwd) values('%@','%@')",encryptu,encryptp];
|
|
|
- [iSalesDB execSql:savelogin db:db];
|
|
|
+
|
|
|
+ NSString * savelogin=[NSString stringWithFormat:@"insert into login_info(name,pwd) values('%@','%@')",encryptu,encryptp];
|
|
|
+ [iSalesDB execSql:savelogin db:db];
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
@@ -229,8 +248,8 @@
|
|
|
}
|
|
|
|
|
|
[iSalesDB close_db:db];
|
|
|
-
|
|
|
-// [defaults setBool:TRUE forKey:@"autologin"];
|
|
|
+
|
|
|
+ // [defaults setBool:TRUE forKey:@"autologin"];
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
@@ -243,16 +262,16 @@
|
|
|
if(self.returnValue)
|
|
|
self.returnValue(true);
|
|
|
|
|
|
-// if (self.delegate && [self.delegate respondsToSelector:@selector(LoginViewControllerDidLogin:)]) {
|
|
|
-// [self.delegate LoginViewControllerDidLogin:self];
|
|
|
-// }
|
|
|
+ // if (self.delegate && [self.delegate respondsToSelector:@selector(LoginViewControllerDidLogin:)]) {
|
|
|
+ // [self.delegate LoginViewControllerDidLogin:self];
|
|
|
+ // }
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
NSString* msg=nil;
|
|
|
|
|
|
switch (ret) {
|
|
|
-
|
|
|
+
|
|
|
case RESULT_NET_NOTAVAILABLE:
|
|
|
msg = MSG_NET_NOTAVAILABLE;
|
|
|
break;
|
|
|
@@ -280,7 +299,7 @@
|
|
|
|
|
|
[RAUtils alert_view:msg title:@"Sign in"];
|
|
|
|
|
|
-
|
|
|
+
|
|
|
|
|
|
}
|
|
|
|
|
|
@@ -329,14 +348,14 @@
|
|
|
UITableViewCell * cell= [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
|
|
|
NSString* name=up[@"name"];
|
|
|
cell.textLabel.text = name;
|
|
|
- return cell;
|
|
|
-
|
|
|
+ return cell;
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
|
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
|
|
|
{
|
|
|
-
|
|
|
+
|
|
|
NSMutableDictionary* up = self.logindata[indexPath.row];
|
|
|
self.edituser.text = up[@"name"];
|
|
|
self.editpass.text = up[@"pwd"];
|
|
|
@@ -344,7 +363,7 @@
|
|
|
self.showList=false;
|
|
|
self.Loginlist.hidden=true;
|
|
|
self.checkSavePassword.selected=true;
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
//- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField
|
|
|
//{
|