




已阅读5页,还剩3页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1. 使用到的数据库:2. 程序文件:a) Model:teacherModel.cs3. using System;4. using System.Collections.Generic;5. using System.ComponentModel.DataAnnotations;6. using System.ComponentModel.DataAnnotations.Schema;7. using System.Data.Entity;8. using System.Globalization;9. using System.Web.Security;10. using System.Data.SqlClient;11. using MvcApplication3.publicclass;12. using System.Linq;13.14.15. namespace MvcApplication3.Models16. 17. 18. public class TeacherDbContext : DbContext19. 20. public TeacherDbContext()21. : base(TeacherDbContext)22. 23. 24. public DbSet teachers get; set; 25. public DbSet tasks get; set; 26.27. 28. 29.30. Table(teacherInfo)31. public class teacherInfo32. 33. Key34. DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)35. public string tid get; set; 36.37. Required38. Display(Name = 用户名)39. public string userName get; set; 40.41. Required42. Display(Name = 密码)43. public string pwd get; set; 44.45. Required46. Display(Name = 姓名)47. public string name get; set; 48.49. Required50. Display(Name = 性别)51. public string xingbie get; set; 52.53. Required54. Display(Name = 系部)55. public string xibu get; set; 56.57. Required58. Display(Name = 电话)59. public string phone get; set; 60. 61. Table(task)62. public class task63. 64. Key65. DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)66. public string id get; set; 67.68. Required69. Display(Name = 作业)70. public string zuoye get; set; 71.72. Required73. Display(Name = 教师编号)74. public string tid get; set; 75.76. 77.78. Required79. Display(Name = 次数)80. public string countnumber get; set; 81.82. Required83. Display(Name = 识别码)84. public string keytodiff get; set; 85.86. 87. 88. public class teacherAndTask89. 90.91. public string userName get; set; 92.93. 94. public string pwd get; set; 95.96. 97. public string name get; set; 98.99. 100. public string xingbie get; set; 101.102. 103. public string xibu get; set; 104.105. 106. public string phone get; set; 107.108. 109. public string id get; set; 110.111. 112. public string zuoye get; set; 113.114. 115. public string tid get; set; 19. public string countnumber get; set; 120.121. 122. public string keytodiff get; set; 123.124. 125. 126.127. public class Login128. 129. DBClass dbObj;130. public Login()131. 132. dbObj = new DBClass();133. 134. 135.136. a) View: Index.cshtml137. model IEnumerable138.139. using System.Collections140. using MvcApplication3.Models141. 142. 143. ViewBag.Title = Index;144. TeacherDbContext db =new TeacherDbContext();145. 146. 147.148. Index149.150. 151. Html.ActionLink(Create New, Create)152. 153. 154. 155. 156. Html.DisplayNameFor(model = model.userName)157. 158. 159. Html.DisplayNameFor(model = model.pwd)160. 161. 162. Html.DisplayNameFor(model = )163. 164. 165. Html.DisplayNameFor(model = model.xingbie)166. 167. 168. Html.DisplayNameFor(model = model.xibu)169. 170. 171. Html.DisplayNameFor(model = model.phone)172. 173. 174. Html.DisplayNameFor(model = model.zuoye)175. 176. 177. Html.DisplayNameFor(model = model.tid)178. 179. 180. Html.DisplayNameFor(model = model.countnumber)181. 182. 183. Html.DisplayNameFor(model = model.keytodiff)184. 185. 186. 187.188. foreach (var item in Model) 189. 190. 191. 192. Html.DisplayFor(modelItem = item.userName)193. 194. 195. Html.DisplayFor(modelItem = item.pwd)196. 197. 198. Html.DisplayFor(modelItem = )199. 200. 201. Html.DisplayFor(modelItem = item.xingbie)202. 203. 204. Html.DisplayFor(modelItem = item.xibu)205. 206. 207. Html.DisplayFor(modelItem = item.phone)208. 209. 210. Html.DisplayFor(modelItem = item.zuoye)211. 212. 213. Html.DisplayFor(modelItem = item.tid)214. 215. 216. Html.DisplayFor(modelItem = item.countnumber)217. 218. 219. Html.DisplayFor(modelItem = item.keytodiff)220. 221. 222. Html.ActionLink(Edit, Edit, new id=item.id ) |223. Html.ActionLink(Details, Details, new id=item.id ) |224. Html.ActionLink(Delete, Delete, new id=item.id )225. 226. 227. 228.229. a) Controler: TTController.cs230. using System;231. using System.Collections.Generic;232. using System.Data;233. using System.Data.Entity;234. using System.Linq;235. using System.Web;236. using System.Web.Mvc;237. using MvcApplication3.Models;238.239. namespace MvcApplication3.Controllers240. 241. public class TTController : Controller242. 243. private TeacherDbContext db = new TeacherDbContext();244.245. /246. / GET: /TT/247.248. public ActionResult Index()249. 250. 251. var temp = from a in db.tasks252. join b in db.teachers253. on a.tid equals b.tid254. select255. new teacherAndTask256. 257. userName=b.userName,258. pwd=b.pwd,259. name=,260. xingbie =b.x
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 汉字真有趣课件状元成才路
- 审计人员工作总结(集锦15篇)
- 四川省凉山州2024-2025学年高一上学期期末考试物理试卷(含解析)
- 湖北省荆州市荆州中学2026届高三上学期8月月考语文试卷(含答案)
- 3ds Max室内设计效果图制作知到智慧树答案
- 《企业出纳实务》知到智慧树答案
- “趣”说产品设计(山东联盟)知到智慧树答案
- 2025购销个人物品合同协议书
- 汉字“不”字的起源课件
- 水运物流知识培训课件
- 道路建设三级安全教育培训
- 病历的书写规范讲课幻灯课件
- 征兵业务培训
- 心功能不全病人的护理查房
- NCCN成人癌痛指南
- 地理与生活密切相关
- 望闻问切中医四诊
- 订单交期管理制度流程
- 动画制作员职业技能大赛考试题库(浓缩500题)
- 动画制作员职业技能竞赛理论考试题库(含答案)
- 妊娠合并脓毒血症护理查房
评论
0/150
提交评论