Пример #1
0
        public ActionResult InputMultipleEdit(int id = 0)
        {
            using (var db = new XkSystem.Models.DbContext())
            {
                var vm            = new Models.PerformDataDay.InputMultipleEdit();
                var tbPerformItem = (from p in db.Table <Entity.tbPerformItem>()
                                     where p.Id == vm.PerformItemId &&
                                     p.IsSelect && p.IsMany
                                     select p).FirstOrDefault();

                if (tbPerformItem == null)
                {
                }
                else
                {
                    vm.PerformOptionList = PerformOptionController.SelectList(vm.PerformItemId);
                }
                if (id != 0)
                {
                    var tb = (from p in db.Table <Entity.tbPerformData>()
                              where p.Id == id
                              select new Dto.PerformDataDay.InputMultipleEdit
                    {
                        Id = p.Id,
                        PerformItemName = p.tbPerformItem.PerformItemName,
                        StudentCode = p.tbStudent.StudentCode,
                        StudentName = p.tbStudent.StudentName,
                        Score = p.Score,
                        PerformOptionId = p.tbPerformOption == null ? 0 : p.tbPerformOption.Id
                    }).FirstOrDefault();

                    if (tb != null)
                    {
                        vm.PerformInputMultipleEdit = tb;
                    }
                }
                else
                {
                    vm.PerformInputMultipleEdit.PerformItemName = db.Set <Entity.tbPerformItem>().Find(vm.PerformItemId).PerformItemName;
                    vm.PerformInputMultipleEdit.StudentName     = db.Set <Student.Entity.tbStudent>().Find(vm.StudentId).StudentName;
                }
                return(View(vm));
            }
        }
Пример #2
0
        public ActionResult InputMultipleList()
        {
            using (var db = new XkSystem.Models.DbContext())
            {
                var vm = new Models.PerformDataDay.InputMultipleList();

                vm.PerformInputMultipleList = (from p in db.Table <Entity.tbPerformData>()
                                               where p.tbPerformItem.Id == vm.PerformItemId &&
                                               p.tbStudent.Id == vm.StudentId &&
                                               p.tbPerformItem.IsDeleted == false &&
                                               p.tbCourse.IsDeleted == false
                                               select new Dto.PerformDataDay.InputMultipleList
                {
                    Id = p.Id,
                    PerformItemId = p.tbPerformItem.Id,
                    PerformItemName = p.tbPerformItem.PerformItemName,
                    PerformOptionId = p.tbPerformOption == null ? 0 : p.tbPerformOption.Id,
                    PerformOptionValue = p.tbPerformOption == null ? 0 : p.tbPerformOption.OptionValue,
                    StudentName = p.tbStudent.StudentName,
                    StudentCode = p.tbStudent.StudentCode,
                    StudentId = p.tbStudent.Id,
                    Score = p.Score,
                    InputDate = p.InputDate,
                    SysUserName = p.tbSysUser.UserName
                }).ToList();

                var tbPerformItem = (from p in db.Table <Entity.tbPerformItem>()
                                     where p.Id == vm.PerformItemId &&
                                     p.IsSelect && p.IsMany
                                     select p).FirstOrDefault();

                if (tbPerformItem == null)
                {
                }
                else
                {
                    vm.PerformOptionList = PerformOptionController.SelectList(vm.PerformItemId);
                }
                return(View(vm));
            }
        }