| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- //
- // OfflineUnlockViewController.m
- // iSales-NPD
- //
- // Created by Ray on 10/10/16.
- // Copyright © 2016 United Software Applications, Inc. All rights reserved.
- //
- #import "OfflineUnlockViewController.h"
- #import "RAUtils.h"
- #import "iSalesDB.h"
- #import "AESCrypt.h"
- @interface OfflineUnlockViewController ()
- @end
- @implementation OfflineUnlockViewController
- - (void)viewDidLoad {
- [super viewDidLoad];
- // Do any additional setup after loading the view.
- }
- - (void)didReceiveMemoryWarning {
- [super didReceiveMemoryWarning];
- // Dispose of any resources that can be recreated.
- }
- - (IBAction)OnUnlockClicked:(id)sender {
- NSString* user = self.edituser.text;
- NSString* password = self.editpass.text;
-
-
- // NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
-
-
- if(user.length==0||password.length==0)
- {
- [RAUtils message_box:@"Unlock offline" message:@"Username or Password cannot be blank." completion:nil];
- // [RAUtils alert_view:@"Username or Password cannot be blank." title:@"Unlock offline"];
- return;
- }
-
- sqlite3* db = [iSalesDB get_db];
- int offline_user_exist=[iSalesDB get_recordcount:db table:@"offline_login" where:[NSString stringWithFormat:@"lower(username)='%@' and password='%@'",user.lowercaseString ,[AESCrypt encrypt:password password:@"usai"]]];
-
- [iSalesDB close_db:db];
-
- if(offline_user_exist>0)
- [self dismissViewControllerAnimated:YES completion:^{
-
- if(self.returnValue)
- self.returnValue(true);
- }];
- else
- {
-
-
- [RAUtils message_box:@"Unlock offline" message:MSG_USERAUTH_ERROR completion:nil];
- // [RAUtils alert_view:MSG_USERAUTH_ERROR title:@"Unlock offline"];
- }
-
- }
- - (IBAction)CloseClick:(id)sender {
-
- [self dismissViewControllerAnimated:YES completion:^{
- if(self.returnValue)
- self.returnValue(false);
- }];
-
-
-
- }
- /*
- #pragma mark - Navigation
- // In a storyboard-based application, you will often want to do a little preparation before navigation
- - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
- // Get the new view controller using [segue destinationViewController].
- // Pass the selected object to the new view controller.
- }
- */
- @end
|