资源简介
OC语言 简单教务系统实现 有代理方法 排序 查找 删除 打印等功能
代码片段和文件信息
//
// lanOu_Company.m
// LanOuManage
//
// Created by lanou3g on 15/10/8.
// Copyright (c) 2015年 lanou3g. All rights reserved.
//
#import “lanOu_Company.h“
#import “lanOu_Students.h“
#import “lanOu_Teachers.h“
@implementation lanOu_Company
// 初始化
- ()initWithComName:(NSString *)comName comAdress:(NSString *)comAdress comDictionary:(NSMutableDictionary *)comDictionary
{
if (self = [super init]) {
_comName = comName;
_comAddress = comAdress;
_comDictionary = comDictionary;
}
return self;
}
// 添加学员到对应班级中,如果没有这个班级,则创建,如果姓名和班级为NULL,则创建不成功
- (void)addStudentToClass:(lanOu_Students *)student andClassDictionary:(NSMutableDictionary *)classes
{
for (NSString *key in [classes allKeys]) {
if ([key isEqualToString:[student className]]) {
NSInteger countKey = [[classes valueForKey:key] count];
if(countKey == 0){
[[classes valueForKey:key] insertobject:student atIndex:0];
}else{
[[classes valueForKey:key] insertobject:student atIndex:countKey ];
}
}else{
NSMutableArray *array = [[NSMutableArray alloc]initWithobjects:student nil];
[classes setValue:array forKey:[student stuName]];
}
}
}
// 根据班号查找所有学员 并将学员按年龄升序排序
- (void)searchAllStudentByClassName:(NSString *)className ClassDictionary:(NSMutableDictionary *)classes
{
NSString *keyfag = [[NSString alloc]init];
for (NSString *key in [classes allKeys]) {
if ([key isEqualToString:className]) {
keyfag = key;
}
}
[[classes valueForKey:keyfag] sortUsingComparator:^NSComparisonResult(lanOu_Students *s1 lanOu_Students *s2) {
return s1.stuAge > s2.stuAge ? 1 : 0;
}];
for (lanOu_Students *student in [classes valueForKey:keyfag]) {
[student printStudentInfo];
}
}
// 根据姓名查找学员
- (lanOu_Students *)searchStudentByStudentName:(NSString *)stuName ClassDictionary:(NSMutableDictionary *)classes
{
lanOu_Students *student2 = [[lanOu_Students alloc]init];
for (NSString *key in [classes allKeys]) {
for (lanOu_Students *student in [classes valueForKey:key]) {
if ([stuName isEqualToString:student.stuName]) {
[student printStudentInfo];
student2 = student;
}
}
}
return student2;
}
// 根据班号,删除某个班的所有学员
- (void)deleteAllStudentByClassName:(NSString *)className ClassDictionary:(NSMutableDictionary *)classes
{
NSLog(@“123“);
NSString *keyfag = [[NSString alloc]init];
for (NSString *key in [classes allKeys]) {
if ([className isEqualToString:key]) {
keyfag = key;
for (lanOu_Students *student in [classes valueForKey:keyfag]) {
[student printStudentInfo];
}
}
}
[[classes valueForKey:keyfag] removeAllobjects];
}
// 展示所有学员的所有信息
- (void)printAllStudentInfoInClassDictionary:(NSMutableDictionary *)classes
{
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2015-10-09 09:00 LanOuManage\
文件 6148 2015-10-10 16:41 LanOuManage\.DS_Store
目录 0 2015-11-15 13:20 __MACOSX\
目录 0 2015-11-15 13:20 __MACOSX\LanOuManage\
文件 120 2015-10-10 16:41 __MACOSX\LanOuManage\._.DS_Store
目录 0 2015-11-15 13:20 LanOuManage\LanOuManage\
文件 1461 2015-10-10 10:45 LanOuManage\LanOuManage\lanOu_Company.h
目录 0 2015-11-15 13:20 __MACOSX\LanOuManage\LanOuManage\
文件 171 2015-10-10 10:45 __MACOSX\LanOuManage\LanOuManage\._lanOu_Company.h
文件 3787 2015-10-10 16:32 LanOuManage\LanOuManage\lanOu_Company.m
文件 171 2015-10-10 16:32 __MACOSX\LanOuManage\LanOuManage\._lanOu_Company.m
文件 1338 2015-10-10 15:49 LanOuManage\LanOuManage\lanOu_Students.h
文件 171 2015-10-10 15:49 __MACOSX\LanOuManage\LanOuManage\._lanOu_Students.h
文件 2209 2015-10-10 15:53 LanOuManage\LanOuManage\lanOu_Students.m
文件 171 2015-10-10 15:53 __MACOSX\LanOuManage\LanOuManage\._lanOu_Students.m
文件 1051 2015-10-10 16:00 LanOuManage\LanOuManage\lanOu_Teachers.h
文件 171 2015-10-10 16:00 __MACOSX\LanOuManage\LanOuManage\._lanOu_Teachers.h
文件 1838 2015-10-10 16:41 LanOuManage\LanOuManage\lanOu_Teachers.m
文件 171 2015-10-10 16:41 __MACOSX\LanOuManage\LanOuManage\._lanOu_Teachers.m
文件 3786 2015-11-15 13:20 LanOuManage\LanOuManage\main.m
文件 171 2015-11-15 13:20 __MACOSX\LanOuManage\LanOuManage\._main.m
文件 520 2015-10-10 15:10 LanOuManage\LanOuManage\PreparationBeforeTeachingDelegate.h
文件 171 2015-10-10 15:10 __MACOSX\LanOuManage\LanOuManage\._PreparationBeforeTeachingDelegate.h
目录 0 2015-10-10 15:07 LanOuManage\LanOuManage.xcodeproj\
文件 9743 2015-10-10 15:07 LanOuManage\LanOuManage.xcodeproj\project.pbxproj
目录 0 2015-10-10 08:52 LanOuManage\LanOuManage.xcodeproj\project.xcworkspace\
文件 156 2015-10-10 08:52 LanOuManage\LanOuManage.xcodeproj\project.xcworkspace\contents.xcworkspacedata
目录 0 2015-10-10 08:52 LanOuManage\LanOuManage.xcodeproj\project.xcworkspace\xcuserdata\
目录 0 2015-11-15 13:20 LanOuManage\LanOuManage.xcodeproj\project.xcworkspace\xcuserdata\lanou3g.xcuserdatad\
文件 15399 2015-11-15 13:20 LanOuManage\LanOuManage.xcodeproj\project.xcworkspace\xcuserdata\lanou3g.xcuserdatad\UserInterfaceState.xcuserstate
目录 0 2015-10-08 11:26 LanOuManage\LanOuManage.xcodeproj\xcuserdata\
............此处省略6个文件信息
相关资源
- 遗传算法求解Rosenbrock最小值
- C语言课程设计大作业-学生管理系统含
- 基于linux系统socket网络五子棋对战
- 学生管理系统的设计与实现
- 用WINSOCK实现聊天室的VC++程序设计
- MFC socket编程MyQQ
- C++版学生管理系统
- Koch曲线C语言
- 超简单的ntrip客户端C语言实现.docx
- 远程文件--select模式
- C++大作业_学生管理系统(含源代码实
- c++/MFC CSocket仿QQ聊天软件,实现1对1聊
- C语言图书管理系统代码.doc
- MFC基于TCP/IP协议的聊天室源代码 (继
- 服务端Node.js和VC++程序间通过SOCKET通信
- c语言课程设计报告 会员卡计费系统源
- 基于udp的P2P聊天工具MFC实现
- 矩阵运算C++实现.doc
- Vimba CPP Manual中文.docx
- mfc学生管理系统112034
- 局部均值滤波(local statistics neibor f
- VC++异步通信的socket类
- cocos3.x惯性滑动源码
- Windows下Socket文件数据传输
- linpop 聊天软件
- C++大作业之学生管理系统图表
- 基于Windows Socket的安全通信(C++实现)
- 页面置换算法最佳,FIFO,LRU,随机,
- 中国大学MOOC-翁恺-C语言程序设计习题
- C语言:中缀算术表达式求值栈 附答案
评论
共有 条评论