Просмотр исходного кода

Move app delegate user to rasgngleton

Ray Zhang 2 лет назад
Родитель
Сommit
102abf5dfe
37 измененных файлов с 327 добавлено и 323 удалено
  1. 1 1
      RedAnt ERP Mobile/GoogleAnalytics/GoogleAnalyst.m
  2. 1 1
      RedAnt ERP Mobile/HMLG Scan Order/CartViewController.m
  3. 20 20
      RedAnt ERP Mobile/HMLG Scan Order/MainViewController.m
  4. 2 2
      RedAnt ERP Mobile/HMLG Scan Order/ServerSettingViewController.m
  5. 1 1
      RedAnt ERP Mobile/common/AppDelegateBase.h
  6. 19 19
      RedAnt ERP Mobile/common/AppDelegateBase.m
  7. 17 17
      RedAnt ERP Mobile/common/Functions/MainViewController.m
  8. 7 7
      RedAnt ERP Mobile/common/Functions/OLO/ScanOrderListViewController.m
  9. 1 1
      RedAnt ERP Mobile/common/Functions/address/AddressEditorViewController.m
  10. 1 1
      RedAnt ERP Mobile/common/Functions/cart/CartViewController.m
  11. 2 2
      RedAnt ERP Mobile/common/Functions/category/CategoryViewController.m
  12. 1 1
      RedAnt ERP Mobile/common/Functions/contact/ContactAdvanceSearchViewController.m
  13. 1 1
      RedAnt ERP Mobile/common/Functions/contact/CustomerEditViewController.m
  14. 1 1
      RedAnt ERP Mobile/common/Functions/contact/CustomerInfoViewController.m
  15. 1 1
      RedAnt ERP Mobile/common/Functions/creditcard/CreditCardEditorViewController.m
  16. 1 1
      RedAnt ERP Mobile/common/Functions/modelDetail/DetailHeaderCell.m
  17. 2 2
      RedAnt ERP Mobile/common/Functions/modelDetail/DetailViewController.m
  18. 14 14
      RedAnt ERP Mobile/common/Functions/offline/OLDataProvider.m
  19. 2 2
      RedAnt ERP Mobile/common/Functions/offline/OfflineSettingViewController.m
  20. 1 1
      RedAnt ERP Mobile/common/Functions/offline/SyncControlPanelViewController.m
  21. 7 7
      RedAnt ERP Mobile/common/Functions/order/CreateOrderViewController.m
  22. 6 6
      RedAnt ERP Mobile/common/Functions/order/OrderDetailViewController.m
  23. 4 4
      RedAnt ERP Mobile/common/Functions/order/OrderListViewController.m
  24. 1 1
      RedAnt ERP Mobile/common/Functions/order/RAOrderEditorViewController.m
  25. 1 1
      RedAnt ERP Mobile/common/Functions/order/RAOrderPreviewController.m
  26. 1 1
      RedAnt ERP Mobile/common/Functions/portfolio/PortfolioListViewController.m
  27. 1 1
      RedAnt ERP Mobile/common/Functions/portfolio/TearSheetParamViewController.m
  28. 2 2
      RedAnt ERP Mobile/common/Functions/search+itemsearch/ItemSearchViewController.m
  29. 2 2
      RedAnt ERP Mobile/common/Functions/search+itemsearch/SearchViewController.m
  30. 2 2
      RedAnt ERP Mobile/common/Functions/sidemenu/LoginViewController.m
  31. 5 5
      RedAnt ERP Mobile/common/Functions/sidemenu/UserListViewController.m
  32. 5 1
      RedAnt ERP Mobile/common/RASingleton.m
  33. 2 2
      RedAnt ERP Mobile/common/customUI/ImageUploadViewController.m
  34. 8 8
      RedAnt ERP Mobile/common/data_provider/RADataProvider.m
  35. 181 181
      RedAnt ERP Mobile/common/data_provider/RANetwork.m
  36. 1 1
      RedAnt ERP Mobile/common/data_provider/iSalesDB.m
  37. 2 2
      common/NetworkUtils.m

+ 1 - 1
RedAnt ERP Mobile/GoogleAnalytics/GoogleAnalyst.m

@@ -120,7 +120,7 @@
     // 自定义维度
     // 自定义维度
     NSString *dimensionValue1 = productName;
     NSString *dimensionValue1 = productName;
     [tracker set:[GAIFields customDimensionForIndex:1] value:dimensionValue1]; // Model Name
     [tracker set:[GAIFields customDimensionForIndex:1] value:dimensionValue1]; // Model Name
-    NSString *dimensionValue2 = appDelegate.user;
+    NSString *dimensionValue2 = RASingleton.sharedInstance.user;
     [tracker set:[GAIFields customDimensionForIndex:2] value:dimensionValue2]; // User Name
     [tracker set:[GAIFields customDimensionForIndex:2] value:dimensionValue2]; // User Name
     NSString *dimensionValue3 = appDelegate.customerInfo[@"customer_name"];
     NSString *dimensionValue3 = appDelegate.customerInfo[@"customer_name"];
     [tracker set:[GAIFields customDimensionForIndex:3] value:dimensionValue3]; // Customer Name
     [tracker set:[GAIFields customDimensionForIndex:3] value:dimensionValue3]; // Customer Name

+ 1 - 1
RedAnt ERP Mobile/HMLG Scan Order/CartViewController.m

