DB_Helper.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. //
  2. // DB_Helper.h
  3. // Texts
  4. //
  5. // Created by tongjun on 13-10-12.
  6. // Copyright (c) 2013年 tongjun. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. #import "UserInfo.h"
  10. #import "TrainRecord.h"
  11. #import "Grade.h"
  12. #define dataBaseName @"miaxis_new_1230.db"
  13. #define dataBasePath [[(NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES)) lastObject]stringByAppendingPathComponent:dataBaseName]
  14. @interface DB_Helper : NSObject
  15. //创建数据库类的单例对象
  16. + (FMDatabase *)createDataBase;
  17. //关闭数据库
  18. + (void)closeDataBase;
  19. //将数据库拷贝到手机
  20. + (void)copyFileDatabase;
  21. //理论学时
  22. //保存训练明细
  23. +(void)saveTrain:(TrainRecord *)trainRecord;
  24. //读取训练明细 要分科目
  25. +(NSArray *)quearyTrain:(NSString *)stuId Subject:(NSString *)sub;
  26. //训练明细状态修改 0:未上传 1:已上传
  27. +(void)updateTrainState:(TrainRecord *)trainRecord;
  28. + (void)deleteTrain:(TrainRecord *)trainRecord;
  29. //实操/模拟学时表
  30. //保存学时
  31. + (void)saveTrainWithDic:(NSDictionary *)dic type:(NSString *)type;
  32. //删除单条学时
  33. + (void)deleteTrainWithTrainNum:(NSString *)trainNum type:(NSString *)type;
  34. //删除某课堂学时
  35. + (void)deleteTrainWithClassId:(NSString *)classId type:(NSString *)type;
  36. //删除所有学时
  37. + (void)deleteAllTrainWithType:(NSString *)type;
  38. //查询classId下的所有学时
  39. + (NSArray *)quearyTrainWithClassId:(NSString *)classId type:(NSString *)type;
  40. + (void)deleteTrainRecord:(TrainRecord *)trainRecord;
  41. //理论题目练习成绩表
  42. +(void)saveGrade:(Grade *)aGrade;
  43. /**
  44. where state = 0
  45. */
  46. +(NSArray *)quearyGrade;
  47. +(void)updateGrade:(Grade *)aGrade;
  48. @end