コード例 #1
0
        // GET: AddOfficeVisit
        public async System.Threading.Tasks.Task<ActionResult> EditStudent(string id)
        {

            StudentCollection coll = new StudentCollection();

            using (var connection = new MySqlConnection(ConfigurationManager.ConnectionStrings[Constants.ConnectionStringName].ConnectionString))
            {
                await connection.OpenAsync();
                var result = new StudentRepository(connection).GetStudent(id);

                //get all possible values
                var result1 = new StudentRepository(connection).GetStudent(id);
                var result2 = new GradeRepository(connection).GetSortedGrades(result.Result.First().grade_id.ToString());
                var result3 = new SchoolRepository(connection).GetSortedSchools(result.Result.First().school_id.ToString());
                var result4 = new GenderRepository(connection).GetSortedGenders(result.Result.First().gender.ToString());
                var result5 = new HomeRoomRepository(connection).GetSortedHomeRooms(result.Result.First().homeroom_id.ToString());

                coll.singleStudent = (IEnumerable <Models.Student>)result1.Result.ToArray();
                coll.allGrades = (IEnumerable<Models.Grade>)result2.Result.ToArray();
                coll.allSchools = (IEnumerable<Models.School>)result3.Result.ToArray();
                coll.allGenders = (IEnumerable<Models.Gender>)result4.Result.ToArray();
                coll.allHomeRooms = (IEnumerable<Models.HomeRoom>)result5.Result.ToArray();

                coll.gradeselectlist = new SelectList(result2.Result.ToList(), "grade_id", "grade_value", new { id = "TxtGrade", @required = "required" });
                coll.schoolselectlist = new SelectList(result3.Result.ToList(), "school_id", "name", new { id = "TxtSchool", @required = "required" });
                coll.genderselectlist = new SelectList(result4.Result.ToList(), "gender", "gender", new { id = "TxtGender", @required = "required" });
                coll.homeroomselectlist = new SelectList(result5.Result.ToList(), "homeroom_id", "homeroom_name", new { id = "TxtHomeroom", @required = "required" });

            }
            return View(coll);
        }
コード例 #2
0
        OfficeVisitCollection PopulateAddOfficeVisit()
        {
            OfficeVisitCollection coll = new OfficeVisitCollection();

            using (var connection = new MySqlConnection(ConfigurationManager.ConnectionStrings[Constants.ConnectionStringName].ConnectionString))
            {

                var result = new StudentRepository(connection).GetStudents();
                var result2 = new ContactRepository(connection).GetContacts();
                var result3 = new ContentCourseRepository(connection).GetContentCourses();
                var result4 = new CodeOfConductViolationRepository(connection).GetCodeOfConductViolations();
                var result5 = new HomeRoomRepository(connection).GetHomeRooms();
                var result6 = new RemedialActionRepository(connection).GetRemedialActions();


                coll.allStudents = (IEnumerable<Models.Student>)result.Result.ToArray();
                coll.allReporters = coll.allHandledBys = (IEnumerable<Models.Contact>)result2.Result.ToArray();
                coll.allLocations = (IEnumerable<Models.ContentCourse>)result3.Result.ToArray();
                coll.allCodeViolations = (IEnumerable<Models.CodeOfConductViolation>)result4.Result.ToArray();
                coll.allHomeRooms = (IEnumerable<Models.HomeRoom>)result5.Result.ToArray();
                coll.allRemedials = (IEnumerable<Models.RemedialAction>)result6.Result.ToArray();

                coll.StudentSelectList = new SelectList(coll.allStudents, "student_id", "student_name", null);
                coll.ReportersSelectList = new SelectList(coll.allReporters, "contact_id", "contact_name", null);
                coll.HomeRoomSelectList = new SelectList(coll.allHomeRooms, "homeroom_id", "homeroom_name", null);
                coll.HandleBySelectList = new SelectList(coll.allHandledBys, "contact_id", "contact_name", null);
                coll.LocationSelectList = new SelectList(coll.allLocations, "content_course_id", "name", null);
                coll.RemedialSelectList = new SelectList(coll.allRemedials, "remedial_action_id", "name", null);
                coll.ViolationSelectList = new SelectList(coll.allCodeViolations, "code_of_conduct_violation_id", "name", null);

                Session["AddVisitModel"] = coll;
            }
            return coll;
        }
        public async System.Threading.Tasks.Task<ActionResult> EditOfficeVisit(string id)
        {

            OfficeVisitCollection coll = new OfficeVisitCollection();

            using (var connection = new MySqlConnection(ConfigurationManager.ConnectionStrings[Constants.ConnectionStringName].ConnectionString))
            {
                await connection.OpenAsync();
               
                var result = new StudentRepository(connection).GetStudents();
                var result2 = new ContactRepository(connection).GetContacts();
                var result3 = new ContentCourseRepository(connection).GetContentCourses();
                var result4 = new CodeOfConductViolationRepository(connection).GetCodeOfConductViolations();
                var result5 = new HomeRoomRepository(connection).GetHomeRooms();
                var result6 = new RemedialActionRepository(connection).GetRemedialActions();
                var result7 = new OfficeVisitRepository(connection).GetOfficeVisitByID(Convert.ToInt32(id));

                coll.officeVisit = result7.Result;
                
                coll.allStudents = (IEnumerable<Models.Student>)result.Result.ToArray();
                coll.allReporters = coll.allHandledBys = (IEnumerable<Models.Contact>)result2.Result.ToArray();
                coll.allLocations = (IEnumerable<Models.ContentCourse>)result3.Result.ToArray();
                coll.allCodeViolations = (IEnumerable<Models.CodeOfConductViolation>)result4.Result.ToArray();
                coll.allHomeRooms = (IEnumerable<Models.HomeRoom>)result5.Result.ToArray();
                coll.allRemedials = (IEnumerable<Models.RemedialAction>)result6.Result.ToArray();

                coll.remedialAction = new OfficeVisitRepository(connection).GetOfficeVisitRemedyAction(coll.officeVisit.office_visit_id);
                coll.CodeViolation = new OfficeVisitRepository(connection).GetOfficeVisitCodeViolation(coll.officeVisit.office_visit_id);

                coll.office_visit_id = coll.officeVisit.office_visit_id;
                coll.arrival_dt = coll.officeVisit.arrival_dt;
                coll.office_visit_dt = coll.officeVisit.office_visit_dt;
                coll.nap = coll.officeVisit.nap;
                coll.comments = coll.officeVisit.comments;

                coll.StudentSelectList =  new SelectList(coll.allStudents, "student_id", "student_name", coll.officeVisit.student_id);
                coll.ReportersSelectList = new SelectList(coll.allReporters, "contact_id", "contact_name", coll.officeVisit.sent_by_contact_id);
                coll.HomeRoomSelectList = new SelectList(coll.allHomeRooms, "homeroom_id", "homeroom_name", coll.officeVisit.homeroom_id);
                coll.HandleBySelectList = new SelectList(coll.allHandledBys, "contact_id", "contact_name", coll.officeVisit.handled_by_contact_id);
                coll.LocationSelectList = new SelectList(coll.allLocations, "content_course_id", "name", coll.officeVisit.content_course_id);
                
                coll.RemedialSelectList = new SelectList(coll.allRemedials, "remedial_action_id", "name", coll.remedialAction);
                coll.ViolationSelectList = new SelectList(coll.allCodeViolations, "code_of_conduct_violation_id", "name", coll.CodeViolation);
                Session["OfficeVisitId"] = id;
            }

            return View(coll);
        }
