-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDoctorViewController.m
72 lines (59 loc) · 2.59 KB
/
DoctorViewController.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
//
// DoctorViewController.m
// FinalProject
//
// Created by Xun on 12/14/16.
// Copyright © 2016 Xun. All rights reserved.
//
#import "DoctorViewController.h"
#import "DoctorChatViewController.h"
#import "ViewDrugsTableViewController.h"
#import "ConfirmDrugTableViewController.h"
#import "AppDelegate.h"
@interface DoctorViewController ()
@end
@implementation DoctorViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
self.navigationItem.hidesBackButton = YES;
// Core Data
AppDelegate* appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
NSManagedObjectContext* context = appDelegate.persistentContainer.viewContext;
NSFetchRequest* request = [NSFetchRequest fetchRequestWithEntityName:@"DoctorAccountEntity"];
NSError* error;
NSArray* results = [context executeFetchRequest:request error:&error];
for(NSManagedObject *obj in results){
NSString* username = [obj valueForKey:@"username"];
if([username isEqualToString:self.username]){
self.name = [obj valueForKey:@"name"];
break;
}
}
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
if([segue.identifier isEqualToString:@"chatwithpatient"]){
DoctorChatViewController *controller1 = [[(UITabBarController *)segue.destinationViewController viewControllers] objectAtIndex:0];
controller1.inputStream = self.inputStream;
controller1.outputStream = self.outputStream;
controller1.name = self.name;
ViewDrugsTableViewController* controller2 = [[(UITabBarController *)segue.destinationViewController viewControllers] objectAtIndex:1];
controller2.inputStream = self.inputStream;
controller2.outputStream = self.outputStream;
controller2.username = self.username;
ConfirmDrugTableViewController* controller3 = [[(UITabBarController *)segue.destinationViewController viewControllers] objectAtIndex:2];
controller3.inputStream = self.inputStream;
controller3.outputStream = self.outputStream;
controller3.username = self.username;
controller3.name = self.name;
}
}
@end