Esempio n. 1
0
 public AnalysisExcel(DormManageMvcContext context)
 {
     Db = context;
     ClassInfoDao = new ClassInfoDao(Db);
     TeacherDao = new TeacherDao(Db);
     DormInfoDao = new DormInfoDao(Db);
 }
Esempio n. 2
0
 public DormExamBusiness(DormManageMvcContext context)
 {
     Db = context;
     UserInfoDao = new UserInfoDao(Db);
     DormExamTypeDao = new DormExamTypeDao(Db);
     DormIrregularityDao = new DormIrregularityDao(Db);
     DormInfoDao = new DormInfoDao(Db);
     _week = DateTimeHelper.GetDistanceOfNowReturnWeek(GetStartTime()).ToString();
     _schoolYear = DateTimeHelper.GetSchoolYear(DateTime.Now);
 }
 public void Given传入正确的List数据(string p0)
 {
     var classInfoDao = new ClassInfoDao(_context);
     var shangwu = classInfoDao.GetClassInfoByAbbreviation("商务11-1");
     var yingxiao = classInfoDao.GetClassInfoByAbbreviation("营销11-1");
     var dormInfoDao = new DormInfoDao(_context);
     var dormInfo = dormInfoDao.GetDormInfoByNum("A1-201");
     var dormInfo2 = dormInfoDao.GetDormInfoByNum("A1-203");
     _data = new List<DormInfoSimple>()
     {
         new DormInfoSimple
         {
             ClassInfo = shangwu,
             StudentName = "潘鹏飞",
             StudentSex = "男",
             BedNum = 1,
             Dorm = dormInfo,
             TeacherName = "李丽滢",
             IsDormLeader = "否",
             Post = "无",
             IsPartyMember =  "否"
         },
         new DormInfoSimple
         {
             ClassInfo = yingxiao,
             StudentName = "仝子辉",
             StudentSex = "男",
             BedNum = 2,
             Dorm = dormInfo,
             TeacherName = "高英",
             IsDormLeader = "否",
             Post = "无",
             IsPartyMember =  "否"
         },
         new DormInfoSimple
         {
             ClassInfo = shangwu,
             StudentName = "梁尧彬",
             StudentSex = "男",
             BedNum = 3,
             Dorm = dormInfo,
             TeacherName = "李丽滢",
             IsDormLeader = "否",
             Post = "无",
             IsPartyMember =  "否"
         },
         new DormInfoSimple
         {
             ClassInfo = shangwu,
             StudentName = "谭绪涛",
             StudentSex = "男",
             BedNum = 4,
             Dorm = dormInfo,
             TeacherName = "李丽滢",
             IsDormLeader = "否",
             Post = "无",
             IsPartyMember =  "否"
         },
         new DormInfoSimple
         {
             ClassInfo = shangwu,
             StudentName = "胡森",
             StudentSex = "男",
             BedNum = 1,
             Dorm = dormInfo2,
             TeacherName = "李丽滢",
             IsDormLeader = "否",
             Post = "无",
             IsPartyMember =  "否"
         },
         new DormInfoSimple
         {
             ClassInfo = yingxiao,
             StudentName = "周志腾",
             StudentSex = "男",
             BedNum = 2,
             Dorm = dormInfo2,
             TeacherName = "高英",
             IsDormLeader = "否",
             Post = "无",
             IsPartyMember =  "否"
         },
         new DormInfoSimple
         {
             ClassInfo = shangwu,
             StudentName = "田浩然",
             StudentSex = "男",
             BedNum = 3,
             Dorm = dormInfo2,
             TeacherName = "李丽滢",
             IsDormLeader = "否",
             Post = "无",
             IsPartyMember =  "否"
         },
         new DormInfoSimple
         {
             ClassInfo = shangwu,
             StudentName = "张路庆",
             StudentSex = "男",
             BedNum = 4,
             Dorm = dormInfo2,
             TeacherName = "李丽滢",
             IsDormLeader = "否",
             Post = "无",
             IsPartyMember =  "否"
         }
     };
     //var dormInfoSimple =
     //data.Add(dormInfoSimple);
 }
Esempio n. 4
0
        public ActionResult Modify(StudentModifyModel model)
        {
            if (ModelState.IsValid)
            {
                var classInfoDao = new ClassInfoDao(Db);
                var classInfo = classInfoDao.GetClassInfoByAbbreviation(model.ClassInfoAbb);
                if (classInfo == null) return Content("修改失败,该班级不存在");
                var dormInfoDao = new DormInfoDao(Db);
                var dormInfo = dormInfoDao.GetDormInfoByNum(model.DormNum);
                if (dormInfo == null) return Content("修改失败,该寝室不存在");

                var student = Db.Students.Find(model.Id);

                Db.Entry(student).State = EntityState.Modified;
                student.Id = model.Id;
                student.ClassInfo = classInfo;
                student.DormInfo = dormInfo;
                student.Name = model.Name;
                student.Sex = model.Sex;
                student.Nation = model.Nation;
                student.IdCard = model.IdCard;
                student.Province = model.Province;
                student.City = model.City;
                //TODO:未完

                Db.SaveChanges();
                return Content("修改成功");
            }
            else
            {
                return Content("修改失败,请检查信息录入是否正确");
            }
        }
Esempio n. 5
0
        public ActionResult Modify(DormInfoSimpleModifyModel model)
        {
            if (ModelState.IsValid)
            {
                var classInfoDao = new ClassInfoDao(Db);
                var classInfo = classInfoDao.GetClassInfoByAbbreviation(model.ClassInfoAbb);
                if (classInfo == null) return Content("修改失败,该班级不存在");
                var dormInfoDao = new DormInfoDao(Db);
                var dormInfo = dormInfoDao.GetDormInfoByNum(model.DormNum);
                if (dormInfo == null) return Content("修改失败,该寝室不存在");

                var dormInfoSimple = Db.DormInfoSimples.Find(model.Id);

                Db.Entry(dormInfoSimple).State = EntityState.Modified;
                dormInfoSimple.BedNum = model.BedNum;
                dormInfoSimple.ClassInfo = classInfo;
                dormInfoSimple.Dorm = dormInfo;
                dormInfoSimple.IsDormLeader = model.IsDormLeader;
                dormInfoSimple.IsPartyMember = model.IsPartyMember;
                dormInfoSimple.Post = model.Post;
                dormInfoSimple.StudentName = model.StudentName;
                dormInfoSimple.StudentSex = model.StudentSex;
                dormInfoSimple.TeacherName = model.TeacherName;

                Db.SaveChanges();
                return Content("修改成功");
            }
            else
            {
                return Content("修改失败,请检查信息录入是否正确");
            }
        }
Esempio n. 6
0
 public DormBusiness(DormManageMvcContext context)
 {
     Db = context;
     DormInfoDao = new DormInfoDao(Db);
 }