@@ -592,7 +592,7 @@
 
 
     // Shop 权限检查
     // Shop 权限检查
     AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
     AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-    if (appDelegate.user && appDelegate.user_type == USER_ROLE_CUSTOMER && appDelegate.customer_type == CustomerTypeStore) {
+    if (RASingleton.sharedInstance.user && appDelegate.user_type == USER_ROLE_CUSTOMER && appDelegate.customer_type == CustomerTypeStore) {
         if (![RASingleton sharedInstance].permissions_edit_order) {
         if (![RASingleton sharedInstance].permissions_edit_order) {
             
             
             CGRect frame0 = self.cancelOrderButton.frame;
             CGRect frame0 = self.cancelOrderButton.frame;

+ 20 - 20
RedAnt ERP Mobile/HMLG Scan Order/MainViewController.m

@@ -99,7 +99,7 @@
 //   userVC.returnValue=^(NSString* user)
 //   userVC.returnValue=^(NSString* user)
 //    {
 //    {
 ////        self.btnContact.hidden = false;
 ////        self.btnContact.hidden = false;
-//        appDelegate.user = user;
+//        RASingleton.sharedInstance.user = user;
 //        [self.buttonUser setTitle:user forState:UIControlStateNormal];
 //        [self.buttonUser setTitle:user forState:UIControlStateNormal];
 //
 //
 //        [self refreshContactDisplay];
 //        [self refreshContactDisplay];
@@ -329,9 +329,9 @@
     [self initMenuItems];
     [self initMenuItems];
     AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
     AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
     
     
-    self.sideMenu_UserName.text =appDelegate.user;
+    self.sideMenu_UserName.text =RASingleton.sharedInstance.user;
     
     
-    [self.btn_sideMenu_UserName setTitle:appDelegate.user forState:UIControlStateNormal];
+    [self.btn_sideMenu_UserName setTitle:RASingleton.sharedInstance.user forState:UIControlStateNormal];
     
     
     if(appDelegate.bLogin)
     if(appDelegate.bLogin)
         [self.btnLogin setTitle:@"Sign out" forState:UIControlStateNormal];
         [self.btnLogin setTitle:@"Sign out" forState:UIControlStateNormal];
@@ -386,7 +386,7 @@
     [self.btnContact setTitle:contact_string forState:UIControlStateNormal];
     [self.btnContact setTitle:contact_string forState:UIControlStateNormal];
     
     
     //    if(appDelegate.bLogin)
     //    if(appDelegate.bLogin)
-    //        [self.buttonUser setTitle:appDelegate.user forState:UIControlStateNormal];
+    //        [self.buttonUser setTitle:RASingleton.sharedInstance.user forState:UIControlStateNormal];
     //    else
     //    else
     //        [self.buttonUser setTitle:@"Sign in" forState:UIControlStateNormal];
     //        [self.buttonUser setTitle:@"Sign in" forState:UIControlStateNormal];
     
     
@@ -1267,7 +1267,7 @@
     }
     }
     
     
     NSMutableDictionary* orderitem = [NSMutableDictionary new];
     NSMutableDictionary* orderitem = [NSMutableDictionary new];
-    orderitem[@"create_by"] = appDelegate.user;
+    orderitem[@"create_by"] = RASingleton.sharedInstance.user;
     
     
     orderitem[@"price"] = [RAConvertor currencyNumber:p+s];//[NSString stringWithFormat:@"%.2f",p+s];
     orderitem[@"price"] = [RAConvertor currencyNumber:p+s];//[NSString stringWithFormat:@"%.2f",p+s];
     orderitem[@"model_count"] =[ NSString stringWithFormat:@"%d",order_qty];
     orderitem[@"model_count"] =[ NSString stringWithFormat:@"%d",order_qty];
@@ -1317,10 +1317,10 @@
     
     
     DebugLog(@"header view login");
     DebugLog(@"header view login");
     AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
     AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-    if( appDelegate.user ==nil /*|| [appDelegate.user isEqualToString:@"GUEST"]*/)
+    if( RASingleton.sharedInstance.user ==nil /*|| [RASingleton.sharedInstance.user isEqualToString:@"GUEST"]*/)
     {
     {
 
 
-//        appDelegate.user = nil;
+//        RASingleton.sharedInstance.user = nil;
 //        appDelegate.password = nil;
 //        appDelegate.password = nil;
         LoginViewController * loginvc =[[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"LoginViewController"];
         LoginViewController * loginvc =[[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"LoginViewController"];
         //        loginvc.delegate = self;
         //        loginvc.delegate = self;
@@ -1519,8 +1519,8 @@
     [viewController dismissViewControllerAnimated:YES completion:^{
     [viewController dismissViewControllerAnimated:YES completion:^{
         AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
         AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
         
         
-        self.sideMenu_UserName.text =appDelegate.user;
-        [self.btn_sideMenu_UserName setTitle:appDelegate.user forState:UIControlStateNormal];
+        self.sideMenu_UserName.text =RASingleton.sharedInstance.user;
+        [self.btn_sideMenu_UserName setTitle:RASingleton.sharedInstance.user forState:UIControlStateNormal];
         
         
         [self.btnLogin setTitle:@"Sign out" forState:UIControlStateNormal];
         [self.btnLogin setTitle:@"Sign out" forState:UIControlStateNormal];
         
         
@@ -1566,7 +1566,7 @@
         
         
         [self.btnContact setTitle:contact_string forState:UIControlStateNormal];
         [self.btnContact setTitle:contact_string forState:UIControlStateNormal];
         
         
-        //    [self.buttonUser setTitle:appDelegate.user forState:UIControlStateNormal];
+        //    [self.buttonUser setTitle:RASingleton.sharedInstance.user forState:UIControlStateNormal];
         
         
         
         
         
         
@@ -1957,7 +1957,7 @@
     NSMutableDictionary* map = [[NSMutableDictionary alloc] init];
     NSMutableDictionary* map = [[NSMutableDictionary alloc] init];
     
     
     
     
-    if(appDelegate.user!=nil)
+    if(RASingleton.sharedInstance.user!=nil)
     {
     {
         [map setValue:@"Wish List" forKey:@"title"];
         [map setValue:@"Wish List" forKey:@"title"];
         [map setValue:@"rect_market_news" forKey:@"img"];
         [map setValue:@"rect_market_news" forKey:@"img"];
@@ -2054,12 +2054,12 @@
     }
     }
 #endif
 #endif
     
     
-    if (appDelegate.user && appDelegate.user_type == USER_ROLE_CUSTOMER && appDelegate.customer_type == CustomerTypeStore ) {
+    if (RASingleton.sharedInstance.user && appDelegate.user_type == USER_ROLE_CUSTOMER && appDelegate.customer_type == CustomerTypeStore ) {
         [map setValue:@"Price Setting" forKey:@"title"];
         [map setValue:@"Price Setting" forKey:@"title"];
         //        [map setValue:@"rect_market_news" forKey:@"img"];
         //        [map setValue:@"rect_market_news" forKey:@"img"];
         [self.sideMenuItems addObject:map.copy];
         [self.sideMenuItems addObject:map.copy];
     }
     }
-    if (appDelegate.user && appDelegate.user_type == USER_ROLE_CUSTOMER && appDelegate.customer_type == CustomerTypeStore ) {
+    if (RASingleton.sharedInstance.user && appDelegate.user_type == USER_ROLE_CUSTOMER && appDelegate.customer_type == CustomerTypeStore ) {
         if ([RASingleton sharedInstance].global_lock) {
         if ([RASingleton sharedInstance].global_lock) {
             [map setValue:@"Unlock" forKey:@"title"];
             [map setValue:@"Unlock" forKey:@"title"];
         } else {
         } else {
@@ -2081,12 +2081,12 @@
         
         
     }
     }
  */
  */
-//    if (appDelegate.user && appDelegate.user_type == USER_ROLE_CUSTOMER) {
+//    if (RASingleton.sharedInstance.user && appDelegate.user_type == USER_ROLE_CUSTOMER) {
 //        [map setValue:@"Price Setting" forKey:@"title"];
 //        [map setValue:@"Price Setting" forKey:@"title"];
 //        //        [map setValue:@"rect_market_news" forKey:@"img"];
 //        //        [map setValue:@"rect_market_news" forKey:@"img"];
 //        [self.sideMenuItems addObject:map.copy];
 //        [self.sideMenuItems addObject:map.copy];
 //    }
 //    }
-    if (appDelegate.user && appDelegate.user_type == USER_ROLE_CUSTOMER && appDelegate.customer_type == CustomerTypeStore ) {
+    if (RASingleton.sharedInstance.user && appDelegate.user_type == USER_ROLE_CUSTOMER && appDelegate.customer_type == CustomerTypeStore ) {
         if ([Singleton sharedInstance].global_lock) {
         if ([Singleton sharedInstance].global_lock) {
             [map setValue:@"Unlock" forKey:@"title"];
             [map setValue:@"Unlock" forKey:@"title"];
         } else {
         } else {
@@ -2099,7 +2099,7 @@
 # endif
 # endif
     
     
 #ifdef DEBUG
 #ifdef DEBUG
-//    if([[appDelegate.user lowercaseString] isEqualToString:@"larryl"]||[[appDelegate.user lowercaseString] isEqualToString:@"arpithat"])
+//    if([[RASingleton.sharedInstance.user lowercaseString] isEqualToString:@"larryl"]||[[RASingleton.sharedInstance.user lowercaseString] isEqualToString:@"arpithat"])
     {
     {
         //        [map setValue:@"Contact" forKey:@"title"];
         //        [map setValue:@"Contact" forKey:@"title"];
         //        [map setValue:@"rect_contact_list" forKey:@"img"];
         //        [map setValue:@"rect_contact_list" forKey:@"img"];
@@ -2845,7 +2845,7 @@
         if (appDelegate.user_type == USER_ROLE_CUSTOMER && appDelegate.customer_type == CustomerTypeStore  && [RASingleton sharedInstance].global_lock) {
         if (appDelegate.user_type == USER_ROLE_CUSTOMER && appDelegate.customer_type == CustomerTypeStore  && [RASingleton sharedInstance].global_lock) {
             
             
             JKLockController *lockVC = [[JKLockController alloc] init];
             JKLockController *lockVC = [[JKLockController alloc] init];
-            [lockVC setPasswordKey:[NSString stringWithFormat:@"%@_password",appDelegate.user]];
+            [lockVC setPasswordKey:[NSString stringWithFormat:@"%@_password",RASingleton.sharedInstance.user]];
             __weak typeof(self) weakself = self;
             __weak typeof(self) weakself = self;
             lockVC.authoReturn = ^(BOOL failure) {
             lockVC.authoReturn = ^(BOOL failure) {
                 
                 
@@ -2879,7 +2879,7 @@
         if (appDelegate.user_type == USER_ROLE_CUSTOMER && appDelegate.customer_type == CustomerTypeStore  && [RASingleton sharedInstance].global_lock) {
         if (appDelegate.user_type == USER_ROLE_CUSTOMER && appDelegate.customer_type == CustomerTypeStore  && [RASingleton sharedInstance].global_lock) {
             
             
             JKLockController *lockVC = [[JKLockController alloc] init];
             JKLockController *lockVC = [[JKLockController alloc] init];
-            [lockVC setPasswordKey:[NSString stringWithFormat:@"%@_password",appDelegate.user]];
+            [lockVC setPasswordKey:[NSString stringWithFormat:@"%@_password",RASingleton.sharedInstance.user]];
             __weak typeof(self) weakself = self;
             __weak typeof(self) weakself = self;
             lockVC.authoReturn = ^(BOOL failure) {
             lockVC.authoReturn = ^(BOOL failure) {
                 
                 
@@ -2968,7 +2968,7 @@
         if ([RASingleton sharedInstance].global_lock) {
         if ([RASingleton sharedInstance].global_lock) {
             
             
             JKLockController *lockVC = [[JKLockController alloc] init];
             JKLockController *lockVC = [[JKLockController alloc] init];
-            [lockVC setPasswordKey:[NSString stringWithFormat:@"%@_password",appDelegate.user]];
+            [lockVC setPasswordKey:[NSString stringWithFormat:@"%@_password",RASingleton.sharedInstance.user]];
             __weak typeof(self) weakself = self;
             __weak typeof(self) weakself = self;
             lockVC.authoReturn = ^(BOOL failure) {
             lockVC.authoReturn = ^(BOOL failure) {
                 
                 
@@ -3009,7 +3009,7 @@
         AppDelegate *appDelegate = (AppDelegate *)[app delegate];
         AppDelegate *appDelegate = (AppDelegate *)[app delegate];
         
         
         JKLockController *lockVC = [[JKLockController alloc] init];
         JKLockController *lockVC = [[JKLockController alloc] init];
-        [lockVC setPasswordKey:[NSString stringWithFormat:@"%@_password",appDelegate.user]];
+        [lockVC setPasswordKey:[NSString stringWithFormat:@"%@_password",RASingleton.sharedInstance.user]];
         __weak typeof(self) weakself = self;
         __weak typeof(self) weakself = self;
         lockVC.authoReturn = ^(BOOL failure) {
         lockVC.authoReturn = ^(BOOL failure) {
             
             

+ 2 - 2
RedAnt ERP Mobile/HMLG Scan Order/ServerSettingViewController.m

@@ -787,7 +787,7 @@
 - (IBAction)onChangePasswordClick:(id)sender {
 - (IBAction)onChangePasswordClick:(id)sender {
     UIApplication * app = [UIApplication sharedApplication];
     UIApplication * app = [UIApplication sharedApplication];
     AppDelegate *appDelegate = (AppDelegate *)[app delegate];
     AppDelegate *appDelegate = (AppDelegate *)[app delegate];
-    if(appDelegate.user.length==0)
+    if(RASingleton.sharedInstance.user.length==0)
     {
     {
         [RAUtils message_box:@"Change Password" message:@"You must sign in first." completion:nil];
         [RAUtils message_box:@"Change Password" message:@"You must sign in first." completion:nil];
         return;
         return;
@@ -823,7 +823,7 @@
     
     
     UIApplication * app = [UIApplication sharedApplication];
     UIApplication * app = [UIApplication sharedApplication];
     AppDelegate *appDelegate = (AppDelegate *)[app delegate];
     AppDelegate *appDelegate = (AppDelegate *)[app delegate];
-    if(appDelegate.user.length==0)
+    if(RASingleton.sharedInstance.user.length==0)
     {
     {
         [RAUtils message_box:@"Delete Account" message:@"You must sign in first." completion:nil];
         [RAUtils message_box:@"Delete Account" message:@"You must sign in first." completion:nil];
         return;
         return;

+ 1 - 1
RedAnt ERP Mobile/common/AppDelegateBase.h

@@ -99,7 +99,7 @@ typedef enum {
 //@property (strong, nonatomic) NSMutableArray* arr_scannerReceiver;
 //@property (strong, nonatomic) NSMutableArray* arr_scannerReceiver;
 
 
 @property (strong, nonatomic) UIWindow *window;
 @property (strong, nonatomic) UIWindow *window;
-@property (strong,nonatomic) NSString* user;
+//@property (strong,nonatomic) NSString* user;
 @property (strong,nonatomic) NSString * password;
 @property (strong,nonatomic) NSString * password;
 @property (strong,nonatomic) NSString * user_icon;
 @property (strong,nonatomic) NSString * user_icon;
 //@property (strong,nonatomic) NSString * sessionid;
 //@property (strong,nonatomic) NSString * sessionid;

+ 19 - 19
RedAnt ERP Mobile/common/AppDelegateBase.m

@@ -130,11 +130,11 @@
     [RASingleton.sharedInstance setGlobalParameter:@(_offline_mode) forKey:@"offline_mode"];
     [RASingleton.sharedInstance setGlobalParameter:@(_offline_mode) forKey:@"offline_mode"];
 }
 }
 
 
-- (void)setUser:(NSString *)user {
-    _user = user;
-    RASingleton.sharedInstance.user = user;
-    [RASingleton.sharedInstance setGlobalParameter:_user forKey:@"user"];
-}
+//- (void)setUser:(NSString *)user {
+//    _user = user;
+//    RASingleton.sharedInstance.user = user;
+//    [RASingleton.sharedInstance setGlobalParameter:_user forKey:@"user"];
+//}
 - (void)setUser_type:(long)user_type
 - (void)setUser_type:(long)user_type
 {
 {
     _user_type = user_type;
     _user_type = user_type;
@@ -216,7 +216,7 @@
         
         
         
         
         
         
-        if(self.user==nil)
+        if(RASingleton.sharedInstance.user==nil)
         {
         {
             
             
             
             
@@ -268,7 +268,7 @@
             
             
         }
         }
         //cart
         //cart
-        if(self.user==nil||self.cart_count==0)
+        if(RASingleton.sharedInstance.user==nil||self.cart_count==0)
         {
         {
             main_vc.label_ccount.hidden = true;
             main_vc.label_ccount.hidden = true;
             main_vc.label_cccount.hidden=true;
             main_vc.label_cccount.hidden=true;
@@ -311,7 +311,7 @@
         }
         }
         
         
         //wishlist
         //wishlist
-        if(self.user==nil||self.wish_count==0)
+        if(RASingleton.sharedInstance.user==nil||self.wish_count==0)
         {
         {
             main_vc.label_wcount.hidden = true;
             main_vc.label_wcount.hidden = true;
             main_vc.label_cwcount.hidden = true;
             main_vc.label_cwcount.hidden = true;
@@ -416,7 +416,7 @@
         
         
         MainViewController * main_vc= (MainViewController*)self.main_vc;
         MainViewController * main_vc= (MainViewController*)self.main_vc;
         
         
-        if(self.user==nil)
+        if(RASingleton.sharedInstance.user==nil)
         {
         {
             
             
             NSString* title = [NSString stringWithFormat:@"Sign in"];
             NSString* title = [NSString stringWithFormat:@"Sign in"];
@@ -439,7 +439,7 @@
 #endif
 #endif
             if(self.user_type==USER_ROLE_CUSTOMER)
             if(self.user_type==USER_ROLE_CUSTOMER)
             {
             {
-                NSString* title = [NSString stringWithFormat:@"%@",self.user];
+                NSString* title = [NSString stringWithFormat:@"%@",RASingleton.sharedInstance.user];
                 [main_vc.buttonUser setTitle:title forState:UIControlStateNormal];
                 [main_vc.buttonUser setTitle:title forState:UIControlStateNormal];
                 main_vc.labelMode.text=nil;
                 main_vc.labelMode.text=nil;
                 [main_vc.labelMode setTextColor:UIColorFromRGB(0x336699)];
                 [main_vc.labelMode setTextColor:UIColorFromRGB(0x336699)];
@@ -450,7 +450,7 @@
                 if([blockmode isEqualToString:@"Regular Mode"])
                 if([blockmode isEqualToString:@"Regular Mode"])
                 {
                 {
                     self.mode=@"RM";
                     self.mode=@"RM";
-                    NSString* title = self.user;
+                    NSString* title = RASingleton.sharedInstance.user;
                     [main_vc.buttonUser setTitle:title forState:UIControlStateNormal];
                     [main_vc.buttonUser setTitle:title forState:UIControlStateNormal];
                     
                     
                     main_vc.labelMode.text=self.mode;
                     main_vc.labelMode.text=self.mode;
@@ -461,7 +461,7 @@
                 {
                 {
                     
                     
                     self.mode=@"TM";
                     self.mode=@"TM";
-                    NSString* title = self.user;
+                    NSString* title = RASingleton.sharedInstance.user;
                     [main_vc.buttonUser setTitle:title forState:UIControlStateNormal];
                     [main_vc.buttonUser setTitle:title forState:UIControlStateNormal];
                     
                     
                     main_vc.labelMode.text=self.mode;
                     main_vc.labelMode.text=self.mode;
@@ -527,7 +527,7 @@
             }
             }
         }
         }
         
         
-        if(self.user==nil)
+        if(RASingleton.sharedInstance.user==nil)
         {
         {
             
             
             //            NSString* title = [NSString stringWithFormat:@"Sign in"];
             //            NSString* title = [NSString stringWithFormat:@"Sign in"];
@@ -709,7 +709,7 @@ void UncaughtExceptionHandler(NSException *exception) {
 //        UIStoryboard *mainStoryBoard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
 //        UIStoryboard *mainStoryBoard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
         
         
         NSString *user = [tmp_urgencyDic objectForKey:@"user"];
         NSString *user = [tmp_urgencyDic objectForKey:@"user"];
-        if (![user isEqualToString:self.user]) {
+        if (![user isEqualToString:RASingleton.sharedInstance.user]) {
             return;
             return;
         }
         }
         
         
@@ -902,12 +902,12 @@ void UncaughtExceptionHandler(NSException *exception) {
 }
 }
 
 
 - (void)writeUrgencyCache {
 - (void)writeUrgencyCache {
-    if (!self.user) {
+    if (!RASingleton.sharedInstance.user) {
         return;
         return;
     }
     }
     
     
     NSString *cachePath = [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) firstObject];
     NSString *cachePath = [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) firstObject];
-    NSString *urgencyFile = [cachePath stringByAppendingPathComponent:[NSString stringWithFormat:@"%@_urgency",self.user]];
+    NSString *urgencyFile = [cachePath stringByAppendingPathComponent:[NSString stringWithFormat:@"%@_urgency",RASingleton.sharedInstance.user]];
     
     
     //    [NSKeyedArchiver archiveRootObject:self.urgencyDic toFile:urgencyFile];
     //    [NSKeyedArchiver archiveRootObject:self.urgencyDic toFile:urgencyFile];
     [self.urgencyDic writeToFile:urgencyFile atomically:NO];
     [self.urgencyDic writeToFile:urgencyFile atomically:NO];
@@ -924,7 +924,7 @@ void UncaughtExceptionHandler(NSException *exception) {
     // 检查本地urgency文件,存在则加载进_urgencyDic
     // 检查本地urgency文件,存在则加载进_urgencyDic
     NSFileManager *manager = [NSFileManager defaultManager];
     NSFileManager *manager = [NSFileManager defaultManager];
     NSString *cachePath = [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) firstObject];
     NSString *cachePath = [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) firstObject];
-    NSString *urgencyFile = [cachePath stringByAppendingPathComponent:[NSString stringWithFormat:@"%@_urgency",self.user]];
+    NSString *urgencyFile = [cachePath stringByAppendingPathComponent:[NSString stringWithFormat:@"%@_urgency",RASingleton.sharedInstance.user]];
     NSMutableDictionary *resultDic = [NSMutableDictionary dictionary];
     NSMutableDictionary *resultDic = [NSMutableDictionary dictionary];
     if ([manager fileExistsAtPath:urgencyFile]) {
     if ([manager fileExistsAtPath:urgencyFile]) {
         
         
@@ -1169,7 +1169,7 @@ void UncaughtExceptionHandler(NSException *exception) {
         
         
         [main_vc hideMenu];
         [main_vc hideMenu];
         [main_vc switchToHome];
         [main_vc switchToHome];
-        self.user = nil;
+        RASingleton.sharedInstance.user = nil;
         self.password=nil;
         self.password=nil;
         self.user_icon=nil;
         self.user_icon=nil;
         self.user_type = USER_ROLE_UNKNOWN;
         self.user_type = USER_ROLE_UNKNOWN;
@@ -1740,7 +1740,7 @@ void UncaughtExceptionHandler(NSException *exception) {
         
         
 
 
         NSMutableDictionary* add_params=[NSMutableDictionary new];
         NSMutableDictionary* add_params=[NSMutableDictionary new];
-        add_params[@"user"]=self.user;
+        add_params[@"user"]=RASingleton.sharedInstance.user;
         add_params[@"password"]=self.password;
         add_params[@"password"]=self.password;
         add_params[@"contact_id"]=self.contact_id;
         add_params[@"contact_id"]=self.contact_id;
         [self upload_offline:ver useInternalAddress:buseinternaladdress orderid:arr_order params:add_params];
         [self upload_offline:ver useInternalAddress:buseinternaladdress orderid:arr_order params:add_params];

+ 17 - 17
RedAnt ERP Mobile/common/Functions/MainViewController.m

@@ -268,9 +268,9 @@
     [self initMenuItems];
     [self initMenuItems];
     AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
     AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
     
     
-    self.sideMenu_UserName.text =appDelegate.user;
+    self.sideMenu_UserName.text =RASingleton.sharedInstance.user;
     
     
-    [self.btn_sideMenu_UserName setTitle:appDelegate.user forState:UIControlStateNormal];
+    [self.btn_sideMenu_UserName setTitle:RASingleton.sharedInstance.user forState:UIControlStateNormal];
     
     
     if(appDelegate.bLogin)
     if(appDelegate.bLogin)
         [self.btnLogin setTitle:@"Sign out" forState:UIControlStateNormal];
         [self.btnLogin setTitle:@"Sign out" forState:UIControlStateNormal];
@@ -325,7 +325,7 @@
     [self.btnContact setTitle:contact_string forState:UIControlStateNormal];
     [self.btnContact setTitle:contact_string forState:UIControlStateNormal];
     
     
     //    if(appDelegate.bLogin)
     //    if(appDelegate.bLogin)
-    //        [self.buttonUser setTitle:appDelegate.user forState:UIControlStateNormal];
+    //        [self.buttonUser setTitle:RASingleton.sharedInstance.user forState:UIControlStateNormal];
     //    else
     //    else
     //        [self.buttonUser setTitle:@"Sign in" forState:UIControlStateNormal];
     //        [self.buttonUser setTitle:@"Sign in" forState:UIControlStateNormal];
     
     
@@ -1006,7 +1006,7 @@
     
     
     DebugLog(@"header view login");
     DebugLog(@"header view login");
     AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
     AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-    if( appDelegate.user ==nil)
+    if( RASingleton.sharedInstance.user ==nil)
     {
     {
         
         
         LoginViewController * loginvc =[[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"LoginViewController"];
         LoginViewController * loginvc =[[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"LoginViewController"];
@@ -1044,8 +1044,8 @@
     [viewController dismissViewControllerAnimated:YES completion:^{
     [viewController dismissViewControllerAnimated:YES completion:^{
         AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
         AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
         
         
-        self.sideMenu_UserName.text =appDelegate.user;
-        [self.btn_sideMenu_UserName setTitle:appDelegate.user forState:UIControlStateNormal];
+        self.sideMenu_UserName.text =RASingleton.sharedInstance.user;
+        [self.btn_sideMenu_UserName setTitle:RASingleton.sharedInstance.user forState:UIControlStateNormal];
         
         
         [self.btnLogin setTitle:@"Sign out" forState:UIControlStateNormal];
         [self.btnLogin setTitle:@"Sign out" forState:UIControlStateNormal];
         
         
@@ -1091,7 +1091,7 @@
         
         
         [self.btnContact setTitle:contact_string forState:UIControlStateNormal];
         [self.btnContact setTitle:contact_string forState:UIControlStateNormal];
         
         
-        //    [self.buttonUser setTitle:appDelegate.user forState:UIControlStateNormal];
+        //    [self.buttonUser setTitle:RASingleton.sharedInstance.user forState:UIControlStateNormal];
         
         
         
         
         
         
@@ -1986,7 +1986,7 @@
     NSMutableDictionary* map = [[NSMutableDictionary alloc] init];
     NSMutableDictionary* map = [[NSMutableDictionary alloc] init];
     
     
     
     
-    if(appDelegate.user!=nil)
+    if(RASingleton.sharedInstance.user!=nil)
     {
     {
         [map setValue:@"Wish List" forKey:@"title"];
         [map setValue:@"Wish List" forKey:@"title"];
         [map setValue:@"rect_market_news" forKey:@"img"];
         [map setValue:@"rect_market_news" forKey:@"img"];
@@ -2098,12 +2098,12 @@
     }
     }
 #endif
 #endif
     
     
-    if (appDelegate.user && appDelegate.user_type == USER_ROLE_CUSTOMER && appDelegate.customer_type == CustomerTypeStore ) {
+    if (RASingleton.sharedInstance.user && appDelegate.user_type == USER_ROLE_CUSTOMER && appDelegate.customer_type == CustomerTypeStore ) {
         [map setValue:@"Price Setting" forKey:@"title"];
         [map setValue:@"Price Setting" forKey:@"title"];
         //        [map setValue:@"rect_market_news" forKey:@"img"];
         //        [map setValue:@"rect_market_news" forKey:@"img"];
         [self.sideMenuItems addObject:map.copy];
         [self.sideMenuItems addObject:map.copy];
     }
     }
-    if (appDelegate.user && appDelegate.user_type == USER_ROLE_CUSTOMER && appDelegate.customer_type == CustomerTypeStore ) {
+    if (RASingleton.sharedInstance.user && appDelegate.user_type == USER_ROLE_CUSTOMER && appDelegate.customer_type == CustomerTypeStore ) {
         if ([RASingleton sharedInstance].global_lock) {
         if ([RASingleton sharedInstance].global_lock) {
             [map setValue:@"Unlock" forKey:@"title"];
             [map setValue:@"Unlock" forKey:@"title"];
         } else {
         } else {
@@ -2125,12 +2125,12 @@
         
         
     }
     }
  */
  */
-//    if (appDelegate.user && appDelegate.user_type == USER_ROLE_CUSTOMER) {
+//    if (RASingleton.sharedInstance.user && appDelegate.user_type == USER_ROLE_CUSTOMER) {
 //        [map setValue:@"Price Setting" forKey:@"title"];
 //        [map setValue:@"Price Setting" forKey:@"title"];
 //        //        [map setValue:@"rect_market_news" forKey:@"img"];
 //        //        [map setValue:@"rect_market_news" forKey:@"img"];
 //        [self.sideMenuItems addObject:map.copy];
 //        [self.sideMenuItems addObject:map.copy];
 //    }
 //    }
-    if (appDelegate.user && appDelegate.user_type == USER_ROLE_CUSTOMER && appDelegate.customer_type == CustomerTypeStore ) {
+    if (RASingleton.sharedInstance.user && appDelegate.user_type == USER_ROLE_CUSTOMER && appDelegate.customer_type == CustomerTypeStore ) {
         if ([Singleton sharedInstance].global_lock) {
         if ([Singleton sharedInstance].global_lock) {
             [map setValue:@"Unlock" forKey:@"title"];
             [map setValue:@"Unlock" forKey:@"title"];
         } else {
         } else {
@@ -2143,7 +2143,7 @@
 # endif
 # endif
     
     
 #ifdef DEBUG
 #ifdef DEBUG
-//    if([[appDelegate.user lowercaseString] isEqualToString:@"larryl"]||[[appDelegate.user lowercaseString] isEqualToString:@"arpithat"])
+//    if([[RASingleton.sharedInstance.user lowercaseString] isEqualToString:@"larryl"]||[[RASingleton.sharedInstance.user lowercaseString] isEqualToString:@"arpithat"])
     {
     {
         //        [map setValue:@"Contact" forKey:@"title"];
         //        [map setValue:@"Contact" forKey:@"title"];
         //        [map setValue:@"rect_contact_list" forKey:@"img"];
         //        [map setValue:@"rect_contact_list" forKey:@"img"];
@@ -3072,7 +3072,7 @@
         if (appDelegate.user_type == USER_ROLE_CUSTOMER && appDelegate.customer_type == CustomerTypeStore  && [RASingleton sharedInstance].global_lock) {
         if (appDelegate.user_type == USER_ROLE_CUSTOMER && appDelegate.customer_type == CustomerTypeStore  && [RASingleton sharedInstance].global_lock) {
             
             
             JKLockController *lockVC = [[JKLockController alloc] init];
             JKLockController *lockVC = [[JKLockController alloc] init];
-            [lockVC setPasswordKey:[NSString stringWithFormat:@"%@_password",appDelegate.user]];
+            [lockVC setPasswordKey:[NSString stringWithFormat:@"%@_password",RASingleton.sharedInstance.user]];
             __weak typeof(self) weakself = self;
             __weak typeof(self) weakself = self;
             lockVC.authoReturn = ^(BOOL failure) {
             lockVC.authoReturn = ^(BOOL failure) {
                 
                 
@@ -3174,7 +3174,7 @@
         if (appDelegate.user_type == USER_ROLE_CUSTOMER && appDelegate.customer_type == CustomerTypeStore  && [RASingleton sharedInstance].global_lock) {
         if (appDelegate.user_type == USER_ROLE_CUSTOMER && appDelegate.customer_type == CustomerTypeStore  && [RASingleton sharedInstance].global_lock) {
             
             
             JKLockController *lockVC = [[JKLockController alloc] init];
             JKLockController *lockVC = [[JKLockController alloc] init];
-            [lockVC setPasswordKey:[NSString stringWithFormat:@"%@_password",appDelegate.user]];
+            [lockVC setPasswordKey:[NSString stringWithFormat:@"%@_password",RASingleton.sharedInstance.user]];
             __weak typeof(self) weakself = self;
             __weak typeof(self) weakself = self;
             lockVC.authoReturn = ^(BOOL failure) {
             lockVC.authoReturn = ^(BOOL failure) {
                 
                 
@@ -3263,7 +3263,7 @@
         if ([RASingleton sharedInstance].global_lock) {
         if ([RASingleton sharedInstance].global_lock) {
             
             
             JKLockController *lockVC = [[JKLockController alloc] init];
             JKLockController *lockVC = [[JKLockController alloc] init];
-            [lockVC setPasswordKey:[NSString stringWithFormat:@"%@_password",appDelegate.user]];
+            [lockVC setPasswordKey:[NSString stringWithFormat:@"%@_password",RASingleton.sharedInstance.user]];
             __weak typeof(self) weakself = self;
             __weak typeof(self) weakself = self;
             lockVC.authoReturn = ^(BOOL failure) {
             lockVC.authoReturn = ^(BOOL failure) {
                 
                 
@@ -3304,7 +3304,7 @@
         AppDelegate *appDelegate = (AppDelegate *)[app delegate];
         AppDelegate *appDelegate = (AppDelegate *)[app delegate];
         
         
         JKLockController *lockVC = [[JKLockController alloc] init];
         JKLockController *lockVC = [[JKLockController alloc] init];
-        [lockVC setPasswordKey:[NSString stringWithFormat:@"%@_password",appDelegate.user]];
+        [lockVC setPasswordKey:[NSString stringWithFormat:@"%@_password",RASingleton.sharedInstance.user]];
         __weak typeof(self) weakself = self;
         __weak typeof(self) weakself = self;
         lockVC.authoReturn = ^(BOOL failure) {
         lockVC.authoReturn = ^(BOOL failure) {
             
             

+ 7 - 7
RedAnt ERP Mobile/common/Functions/OLO/ScanOrderListViewController.m

@@ -270,7 +270,7 @@
     //    UIApplication * app = [UIApplication sharedApplication];
     //    UIApplication * app = [UIApplication sharedApplication];
     //    AppDelegate *appDelegate = (AppDelegate *)[app delegate];
     //    AppDelegate *appDelegate = (AppDelegate *)[app delegate];
     //
     //
-    //    if (appDelegate.user && appDelegate.user_type == USER_ROLE_CUSTOMER && appDelegate.customer_type == CustomerTypeStore) {
+    //    if (RASingleton.sharedInstance.user && appDelegate.user_type == USER_ROLE_CUSTOMER && appDelegate.customer_type == CustomerTypeStore) {
     //        self.shop_order_filter = [RASingleton sharedInstance].shop_order_status_filter;
     //        self.shop_order_filter = [RASingleton sharedInstance].shop_order_status_filter;
     //        self.sales_order_filter = [RASingleton sharedInstance].sales_order_status_filter;
     //        self.sales_order_filter = [RASingleton sharedInstance].sales_order_status_filter;
     //        if(self.init_style==OL_OPEN)
     //        if(self.init_style==OL_OPEN)
@@ -338,7 +338,7 @@
     AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
     AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
     NSMutableArray *items = [self.toolbarView.items mutableCopy];
     NSMutableArray *items = [self.toolbarView.items mutableCopy];
     
     
-    if(appDelegate.user && appDelegate.user_type == USER_ROLE_CUSTOMER && appDelegate.customer_type == CustomerTypeStore) {
+    if(RASingleton.sharedInstance.user && appDelegate.user_type == USER_ROLE_CUSTOMER && appDelegate.customer_type == CustomerTypeStore) {
         
         
         //  Check for Saved Order中Type和History Type不一致导致Status不正确
         //  Check for Saved Order中Type和History Type不一致导致Status不正确
         [RASingleton sharedInstance].customer_order_type = self.orderType;
         [RASingleton sharedInstance].customer_order_type = self.orderType;
@@ -422,7 +422,7 @@
     //    }
     //    }
     //
     //
     //    // 显示Sales Order与否
     //    // 显示Sales Order与否
-    //    if (appDelegate.user && appDelegate.user_type == USER_ROLE_CUSTOMER && appDelegate.customer_type == CustomerTypeStore) {
+    //    if (RASingleton.sharedInstance.user && appDelegate.user_type == USER_ROLE_CUSTOMER && appDelegate.customer_type == CustomerTypeStore) {
     //        if ([RASingleton sharedInstance].global_lock || ![RASingleton sharedInstance].customer_can_see_sales_Order) { // 是否解锁,是否有查看Sales Order权限
     //        if ([RASingleton sharedInstance].global_lock || ![RASingleton sharedInstance].customer_can_see_sales_Order) { // 是否解锁,是否有查看Sales Order权限
     //            if (self.orderTypeSegmentControl.numberOfSegments > 1) {
     //            if (self.orderTypeSegmentControl.numberOfSegments > 1) {
     //                [self.orderTypeSegmentControl removeSegmentAtIndex:1 animated:YES];
     //                [self.orderTypeSegmentControl removeSegmentAtIndex:1 animated:YES];
@@ -1079,7 +1079,7 @@
 //            NSInteger statusCode = [[self.content_data[indexPath.row] valueForKey:@"orderStatus"] integerValue];
 //            NSInteger statusCode = [[self.content_data[indexPath.row] valueForKey:@"orderStatus"] integerValue];
             NSString* purchase_time= [self.content_data[indexPath.row] valueForKey:@"purchase_time"];
             NSString* purchase_time= [self.content_data[indexPath.row] valueForKey:@"purchase_time"];
             NSString* status = [self.content_data[indexPath.row] valueForKey:@"order_status"] ;
             NSString* status = [self.content_data[indexPath.row] valueForKey:@"order_status"] ;
-            //        if (appDelegate.user && appDelegate.user_type == USER_ROLE_CUSTOMER && appDelegate.customer_type == CustomerTypeStore) {
+            //        if (RASingleton.sharedInstance.user && appDelegate.user_type == USER_ROLE_CUSTOMER && appDelegate.customer_type == CustomerTypeStore) {
             //            status = [ERPUtils orderStatus:statusCode];
             //            status = [ERPUtils orderStatus:statusCode];
             //        }
             //        }
             NSString* customer_name = [self.content_data[indexPath.row] valueForKey:@"customer_name"];
             NSString* customer_name = [self.content_data[indexPath.row] valueForKey:@"customer_name"];
@@ -1139,7 +1139,7 @@
 //            NSInteger statusCode = [[self.content_data[indexPath.row] valueForKey:@"orderStatus"] integerValue];
 //            NSInteger statusCode = [[self.content_data[indexPath.row] valueForKey:@"orderStatus"] integerValue];
             NSString* purchase_time= [self.submit_content_data[indexPath.row] valueForKey:@"purchase_time"];
             NSString* purchase_time= [self.submit_content_data[indexPath.row] valueForKey:@"purchase_time"];
             NSString* status = [self.submit_content_data[indexPath.row] valueForKey:@"order_status"] ;
             NSString* status = [self.submit_content_data[indexPath.row] valueForKey:@"order_status"] ;
-            //        if (appDelegate.user && appDelegate.user_type == USER_ROLE_CUSTOMER && appDelegate.customer_type == CustomerTypeStore) {
+            //        if (RASingleton.sharedInstance.user && appDelegate.user_type == USER_ROLE_CUSTOMER && appDelegate.customer_type == CustomerTypeStore) {
             //            status = [ERPUtils orderStatus:statusCode];
             //            status = [ERPUtils orderStatus:statusCode];
             //        }
             //        }
             NSString* customer_name = [self.submit_content_data[indexPath.row] valueForKey:@"customer_name"];
             NSString* customer_name = [self.submit_content_data[indexPath.row] valueForKey:@"customer_name"];
@@ -1312,7 +1312,7 @@
                 appDelegate.order_code = ordercode;
                 appDelegate.order_code = ordercode;
                 
                 
                 [appDelegate setUser:orderitem[@"create_by"]];
                 [appDelegate setUser:orderitem[@"create_by"]];
-                //            appDelegate.user =;
+                //            RASingleton.sharedInstance.user =;
                 //        appDelegate.custo orderitem[@"customer_name"]
                 //        appDelegate.custo orderitem[@"customer_name"]
     //            appDelegate.user_type = USER_ROLE_EMPLOYEE;
     //            appDelegate.user_type = USER_ROLE_EMPLOYEE;
                 appDelegate.can_set_cart_price = true;
                 appDelegate.can_set_cart_price = true;
@@ -1385,7 +1385,7 @@
                     appDelegate.order_code = ordercode;
                     appDelegate.order_code = ordercode;
                     
                     
                     [appDelegate setUser:orderitem[@"create_by"]];
                     [appDelegate setUser:orderitem[@"create_by"]];
-                    //            appDelegate.user =;
+                    //            RASingleton.sharedInstance.user =;
                     //        appDelegate.custo orderitem[@"customer_name"]
                     //        appDelegate.custo orderitem[@"customer_name"]
         //            appDelegate.user_type = USER_ROLE_EMPLOYEE;
         //            appDelegate.user_type = USER_ROLE_EMPLOYEE;
                     appDelegate.can_set_cart_price = true;
                     appDelegate.can_set_cart_price = true;

+ 1 - 1
RedAnt ERP Mobile/common/Functions/address/AddressEditorViewController.m

@@ -181,7 +181,7 @@
     
     
     AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
     AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
     
     
-    [appDelegate.urgencyDic setValue:appDelegate.user forKey:@"user"];
+    [appDelegate.urgencyDic setValue:RASingleton.sharedInstance.user forKey:@"user"];
 #ifdef OFFLINE_MODE
 #ifdef OFFLINE_MODE
     [appDelegate.urgencyDic setValue:[NSNumber numberWithBool:appDelegate.offline_mode] forKey:@"offline_mode"];
     [appDelegate.urgencyDic setValue:[NSNumber numberWithBool:appDelegate.offline_mode] forKey:@"offline_mode"];
 #endif
 #endif

+ 1 - 1
RedAnt ERP Mobile/common/Functions/cart/CartViewController.m

@@ -582,7 +582,7 @@
 
 
     // Shop 权限检查
     // Shop 权限检查
     AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
     AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-    if (appDelegate.user && appDelegate.user_type == USER_ROLE_CUSTOMER && appDelegate.customer_type == CustomerTypeStore) {
+    if (RASingleton.sharedInstance.user && appDelegate.user_type == USER_ROLE_CUSTOMER && appDelegate.customer_type == CustomerTypeStore) {
         if (![RASingleton sharedInstance].permissions_edit_order) {
         if (![RASingleton sharedInstance].permissions_edit_order) {
             
             
             CGRect frame0 = self.cancelOrderButton.frame;
             CGRect frame0 = self.cancelOrderButton.frame;

+ 2 - 2
RedAnt ERP Mobile/common/Functions/category/CategoryViewController.m

@@ -934,7 +934,7 @@
 {
 {
 
 
     AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
     AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
-    if (appDelegate.user && appDelegate.user_type == USER_ROLE_CUSTOMER && appDelegate.customer_type == CustomerTypeStore) {
+    if (RASingleton.sharedInstance.user && appDelegate.user_type == USER_ROLE_CUSTOMER && appDelegate.customer_type == CustomerTypeStore) {
         [RAUtils message_box:@"Warning" message:@"Cannot Add to portfolio." completion:nil] ;
         [RAUtils message_box:@"Warning" message:@"Cannot Add to portfolio." completion:nil] ;
         
         
         return;
         return;
@@ -1654,7 +1654,7 @@
     // customer 隐藏add to portfolio
     // customer 隐藏add to portfolio
     AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
     AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
     NSMutableArray *items = [self.selectToolbar.items mutableCopy];
     NSMutableArray *items = [self.selectToolbar.items mutableCopy];
-    if (appDelegate.user && appDelegate.user_type == USER_ROLE_CUSTOMER && appDelegate.customer_type == CustomerTypeStore) {
+    if (RASingleton.sharedInstance.user && appDelegate.user_type == USER_ROLE_CUSTOMER && appDelegate.customer_type == CustomerTypeStore) {
         
         
         if ([items containsObject:self.addPortfolioBtn]) {
         if ([items containsObject:self.addPortfolioBtn]) {
             
             

+ 1 - 1
RedAnt ERP Mobile/common/Functions/contact/ContactAdvanceSearchViewController.m

@@ -370,7 +370,7 @@
     
     
     AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
     AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
     
     
-    [appDelegate.urgencyDic setValue:appDelegate.user forKey:@"user"];
+    [appDelegate.urgencyDic setValue:RASingleton.sharedInstance.user forKey:@"user"];
 #ifdef OFFLINE_MODE
 #ifdef OFFLINE_MODE
     [appDelegate.urgencyDic setValue:[NSNumber numberWithBool:appDelegate.offline_mode] forKey:@"offline_mode"];
     [appDelegate.urgencyDic setValue:[NSNumber numberWithBool:appDelegate.offline_mode] forKey:@"offline_mode"];
 #endif
 #endif

+ 1 - 1
RedAnt ERP Mobile/common/Functions/contact/CustomerEditViewController.m

@@ -219,7 +219,7 @@
     
     
     AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
     AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
     
     
-    [appDelegate.urgencyDic setValue:appDelegate.user forKey:@"user"];
+    [appDelegate.urgencyDic setValue:RASingleton.sharedInstance.user forKey:@"user"];
 #ifdef OFFLINE_MODE
 #ifdef OFFLINE_MODE
     [appDelegate.urgencyDic setValue:[NSNumber numberWithBool:appDelegate.offline_mode] forKey:@"offline_mode"];
     [appDelegate.urgencyDic setValue:[NSNumber numberWithBool:appDelegate.offline_mode] forKey:@"offline_mode"];
 #endif
 #endif

+ 1 - 1
RedAnt ERP Mobile/common/Functions/contact/CustomerInfoViewController.m

@@ -549,7 +549,7 @@
     
     
     AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
     AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
     
     
-    [appDelegate.urgencyDic setValue:appDelegate.user forKey:@"user"];
+    [appDelegate.urgencyDic setValue:RASingleton.sharedInstance.user forKey:@"user"];
 #ifdef OFFLINE_MODE
 #ifdef OFFLINE_MODE
     [appDelegate.urgencyDic setValue:[NSNumber numberWithBool:appDelegate.offline_mode] forKey:@"offline_mode"];
     [appDelegate.urgencyDic setValue:[NSNumber numberWithBool:appDelegate.offline_mode] forKey:@"offline_mode"];
 #endif
 #endif

+ 1 - 1
RedAnt ERP Mobile/common/Functions/creditcard/CreditCardEditorViewController.m

@@ -176,7 +176,7 @@
     
     
     AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
     AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
     
     
-    [appDelegate.urgencyDic setValue:appDelegate.user forKey:@"user"];
+    [appDelegate.urgencyDic setValue:RASingleton.sharedInstance.user forKey:@"user"];
 #ifdef OFFLINE_MODE
 #ifdef OFFLINE_MODE
     [appDelegate.urgencyDic setValue:[NSNumber numberWithBool:appDelegate.offline_mode] forKey:@"offline_mode"];
     [appDelegate.urgencyDic setValue:[NSNumber numberWithBool:appDelegate.offline_mode] forKey:@"offline_mode"];
 #endif
 #endif

+ 1 - 1
RedAnt ERP Mobile/common/Functions/modelDetail/DetailHeaderCell.m

@@ -105,7 +105,7 @@
     UIApplication * app = [UIApplication sharedApplication];
     UIApplication * app = [UIApplication sharedApplication];
     AppDelegate *appDelegate = (AppDelegate *)[app delegate];
     AppDelegate *appDelegate = (AppDelegate *)[app delegate];
     
     
-    if (appDelegate.user && appDelegate.user_type == USER_ROLE_CUSTOMER && appDelegate.customer_type == CustomerTypeStore) {
+    if (RASingleton.sharedInstance.user && appDelegate.user_type == USER_ROLE_CUSTOMER && appDelegate.customer_type == CustomerTypeStore) {
         [[NSNotificationCenter defaultCenter] postNotificationName:No_Rights_Notification object:nil];
         [[NSNotificationCenter defaultCenter] postNotificationName:No_Rights_Notification object:nil];
         return;
         return;
     }
     }

+ 2 - 2
RedAnt ERP Mobile/common/Functions/modelDetail/DetailViewController.m

@@ -1190,7 +1190,7 @@ dispatch_async(dispatch_get_main_queue(), ^{
         cell.hmlg_stock_count_lb.hidden = YES;
         cell.hmlg_stock_count_lb.hidden = YES;
         cell.on_sale_lb.hidden = YES;
         cell.on_sale_lb.hidden = YES;
         
         
-        if (!appDelegate.user) { // 没有登录时隐藏add to portfolio,使add to cart与add to wishlist对齐
+        if (!RASingleton.sharedInstance.user) { // 没有登录时隐藏add to portfolio,使add to cart与add to wishlist对齐
             
             
             cell.btnaddPortfolio.hidden = YES;
             cell.btnaddPortfolio.hidden = YES;
             cell.btnNotifyMe.hidden = YES;
             cell.btnNotifyMe.hidden = YES;
@@ -1615,7 +1615,7 @@ dispatch_async(dispatch_get_main_queue(), ^{
         }
         }
 #if defined(BUILD_HOMER) || defined(BUILD_GATIT)
 #if defined(BUILD_HOMER) || defined(BUILD_GATIT)
         NSString *old_price = [section_json objectForKey:@"old_price"];
         NSString *old_price = [section_json objectForKey:@"old_price"];
-        if (appDelegate.user && old_price != nil && old_price.length > 0) {
+        if (RASingleton.sharedInstance.user && old_price != nil && old_price.length > 0) {
             cell.priceLabel.text = nil;
             cell.priceLabel.text = nil;
             NSString *new_price_str = [NSString stringWithFormat:@"%@  %@",price,old_price];
             NSString *new_price_str = [NSString stringWithFormat:@"%@  %@",price,old_price];
             NSRange range = [new_price_str rangeOfString:@"$" options:NSBackwardsSearch];
             NSRange range = [new_price_str rangeOfString:@"$" options:NSBackwardsSearch];

+ 14 - 14
RedAnt ERP Mobile/common/Functions/offline/OLDataProvider.m

@@ -1438,8 +1438,8 @@
         
         
         
         
         
         
-        if(appDelegate.user!=nil)
-            [params setValue:appDelegate.user forKey:@"user"];
+        if(RASingleton.sharedInstance.user!=nil)
+            [params setValue:RASingleton.sharedInstance.user forKey:@"user"];
     }
     }
     
     
     
     
@@ -1836,7 +1836,7 @@
     
     
     NSString* servername = addressDic[@"name"];
     NSString* servername = addressDic[@"name"];
     AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
     AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-    NSString* user = appDelegate.user;
+    NSString* user = RASingleton.sharedInstance.user;
     NSString* orderpath = [documents stringByAppendingPathComponent:servername];
     NSString* orderpath = [documents stringByAppendingPathComponent:servername];
     orderpath = [orderpath stringByAppendingPathComponent:user];
     orderpath = [orderpath stringByAppendingPathComponent:user];
     orderpath = [orderpath stringByAppendingPathComponent:order_code];
     orderpath = [orderpath stringByAppendingPathComponent:order_code];
@@ -1870,7 +1870,7 @@
     
     
     NSString* servername = addressDic[@"name"];
     NSString* servername = addressDic[@"name"];
     AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
     AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-    NSString* user = appDelegate.user;
+    NSString* user = RASingleton.sharedInstance.user;
     NSString* orderpath = [documents stringByAppendingPathComponent:servername];
     NSString* orderpath = [documents stringByAppendingPathComponent:servername];
     orderpath = [orderpath stringByAppendingPathComponent:user];
     orderpath = [orderpath stringByAppendingPathComponent:user];
     orderpath = [orderpath stringByAppendingPathComponent:appDelegate.order_code];
     orderpath = [orderpath stringByAppendingPathComponent:appDelegate.order_code];
@@ -1931,7 +1931,7 @@
 //
 //
 //    NSString* servername = addressDic[@"name"];
 //    NSString* servername = addressDic[@"name"];
 ////    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
 ////    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-////    NSString* user = appDelegate.user;
+////    NSString* user = RASingleton.sharedInstance.user;
 //    NSString* userpath = [documents stringByAppendingPathComponent:servername];
 //    NSString* userpath = [documents stringByAppendingPathComponent:servername];
 //    userpath = [userpath stringByAppendingPathComponent:user];
 //    userpath = [userpath stringByAppendingPathComponent:user];
 //    return userpath;
 //    return userpath;
@@ -1946,7 +1946,7 @@
     
     
     NSString* servername = addressDic[@"name"];
     NSString* servername = addressDic[@"name"];
 //    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
 //    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-//    NSString* user = appDelegate.user;
+//    NSString* user = RASingleton.sharedInstance.user;
 //    NSString* user = RASingleton.sharedInstance.user;
 //    NSString* user = RASingleton.sharedInstance.user;
     NSString* serverpath = [documents stringByAppendingPathComponent:servername];
     NSString* serverpath = [documents stringByAppendingPathComponent:servername];
 //    userpath = [userpath stringByAppendingPathComponent:user];
 //    userpath = [userpath stringByAppendingPathComponent:user];
@@ -1974,7 +1974,7 @@
     
     
     NSString* servername = addressDic[@"name"];
     NSString* servername = addressDic[@"name"];
 //    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
 //    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-//    NSString* user = appDelegate.user;
+//    NSString* user = RASingleton.sharedInstance.user;
     NSString* user = RASingleton.sharedInstance.user;
     NSString* user = RASingleton.sharedInstance.user;
     NSString* userpath = [documents stringByAppendingPathComponent:servername];
     NSString* userpath = [documents stringByAppendingPathComponent:servername];
     userpath = [userpath stringByAppendingPathComponent:user];
     userpath = [userpath stringByAppendingPathComponent:user];
@@ -3254,8 +3254,8 @@ if(stockUom==0)
     //  AppDelegate *appDelegate = (AppDelegate *)[app delegate];
     //  AppDelegate *appDelegate = (AppDelegate *)[app delegate];
     sqlite3 *db = [iSalesDB get_db];
     sqlite3 *db = [iSalesDB get_db];
     NSString * where=@"1=1";
     NSString * where=@"1=1";
-    //    if(appDelegate.user!=nil)
-    //        where=[NSString stringWithFormat:@"lower(username)='%@'",appDelegate.user.lowercaseString];
+    //    if(RASingleton.sharedInstance.user!=nil)
+    //        where=[NSString stringWithFormat:@"lower(username)='%@'",RASingleton.sharedInstance.user.lowercaseString];
     int count = [iSalesDB get_recordcount:db table:@"offline_login" where:where];
     int count = [iSalesDB get_recordcount:db table:@"offline_login" where:where];
     [iSalesDB close_db:db];
     [iSalesDB close_db:db];
     if(count==0)
     if(count==0)
@@ -3372,7 +3372,7 @@ if(stockUom==0)
 //    }
 //    }
 //
 //
 //
 //
-////    NSString* user = appDelegate.user;
+////    NSString* user = RASingleton.sharedInstance.user;
 //
 //
 //    sqlite3 *db = [iSalesDB get_db];
 //    sqlite3 *db = [iSalesDB get_db];
 //
 //
@@ -14711,7 +14711,7 @@ if(stockUom==0)
     
     
     AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
     AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
     NSString* order_code= appDelegate.order_code;
     NSString* order_code= appDelegate.order_code;
-    NSString* user = appDelegate.user;
+    NSString* user = RASingleton.sharedInstance.user;
     dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
     dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
         NSString* category = [params valueForKey:@"category"];
         NSString* category = [params valueForKey:@"category"];
         if (!category || [category isEqualToString:@""]) {
         if (!category || [category isEqualToString:@""]) {
@@ -15230,7 +15230,7 @@ if(stockUom==0)
         }
         }
         
         
         
         
-        //    NSString* user = appDelegate.user;
+        //    NSString* user = RASingleton.sharedInstance.user;
         
         
         sqlite3 *db = [iSalesDB get_db];
         sqlite3 *db = [iSalesDB get_db];
         
         
@@ -15445,7 +15445,7 @@ if(stockUom==0)
     AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
     AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
     bool bLogin = appDelegate.bLogin;
     bool bLogin = appDelegate.bLogin;
     __block NSString* contact_id = appDelegate.contact_id;
     __block NSString* contact_id = appDelegate.contact_id;
-    __block NSString* user = appDelegate.user;
+    __block NSString* user = RASingleton.sharedInstance.user;
     __block NSString* order_code = appDelegate.order_code;
     __block NSString* order_code = appDelegate.order_code;
     dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
     dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
         NSString* model_name = [params valueForKey:@"product_name"];
         NSString* model_name = [params valueForKey:@"product_name"];
@@ -16070,7 +16070,7 @@ if(stockUom==0)
     AppDelegate *appDelegate = (AppDelegate *)[app delegate];
     AppDelegate *appDelegate = (AppDelegate *)[app delegate];
     
     
     bool can_create_backorder= appDelegate.can_create_backorder;
     bool can_create_backorder= appDelegate.can_create_backorder;
-    NSString* user = appDelegate.user;
+    NSString* user = RASingleton.sharedInstance.user;
     NSString* contact_id = appDelegate.contact_id;
     NSString* contact_id = appDelegate.contact_id;
     dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
     dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
         NSMutableDictionary* ret = [[NSMutableDictionary alloc] init];
         NSMutableDictionary* ret = [[NSMutableDictionary alloc] init];

+ 2 - 2
RedAnt ERP Mobile/common/Functions/offline/OfflineSettingViewController.m

@@ -34,7 +34,7 @@
         AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
         AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
 
 
         sqlite3* db = [iSalesDB get_db];
         sqlite3* db = [iSalesDB get_db];
-        int offline_user_iscurrent=[iSalesDB get_recordcount:db table:@"offline_login" where:[NSString stringWithFormat:@"username='%@'",appDelegate.user ]];
+        int offline_user_iscurrent=[iSalesDB get_recordcount:db table:@"offline_login" where:[NSString stringWithFormat:@"username='%@'",RASingleton.sharedInstance.user ]];
         
         
         [iSalesDB close_db:db];
         [iSalesDB close_db:db];
         
         
@@ -237,7 +237,7 @@
        // AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
        // AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
         
         
         sqlite3* db = [iSalesDB get_db];
         sqlite3* db = [iSalesDB get_db];
-        int offline_user_iscurrent=[iSalesDB get_recordcount:db table:@"offline_login" where:[NSString stringWithFormat:@"username='%@'",appDelegate.user ]];
+        int offline_user_iscurrent=[iSalesDB get_recordcount:db table:@"offline_login" where:[NSString stringWithFormat:@"username='%@'",RASingleton.sharedInstance.user ]];
         
         
         [iSalesDB close_db:db];
         [iSalesDB close_db:db];
         
         

+ 1 - 1
RedAnt ERP Mobile/common/Functions/offline/SyncControlPanelViewController.m

@@ -105,7 +105,7 @@
     
     
     NSString* appinfo =[NSString stringWithFormat:@"App info: %@   %@ build%@</br>",app_Name,app_Version,app_build];
     NSString* appinfo =[NSString stringWithFormat:@"App info: %@   %@ build%@</br>",app_Name,app_Version,app_build];
     
     
-    NSString* userinfo =[NSString stringWithFormat:@"login info: %@  </br>",appDelegate.user];
+    NSString* userinfo =[NSString stringWithFormat:@"login info: %@  </br>",RASingleton.sharedInstance.user];
     //    if(self.mail_content==nil)
     //    if(self.mail_content==nil)
     //        self.mail_content=@"";
     //        self.mail_content=@"";
     
     

+ 7 - 7
RedAnt ERP Mobile/common/Functions/order/CreateOrderViewController.m

@@ -788,7 +788,7 @@
 #ifdef SCANNER_ORDER
 #ifdef SCANNER_ORDER
     
     
     
     
-    if([appDelegate.user isEqualToString:@"GUEST"]&& self.realuser.length==0)
+    if([RASingleton.sharedInstance.user isEqualToString:@"GUEST"]&& self.realuser.length==0)
     {
     {
         
         
         UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"Submit Order" message:@"Please enter your user name and password." preferredStyle:UIAlertControllerStyleAlert];
         UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"Submit Order" message:@"Please enter your user name and password." preferredStyle:UIAlertControllerStyleAlert];
@@ -1435,7 +1435,7 @@
 //            }
 //            }
     
     
     NSMutableDictionary* orderitem = [NSMutableDictionary new];
     NSMutableDictionary* orderitem = [NSMutableDictionary new];
-    orderitem[@"create_by"] = appDelegate.user;
+    orderitem[@"create_by"] = RASingleton.sharedInstance.user;
     orderitem[@"price"] = upparams[@"totalPrice"];
     orderitem[@"price"] = upparams[@"totalPrice"];
 //    NSString*
 //    NSString*
     NSString* company = upparams[@"customer_cid"];
     NSString* company = upparams[@"customer_cid"];
@@ -2373,7 +2373,7 @@
     
     
     AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
     AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
     
     
-    [appDelegate.urgencyDic setValue:appDelegate.user forKey:@"user"];
+    [appDelegate.urgencyDic setValue:RASingleton.sharedInstance.user forKey:@"user"];
 #ifdef OFFLINE_MODE
 #ifdef OFFLINE_MODE
     [appDelegate.urgencyDic setValue:[NSNumber numberWithBool:appDelegate.offline_mode] forKey:@"offline_mode"];
     [appDelegate.urgencyDic setValue:[NSNumber numberWithBool:appDelegate.offline_mode] forKey:@"offline_mode"];
 #endif
 #endif
@@ -3076,7 +3076,7 @@
         r = [zip addFileToZip:file newname:[file lastPathComponent]];
         r = [zip addFileToZip:file newname:[file lastPathComponent]];
     }
     }
     
     
-    NSString * filepath=[[RADataProvider getSiteName] stringByAppendingPathComponent:appDelegate.user];
+    NSString * filepath=[[RADataProvider getSiteName] stringByAppendingPathComponent:RASingleton.sharedInstance.user];
     filepath=[filepath stringByAppendingPathComponent:appDelegate.order_code];
     filepath=[filepath stringByAppendingPathComponent:appDelegate.order_code];
     filepath=[filepath stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.zip",appDelegate.order_code]];
     filepath=[filepath stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.zip",appDelegate.order_code]];
         if( ![zip CloseZipFile2] )
         if( ![zip CloseZipFile2] )
@@ -3106,7 +3106,7 @@
         }
         }
         else
         else
         {
         {
-            realuser = appDelegate.user;
+            realuser = RASingleton.sharedInstance.user;
             realpassword = appDelegate.password;
             realpassword = appDelegate.password;
         }
         }
         NSDictionary* params = @{
         NSDictionary* params = @{
@@ -3268,10 +3268,10 @@
     }
     }
     else
     else
     {
     {
-        realuser = appDelegate.user;
+        realuser = RASingleton.sharedInstance.user;
         realpassword = appDelegate.password;
         realpassword = appDelegate.password;
     }
     }
-    if((appDelegate.user_type==USER_ROLE_CUSTOMER && [upparams[@"customer_cid"] stringValue].length>0) || [upparams[@"customer_cid"] stringValue].length>0 ||[appDelegate.user.uppercaseString isEqualToString:@"GUEST"])
+    if((appDelegate.user_type==USER_ROLE_CUSTOMER && [upparams[@"customer_cid"] stringValue].length>0) || [upparams[@"customer_cid"] stringValue].length>0 ||[RASingleton.sharedInstance.user.uppercaseString isEqualToString:@"GUEST"])
     {
     {
         NSMutableDictionary* param = [NSMutableDictionary new];
         NSMutableDictionary* param = [NSMutableDictionary new];
         
         

+ 6 - 6
RedAnt ERP Mobile/common/Functions/order/OrderDetailViewController.m

@@ -443,7 +443,7 @@
             NSMutableDictionary* params = [@{
             NSMutableDictionary* params = [@{
                                             @"thumb" : @"1",
                                             @"thumb" : @"1",
                                             @"order_code" : self.order_code != nil ? self.order_code : @"",
                                             @"order_code" : self.order_code != nil ? self.order_code : @"",
-                                            @"user":appDelegate.user
+                                            @"user":RASingleton.sharedInstance.user
                                             } mutableCopy];
                                             } mutableCopy];
             NSData *dicData = [OLDataProvider  offline_request_salesorder:params];
             NSData *dicData = [OLDataProvider  offline_request_salesorder:params];
             NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:dicData options:NSJSONReadingMutableContainers error:nil];
             NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:dicData options:NSJSONReadingMutableContainers error:nil];
@@ -489,7 +489,7 @@
             NSMutableDictionary* params = [@{
             NSMutableDictionary* params = [@{
                                              @"thumb" : @"0",
                                              @"thumb" : @"0",
                                              @"order_code" : self.order_code != nil ? self.order_code : @"",
                                              @"order_code" : self.order_code != nil ? self.order_code : @"",
-                                             @"user":appDelegate.user
+                                             @"user":RASingleton.sharedInstance.user
                                              } mutableCopy];
                                              } mutableCopy];
             NSData *dicData = [OLDataProvider  offline_request_salesorder:params];
             NSData *dicData = [OLDataProvider  offline_request_salesorder:params];
             NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:dicData options:NSJSONReadingMutableContainers error:nil];
             NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:dicData options:NSJSONReadingMutableContainers error:nil];
@@ -773,8 +773,8 @@
         NSMutableDictionary* params = [[NSMutableDictionary alloc] init];
         NSMutableDictionary* params = [[NSMutableDictionary alloc] init];
         
         
         AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
         AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-        if(appDelegate.user!=nil)
-            [params setValue:appDelegate.user forKey:@"user"];
+        if(RASingleton.sharedInstance.user!=nil)
+            [params setValue:RASingleton.sharedInstance.user forKey:@"user"];
         if(appDelegate.password!=nil)
         if(appDelegate.password!=nil)
             [params setValue:appDelegate.password forKey:@"password"];
             [params setValue:appDelegate.password forKey:@"password"];
         __weak typeof(self) weakSelf = self;
         __weak typeof(self) weakSelf = self;
@@ -1166,7 +1166,7 @@
                                 
                                 
                                 self.btnSign.enabled = true;
                                 self.btnSign.enabled = true;
                             }
                             }
-                            //                if([lock_user isEqualToString:appDelegate.user])
+                            //                if([lock_user isEqualToString:RASingleton.sharedInstance.user])
                             //                {
                             //                {
                             //                    self.btnCommit.enabled =true;
                             //                    self.btnCommit.enabled =true;
                             //                }
                             //                }
@@ -1194,7 +1194,7 @@
                                 }
                                 }
                                 //                    self.btnCommit.enabled =false;
                                 //                    self.btnCommit.enabled =false;
                             }
                             }
-                        BOOL lock_condition_1 = [lock_user isEqualToString:appDelegate.user];
+                        BOOL lock_condition_1 = [lock_user isEqualToString:RASingleton.sharedInstance.user];
                         BOOL lock_condition_2 = false;
                         BOOL lock_condition_2 = false;
         #ifdef OFFLINE_MODE
         #ifdef OFFLINE_MODE
                         lock_condition_1 = !appDelegate.offline_mode && lock_condition_1;
                         lock_condition_1 = !appDelegate.offline_mode && lock_condition_1;

+ 4 - 4
RedAnt ERP Mobile/common/Functions/order/OrderListViewController.m

@@ -190,7 +190,7 @@
     UIApplication * app = [UIApplication sharedApplication];
     UIApplication * app = [UIApplication sharedApplication];
     AppDelegate *appDelegate = (AppDelegate *)[app delegate];
     AppDelegate *appDelegate = (AppDelegate *)[app delegate];
     
     
-    if (appDelegate.user && appDelegate.user_type == USER_ROLE_CUSTOMER && appDelegate.customer_type == CustomerTypeStore) {
+    if (RASingleton.sharedInstance.user && appDelegate.user_type == USER_ROLE_CUSTOMER && appDelegate.customer_type == CustomerTypeStore) {
         self.shop_order_filter = [RASingleton sharedInstance].shop_order_status_filter;
         self.shop_order_filter = [RASingleton sharedInstance].shop_order_status_filter;
         self.sales_order_filter = [RASingleton sharedInstance].sales_order_status_filter;
         self.sales_order_filter = [RASingleton sharedInstance].sales_order_status_filter;
         if(self.init_style==OL_OPEN)
         if(self.init_style==OL_OPEN)
@@ -257,7 +257,7 @@
     AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
     AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
     NSMutableArray *items = [self.toolbarView.items mutableCopy];
     NSMutableArray *items = [self.toolbarView.items mutableCopy];
     
     
-    if(appDelegate.user && appDelegate.user_type == USER_ROLE_CUSTOMER && appDelegate.customer_type == CustomerTypeStore) {
+    if(RASingleton.sharedInstance.user && appDelegate.user_type == USER_ROLE_CUSTOMER && appDelegate.customer_type == CustomerTypeStore) {
         
         
         //  Check for Saved Order中Type和History Type不一致导致Status不正确
         //  Check for Saved Order中Type和History Type不一致导致Status不正确
         [RASingleton sharedInstance].customer_order_type = self.orderType;
         [RASingleton sharedInstance].customer_order_type = self.orderType;
@@ -373,7 +373,7 @@
     }
     }
     
     
     // 显示Sales Order与否
     // 显示Sales Order与否
-    if (appDelegate.user && appDelegate.user_type == USER_ROLE_CUSTOMER && appDelegate.customer_type == CustomerTypeStore) {
+    if (RASingleton.sharedInstance.user && appDelegate.user_type == USER_ROLE_CUSTOMER && appDelegate.customer_type == CustomerTypeStore) {
         if ([RASingleton sharedInstance].global_lock || ![RASingleton sharedInstance].customer_can_see_sales_Order) { // 是否解锁,是否有查看Sales Order权限
         if ([RASingleton sharedInstance].global_lock || ![RASingleton sharedInstance].customer_can_see_sales_Order) { // 是否解锁,是否有查看Sales Order权限
             if (self.orderTypeSegmentControl.numberOfSegments > 1) {
             if (self.orderTypeSegmentControl.numberOfSegments > 1) {
                 [self.orderTypeSegmentControl removeSegmentAtIndex:1 animated:YES];
                 [self.orderTypeSegmentControl removeSegmentAtIndex:1 animated:YES];
@@ -1067,7 +1067,7 @@
         NSInteger statusCode = [[self.content_data[indexPath.row] valueForKey:@"orderStatus"] integerValue];
         NSInteger statusCode = [[self.content_data[indexPath.row] valueForKey:@"orderStatus"] integerValue];
         NSString* purchase_time= [self.content_data[indexPath.row] valueForKey:@"purchase_time"];
         NSString* purchase_time= [self.content_data[indexPath.row] valueForKey:@"purchase_time"];
         NSString* status = [self.content_data[indexPath.row] valueForKey:@"order_status"] ;
         NSString* status = [self.content_data[indexPath.row] valueForKey:@"order_status"] ;
-        if (appDelegate.user && appDelegate.user_type == USER_ROLE_CUSTOMER && appDelegate.customer_type == CustomerTypeStore) {
+        if (RASingleton.sharedInstance.user && appDelegate.user_type == USER_ROLE_CUSTOMER && appDelegate.customer_type == CustomerTypeStore) {
             status = [ERPUtils orderStatus:statusCode];
             status = [ERPUtils orderStatus:statusCode];
         }
         }
         NSString* customer_name = [self.content_data[indexPath.row] valueForKey:@"customer_name"];
         NSString* customer_name = [self.content_data[indexPath.row] valueForKey:@"customer_name"];

+ 1 - 1
RedAnt ERP Mobile/common/Functions/order/RAOrderEditorViewController.m

@@ -1361,7 +1361,7 @@ static const int totalPage = 3;
     AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
     AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
     MainViewController *mainVC = (MainViewController *)appDelegate.main_vc;
     MainViewController *mainVC = (MainViewController *)appDelegate.main_vc;
     __block NSString* labelsotext= mainVC.labelSo.text;
     __block NSString* labelsotext= mainVC.labelSo.text;
-    [appDelegate.urgencyDic setValue:appDelegate.user forKey:@"user"];
+    [appDelegate.urgencyDic setValue:RASingleton.sharedInstance.user forKey:@"user"];
 #ifdef OFFLINE_MODE
 #ifdef OFFLINE_MODE
     [appDelegate.urgencyDic setValue:[NSNumber numberWithBool:appDelegate.offline_mode] forKey:@"offline_mode"];
     [appDelegate.urgencyDic setValue:[NSNumber numberWithBool:appDelegate.offline_mode] forKey:@"offline_mode"];
 #endif
 #endif

+ 1 - 1
RedAnt ERP Mobile/common/Functions/order/RAOrderPreviewController.m

@@ -1508,7 +1508,7 @@
     
     
     AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
     AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
     
     
-    [appDelegate.urgencyDic setValue:appDelegate.user forKey:@"user"];
+    [appDelegate.urgencyDic setValue:RASingleton.sharedInstance.user forKey:@"user"];
 #ifdef OFFLINE_MODE
 #ifdef OFFLINE_MODE
     [appDelegate.urgencyDic setValue:[NSNumber numberWithBool:appDelegate.offline_mode] forKey:@"offline_mode"];
     [appDelegate.urgencyDic setValue:[NSNumber numberWithBool:appDelegate.offline_mode] forKey:@"offline_mode"];
 #endif
 #endif

+ 1 - 1
RedAnt ERP Mobile/common/Functions/portfolio/PortfolioListViewController.m

@@ -701,7 +701,7 @@
     
     
     NSString* create_user= [self.content_data[indexPath.row] valueForKey:@"create_user"];
     NSString* create_user= [self.content_data[indexPath.row] valueForKey:@"create_user"];
     AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
     AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-    if([create_user isEqualToString:appDelegate.user])
+    if([create_user isEqualToString:RASingleton.sharedInstance.user])
     {
     {
 //         return @[deleteRowAction];
 //         return @[deleteRowAction];
         return  [UISwipeActionsConfiguration configurationWithActions:@[deleteRowAction]];
         return  [UISwipeActionsConfiguration configurationWithActions:@[deleteRowAction]];

+ 1 - 1
RedAnt ERP Mobile/common/Functions/portfolio/TearSheetParamViewController.m

@@ -701,7 +701,7 @@
     
     
     AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
     AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
     
     
-    [appDelegate.urgencyDic setValue:appDelegate.user forKey:@"user"];
+    [appDelegate.urgencyDic setValue:RASingleton.sharedInstance.user forKey:@"user"];
 #ifdef OFFLINE_MODE
 #ifdef OFFLINE_MODE
     [appDelegate.urgencyDic setValue:[NSNumber numberWithBool:appDelegate.offline_mode] forKey:@"offline_mode"];
     [appDelegate.urgencyDic setValue:[NSNumber numberWithBool:appDelegate.offline_mode] forKey:@"offline_mode"];
 #endif
 #endif

+ 2 - 2
RedAnt ERP Mobile/common/Functions/search+itemsearch/ItemSearchViewController.m

@@ -463,7 +463,7 @@
     // customer 隐藏add to portfolio
     // customer 隐藏add to portfolio
     AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
     AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
     NSMutableArray *items = [self.selectToolbar.items mutableCopy];
     NSMutableArray *items = [self.selectToolbar.items mutableCopy];
-    if (appDelegate.user && appDelegate.user_type == USER_ROLE_CUSTOMER && appDelegate.customer_type == CustomerTypeStore) {
+    if (RASingleton.sharedInstance.user && appDelegate.user_type == USER_ROLE_CUSTOMER && appDelegate.customer_type == CustomerTypeStore) {
         
         
         if ([items containsObject:self.addPortfolioBtn]) {
         if ([items containsObject:self.addPortfolioBtn]) {
             
             
@@ -1242,7 +1242,7 @@
     
     
 
 
     AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
     AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
-    if (appDelegate.user && appDelegate.user_type == USER_ROLE_CUSTOMER && appDelegate.customer_type == CustomerTypeStore) {
+    if (RASingleton.sharedInstance.user && appDelegate.user_type == USER_ROLE_CUSTOMER && appDelegate.customer_type == CustomerTypeStore) {
         [RAUtils message_box:@"Warning" message:@"Cannot Add to portfolio." completion:nil] ;
         [RAUtils message_box:@"Warning" message:@"Cannot Add to portfolio." completion:nil] ;
         return;
         return;
     }
     }

+ 2 - 2
RedAnt ERP Mobile/common/Functions/search+itemsearch/SearchViewController.m

@@ -192,7 +192,7 @@
     // customer 隐藏add to portfolio
     // customer 隐藏add to portfolio
     AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
     AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
     NSMutableArray *items = [self.selectToolbar.items mutableCopy];
     NSMutableArray *items = [self.selectToolbar.items mutableCopy];
-    if (appDelegate.user && appDelegate.user_type == USER_ROLE_CUSTOMER && appDelegate.customer_type == CustomerTypeStore) {
+    if (RASingleton.sharedInstance.user && appDelegate.user_type == USER_ROLE_CUSTOMER && appDelegate.customer_type == CustomerTypeStore) {
         
         
         if ([items containsObject:self.addPortfolioBtn]) {
         if ([items containsObject:self.addPortfolioBtn]) {
             
             
@@ -1081,7 +1081,7 @@
 
 
     
     
     AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
     AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
-    if (appDelegate.user && appDelegate.user_type == USER_ROLE_CUSTOMER && appDelegate.customer_type == CustomerTypeStore) {
+    if (RASingleton.sharedInstance.user && appDelegate.user_type == USER_ROLE_CUSTOMER && appDelegate.customer_type == CustomerTypeStore) {
 
 
         [RAUtils message_box:@"Warning" message:@"Cannot Add to portfolio." completion:nil];
         [RAUtils message_box:@"Warning" message:@"Cannot Add to portfolio." completion:nil];
         return;
         return;

+ 2 - 2
RedAnt ERP Mobile/common/Functions/sidemenu/LoginViewController.m

@@ -311,7 +311,7 @@
                         NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
                         NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
                         [defaults removeObjectForKey:@"user"];
                         [defaults removeObjectForKey:@"user"];
                         [defaults removeObjectForKey:@"password"];
                         [defaults removeObjectForKey:@"password"];
-                        NSString* encryptu=[AESCrypt encrypt:appDelegate.user password:@"usai"];
+                        NSString* encryptu=[AESCrypt encrypt:RASingleton.sharedInstance.user password:@"usai"];
                         NSString* encryptp=[AESCrypt encrypt:self.editpass.text password:@"usai"] ;
                         NSString* encryptp=[AESCrypt encrypt:self.editpass.text password:@"usai"] ;
                         if(self.checkSavePassword.selected)
                         if(self.checkSavePassword.selected)
                         {
                         {
@@ -360,7 +360,7 @@
                             
                             
                             bool offline_dirty=[defaults boolForKey:@"OFFLINE_DIRTY"];
                             bool offline_dirty=[defaults boolForKey:@"OFFLINE_DIRTY"];
                             sqlite3* db = [iSalesDB get_db];
                             sqlite3* db = [iSalesDB get_db];
-                            int offline_user_exist=[iSalesDB get_recordcount:db table:@"offline_login" where:[NSString stringWithFormat:@"username='%@'",appDelegate.user ]];
+                            int offline_user_exist=[iSalesDB get_recordcount:db table:@"offline_login" where:[NSString stringWithFormat:@"username='%@'",RASingleton.sharedInstance.user ]];
                             
                             
                             [iSalesDB close_db:db];
                             [iSalesDB close_db:db];
                             
                             

+ 5 - 5
RedAnt ERP Mobile/common/Functions/sidemenu/UserListViewController.m

@@ -105,7 +105,7 @@
     
     
     if(appDelegate.bLogin)
     if(appDelegate.bLogin)
     {
     {
-        if ([user.lowercaseString isEqualToString:appDelegate.user.lowercaseString]) { // 当前用户
+        if ([user.lowercaseString isEqualToString:RASingleton.sharedInstance.user.lowercaseString]) { // 当前用户
             [self dismissViewControllerAnimated:YES completion:nil];
             [self dismissViewControllerAnimated:YES completion:nil];
             return;
             return;
         }
         }
@@ -167,7 +167,7 @@
                                     [defaults removeObjectForKey:@"password"];
                                     [defaults removeObjectForKey:@"password"];
                                     if(true)
                                     if(true)
                                     {
                                     {
-                                        NSString* encryptu=[AESCrypt encrypt:appDelegate.user password:@"usai"];
+                                        NSString* encryptu=[AESCrypt encrypt:RASingleton.sharedInstance.user password:@"usai"];
                                         NSString* encryptp=[AESCrypt encrypt:appDelegate.password password:@"usai"] ;
                                         NSString* encryptp=[AESCrypt encrypt:appDelegate.password password:@"usai"] ;
                                         
                                         
                                         [defaults setValue:encryptu forKey:@"user"];
                                         [defaults setValue:encryptu forKey:@"user"];
@@ -263,7 +263,7 @@
                         //                            [defaults removeObjectForKey:@"password"];
                         //                            [defaults removeObjectForKey:@"password"];
                         //                            if(true)
                         //                            if(true)
                         //                            {
                         //                            {
-                        //                                NSString* encryptu=[AESCrypt encrypt:appDelegate.user password:@"usai"];
+                        //                                NSString* encryptu=[AESCrypt encrypt:RASingleton.sharedInstance.user password:@"usai"];
                         //                                NSString* encryptp=[AESCrypt encrypt:appDelegate.password password:@"usai"] ;
                         //                                NSString* encryptp=[AESCrypt encrypt:appDelegate.password password:@"usai"] ;
                         //
                         //
                         //                                [defaults setValue:encryptu forKey:@"user"];
                         //                                [defaults setValue:encryptu forKey:@"user"];
@@ -401,7 +401,7 @@
 //                        [defaults removeObjectForKey:@"password"];
 //                        [defaults removeObjectForKey:@"password"];
 //                        if(true)
 //                        if(true)
 //                        {
 //                        {
-//                            NSString* encryptu=[AESCrypt encrypt:appDelegate.user password:@"usai"];
+//                            NSString* encryptu=[AESCrypt encrypt:RASingleton.sharedInstance.user password:@"usai"];
 //                            NSString* encryptp=[AESCrypt encrypt:appDelegate.password password:@"usai"] ;
 //                            NSString* encryptp=[AESCrypt encrypt:appDelegate.password password:@"usai"] ;
 //
 //
 //                            [defaults setValue:encryptu forKey:@"user"];
 //                            [defaults setValue:encryptu forKey:@"user"];
@@ -493,7 +493,7 @@
 ////                            [defaults removeObjectForKey:@"password"];
 ////                            [defaults removeObjectForKey:@"password"];
 ////                            if(true)
 ////                            if(true)
 ////                            {
 ////                            {
-////                                NSString* encryptu=[AESCrypt encrypt:appDelegate.user password:@"usai"];
+////                                NSString* encryptu=[AESCrypt encrypt:RASingleton.sharedInstance.user password:@"usai"];
 ////                                NSString* encryptp=[AESCrypt encrypt:appDelegate.password password:@"usai"] ;
 ////                                NSString* encryptp=[AESCrypt encrypt:appDelegate.password password:@"usai"] ;
 ////
 ////
 ////                                [defaults setValue:encryptu forKey:@"user"];
 ////                                [defaults setValue:encryptu forKey:@"user"];

+ 5 - 1
RedAnt ERP Mobile/common/RASingleton.m

@@ -40,7 +40,11 @@
     }
     }
     return [self.globalParameters objectForKey:key];
     return [self.globalParameters objectForKey:key];
 }
 }
-
+- (void)setUser:(NSString *)user {
+    _user = user;
+    
+    [self setGlobalParameter:_user forKey:@"user"];
+}
 - (void)dealloc {
 - (void)dealloc {
     [[NSNotificationCenter defaultCenter] removeObserver:self];
     [[NSNotificationCenter defaultCenter] removeObserver:self];
     
     

+ 2 - 2
RedAnt ERP Mobile/common/customUI/ImageUploadViewController.m

@@ -308,8 +308,8 @@
         
         
         NSMutableDictionary* params = [[NSMutableDictionary alloc] init];
         NSMutableDictionary* params = [[NSMutableDictionary alloc] init];
         
         
-        if(appDelegate.user!=nil)
-            [params setValue:appDelegate.user forKey:@"user"];
+        if(RASingleton.sharedInstance.user!=nil)
+            [params setValue:RASingleton.sharedInstance.user forKey:@"user"];
         if(appDelegate.password!=nil)
         if(appDelegate.password!=nil)
             [params setValue:appDelegate.password forKey:@"password"];
             [params setValue:appDelegate.password forKey:@"password"];
         
         

+ 8 - 8
RedAnt ERP Mobile/common/data_provider/RADataProvider.m

@@ -224,7 +224,7 @@ NSDate * ddate =[dateFormatter dateFromString:@"2023-08-01"];
 +(NSString*) queryStock:(NSString*)modelname
 +(NSString*) queryStock:(NSString*)modelname
 {
 {
     AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
     AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-    NSString* user =appDelegate.user;
+    NSString* user =RASingleton.sharedInstance.user;
     if(user.length==0||[user.lowercaseString isEqualToString:@"guest"])
     if(user.length==0||[user.lowercaseString isEqualToString:@"guest"])
         return @"Stock:0";
         return @"Stock:0";
     
     
@@ -251,7 +251,7 @@ NSDate * ddate =[dateFormatter dateFromString:@"2023-08-01"];
     AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
     AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
     
     
     
     
-    NSString* user =appDelegate.user;
+    NSString* user =RASingleton.sharedInstance.user;
     
     
 
 
     if(user.length==0||[user.lowercaseString isEqualToString:@"guest"])
     if(user.length==0||[user.lowercaseString isEqualToString:@"guest"])
@@ -755,7 +755,7 @@ NSDate * ddate =[dateFormatter dateFromString:@"2023-08-01"];
     AppDelegate *appDelegate = nil;
     AppDelegate *appDelegate = nil;
     
     
     appDelegate=(AppDelegate*)[[UIApplication sharedApplication] delegate];
     appDelegate=(AppDelegate*)[[UIApplication sharedApplication] delegate];
-   if( [appDelegate.user isEqualToString:@"GUEST"])
+   if( [RASingleton.sharedInstance.user isEqualToString:@"GUEST"])
        return false;
        return false;
     NSDictionary *addressDic = [[NSUserDefaults standardUserDefaults] valueForKey:@"ScanAddress"];;
     NSDictionary *addressDic = [[NSUserDefaults standardUserDefaults] valueForKey:@"ScanAddress"];;
     if (addressDic) {
     if (addressDic) {
@@ -776,7 +776,7 @@ NSDate * ddate =[dateFormatter dateFromString:@"2023-08-01"];
     param[@"_method"]=@"changePasswordOfflineOrderUser";
     param[@"_method"]=@"changePasswordOfflineOrderUser";
     param[@"opsw"]=appDelegate.password;
     param[@"opsw"]=appDelegate.password;
     param[@"npsw"]=pwd;
     param[@"npsw"]=pwd;
-    param[@"user"]=appDelegate.user;
+    param[@"user"]=RASingleton.sharedInstance.user;
     param[@"site_name"]=[self getSiteName];
     param[@"site_name"]=[self getSiteName];
 //    param[@"url"]=url;
 //    param[@"url"]=url;
     
     
@@ -832,8 +832,8 @@ NSDate * ddate =[dateFormatter dateFromString:@"2023-08-01"];
     AppDelegate *appDelegate = nil;
     AppDelegate *appDelegate = nil;
     
     
     appDelegate=(AppDelegate*)[[UIApplication sharedApplication] delegate];
     appDelegate=(AppDelegate*)[[UIApplication sharedApplication] delegate];
-    if(appDelegate.user!=nil)
-        [params setValue:appDelegate.user forKey:@"user"];
+    if(RASingleton.sharedInstance.user!=nil)
+        [params setValue:RASingleton.sharedInstance.user forKey:@"user"];
     
     
     
     
     //    if(![appDelegate.order_customer_id isEqualToString: appDelegate.contact_id]&& appDelegate.order_customer_id!=nil)
     //    if(![appDelegate.order_customer_id isEqualToString: appDelegate.contact_id]&& appDelegate.order_customer_id!=nil)
@@ -998,8 +998,8 @@ NSDate * ddate =[dateFormatter dateFromString:@"2023-08-01"];
     
     
     appDelegate=(AppDelegate*)[[UIApplication sharedApplication] delegate];
     appDelegate=(AppDelegate*)[[UIApplication sharedApplication] delegate];
     
     
-    if(appDelegate.user!=nil)
-        [params setValue:appDelegate.user forKey:@"user"];
+    if(RASingleton.sharedInstance.user!=nil)
+        [params setValue:RASingleton.sharedInstance.user forKey:@"user"];
     if(appDelegate.contact_id!=nil)
     if(appDelegate.contact_id!=nil)
         [params setValue:appDelegate.contact_id forKey:@"contactId"];
         [params setValue:appDelegate.contact_id forKey:@"contactId"];
     if(appDelegate.password!=nil)
     if(appDelegate.password!=nil)

Разница между файлами не показана из-за своего большого размера
+ 181 - 181
RedAnt ERP Mobile/common/data_provider/RANetwork.m


+ 1 - 1
RedAnt ERP Mobile/common/data_provider/iSalesDB.m

@@ -134,7 +134,7 @@ void decryptfield (sqlite3_context *context, int argc, sqlite3_value **argv) {
         sqlite3* db = [self get_db ];
         sqlite3* db = [self get_db ];
         NSMutableArray* ret = [[NSMutableArray alloc] init];
         NSMutableArray* ret = [[NSMutableArray alloc] init];
         //        ApexMobileAppDelegate *appDelegate = [[UIApplication sharedApplication] delegate];
         //        ApexMobileAppDelegate *appDelegate = [[UIApplication sharedApplication] delegate];
-        //        NSString* user = appDelegate.user;
+        //        NSString* user = RASingleton.sharedInstance.user;
         NSString *sqlQuery = @"select name,pwd from login_info ";
         NSString *sqlQuery = @"select name,pwd from login_info ";
         sqlite3_stmt * statement;
         sqlite3_stmt * statement;
         
         

+ 2 - 2
common/NetworkUtils.m

@@ -262,8 +262,8 @@ repeat:
 {
 {
     //    NSMutableDictionary* params = [[NSMutableDictionary alloc] init];
     //    NSMutableDictionary* params = [[NSMutableDictionary alloc] init];
     //    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
     //    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-    //    if(appDelegate.user!=nil)
-    //        [params setValue:appDelegate.user forKey:@"user"];
+    //    if(RASingleton.sharedInstance.user!=nil)
+    //        [params setValue:RASingleton.sharedInstance.user forKey:@"user"];
     //
     //
     //    [params setValue:up_params forKey:@"upparam"];
     //    [params setValue:up_params forKey:@"upparam"];
     //
     //

Некоторые файлы не были показаны из-за большого количества измененных файлов