コード例 #4
0
 public System.Web.Mvc.RedirectResult EditHomeRm(string HomeRoomID, string HomeRoomClassRoom, string HomeRoomRoomNumber, string schoolselectlist)
 {
     using (var connection = new MySqlConnection(ConfigurationManager.ConnectionStrings[Constants.ConnectionStringName].ConnectionString))
     {
         var result = new HomeRoomRepository(connection).EditHomeRm(HomeRoomID, HomeRoomClassRoom, HomeRoomRoomNumber, schoolselectlist);
         if (result == "success")
         {
             return Redirect("HomeRoom/HomeRoom/?error=fileloaded");
         }
         else
         {
             //do something else here.
             return Redirect("HomeRoom/HomeRoom/?error=invalidfile");
         }
     }
 }
コード例 #5
0
        public async System.Threading.Tasks.Task<ActionResult> AddHomeRoom()
        {

            HomeRoomCollection coll = new HomeRoomCollection();

            using (var connection = new MySqlConnection(ConfigurationManager.ConnectionStrings[Constants.ConnectionStringName].ConnectionString))
            {
                await connection.OpenAsync();

                var result2 = new SchoolRepository(connection).GetSchools();
                var result3 = new HomeRoomRepository(connection).GetHomeRooms();

                coll.allSchools = (IEnumerable<Models.School>)result2.Result.ToArray();
                coll.schoolselectlist = new SelectList(result2.Result.ToList(), "school_id", "name", new { @required = "required" });
            }

            return View(coll);
        }
コード例 #6
0
        // GET: AddOfficeVisit
        public async System.Threading.Tasks.Task<ActionResult> EditHomeRoom(string id)
        {

            HomeRoomCollection coll = new HomeRoomCollection();

            using (var connection = new MySqlConnection(ConfigurationManager.ConnectionStrings[Constants.ConnectionStringName].ConnectionString))
            {
                await connection.OpenAsync();
                var result = new HomeRoomRepository(connection).GetHomeRoom(id);

                //get all possible values
                var result1 = new StudentRepository(connection).GetStudent(id);
                var result2 = new SchoolRepository(connection).GetSortedSchools(result.Result.First().school_id.ToString());

                coll.singleHomeRoom = (IEnumerable<Models.HomeRoom>)result.Result.ToArray();
                coll.allSchools = (IEnumerable<Models.School>)result2.Result.ToArray();

                coll.schoolselectlist = new SelectList(result2.Result.ToList(), "school_id", "name", new { id = "TxtSchool", @required = "required" });

            }
            return View(coll);
        }
コード例 #7
0
        // GET: AddOfficeVisit
        public async System.Threading.Tasks.Task<ActionResult> AddStudent()
        {

            StudentCollection coll = new StudentCollection();

            using (var connection = new MySqlConnection(ConfigurationManager.ConnectionStrings[Constants.ConnectionStringName].ConnectionString))
            {
                await connection.OpenAsync();

                var result2 = new GradeRepository(connection).GetGrades();
                var result3 = new SchoolRepository(connection).GetSchools();
                var result4 = new GenderRepository(connection).GetGenders();
                var result5 = new HomeRoomRepository(connection).GetHomeRooms();

                coll.allGrades = (IEnumerable<Models.Grade>)result2.Result.ToArray();
                coll.allSchools = (IEnumerable<Models.School>)result3.Result.ToArray();
                coll.allGenders = (IEnumerable<Models.Gender>)result4.Result.ToArray();
                coll.allHomeRooms = (IEnumerable<Models.HomeRoom>)result5.Result.ToArray();
            }

            return View(coll);
        }