コード例 #1
0
ファイル: StaffController.cs プロジェクト: punj-aab/School
        public StaffViewModel LoadViewModel()
        {
            StaffViewModel objVM = new StaffViewModel();
            ListFields objFields = null;
            objVM.ListFields = new List<ListFields>();

            SelectList classList = null;
            SelectList courseList = null;
            SelectList sectionList = null;
            SelectList departmentList = null;
            SelectList subjectList = null;
            SelectList staffTypeList = null;
            this.LoadSelectLists(out  classList, out  courseList, out  sectionList, out  departmentList, out subjectList, out staffTypeList, false);

            for (int i = 0; i < 10; i++)
            {
                objFields = new ListFields();
                objFields.CourseList = courseList;
                objFields.DepartmentList = departmentList;
                objFields.ClassList = classList;
                objFields.SectionList = sectionList;
                objFields.SubjectList = subjectList;
                objVM.ListFields.Add(objFields);
            }
            objVM.StaffTypeList = staffTypeList;
            return objVM;
        }
コード例 #2
0
ファイル: StaffController.cs プロジェクト: punj-aab/School
        public ActionResult Edit(long id)
        {
            StaffViewModel objStaff = this.repository.GetStaff(id);
            List<TeacherSubjects> objTeacherSubjectsList = this.repository.GetTeacherSubjects(objStaff.UserId);
            ListFields objFields = null;
            objStaff.Count = objTeacherSubjectsList.Count;
            objStaff.ListFields = new List<ListFields>();

            SelectList classList = null;
            SelectList courseList = null;
            SelectList sectionList = null;
            SelectList departmentList = null;
            SelectList subjectList = null;
            SelectList staffTypeList = null;

            for (int i = 0; i < objTeacherSubjectsList.Count; i++)
            {
                this.LoadSelectLists(out  classList, out  courseList, out  sectionList, out  departmentList, out subjectList, out staffTypeList, true, objStaff.OrganizationId, objTeacherSubjectsList[i].CourseId, objTeacherSubjectsList[i].DepartmentId, objTeacherSubjectsList[i].ClassId, (int)objTeacherSubjectsList[i].SectionId, objTeacherSubjectsList[i].SubjectId, objStaff.StaffTypeId);
                objFields = new ListFields();
                objFields.CourseList = courseList;
                objFields.DepartmentList = departmentList;
                objFields.ClassList = classList;
                objFields.SectionList = sectionList;
                objFields.SubjectList = subjectList;
                objFields.Id = objTeacherSubjectsList[i].Id;
                objStaff.ListFields.Add(objFields);
                if (i + 1 == objTeacherSubjectsList.Count)
                {
                    if (objTeacherSubjectsList.Count < 10)
                    {
                        for (int j = objTeacherSubjectsList.Count; j < 10; j++)
                        {
                            this.LoadSelectLists(out  classList, out  courseList, out  sectionList, out  departmentList, out subjectList, out staffTypeList, false);
                            objFields = new ListFields();
                            objFields.CourseList = courseList;
                            objFields.DepartmentList = departmentList;
                            objFields.ClassList = classList;
                            objFields.SectionList = sectionList;
                            objFields.SubjectList = subjectList;
                            objStaff.ListFields.Add(objFields);
                        }
                    }
                }
            }
            objStaff.StaffTypeList = staffTypeList;
            objStaff.StaffPermission = this.repository.GetStaffPermissions(objStaff.UserId);
            if (objStaff.StaffPermission == null)
            {
                objStaff.StaffPermission = new StaffPermission();
            }
            return View(objStaff);
        }