Ejemplo n.º 1
0
        //
        // GET: /ExamAbsent/



        public ActionResult Index(TB_APPLICATION_STUDENT _model)
        {
            var varListOfConcern = from sch in db.TB_APPLICATION_SCHOOL
                                   join std in db.TB_APPLICATION_STUDENT on sch.SCHOOL_ID equals std.STD_SCHOOL_ID
                                   join staff in db.TB_APPLICATION_STAFF on sch.SCHOOL_ID equals staff.STAFF_SCHOOL_ID
                                   join lv in db.TB_M_LEVEL on std.STD_LEVEL_ID equals lv.LEVEL_ID
                                   where std.STD_IS_CONCERN == "1" && std.STD_BIRTH_DAY != null
                                   select new ConcernView()
            {
                SCHOOL_NAME = sch.SCHOOL_NAME,
                STD_NAME    = std.STD_NAME,
                STD_SURNAME = std.STD_SURNAME,
                STAFF_NAME  = staff.STAFF_NAME,
                STAFF_PHONE = staff.STAFF_PHONE,
                LEVEL_NAME  = lv.LEVEL_NAME_TH
            };


            List <ConcernView> reportLists = varListOfConcern.ToList();

            int seq = 1;

            foreach (ConcernView std in reportLists)
            {
                std.seq = seq;
                seq++;
            }
            if (reportLists != null)
            {
                var pageIndex = _model.Page ?? 1;
                _model.reports = reportLists.ToPagedList(pageIndex, 20);
            }
            return(View(_model));
        }
Ejemplo n.º 2
0
        public ActionResult Edit(TB_APPLICATION_STUDENT tb_application_student)
        {
            if (ModelState.IsValid)
            {
                int schoolId = (int)Session["Phet10ManagementSchoolId"];

                var _update = db.TB_APPLICATION_STUDENT.FirstOrDefault(f => f.STD_ID == tb_application_student.STD_ID);
                if (_update != null)
                {
                    _update.STD_SCHOOL_ID       = schoolId;
                    _update.STD_TITLE_ID        = tb_application_student.STD_TITLE_ID;
                    _update.STD_NAME            = tb_application_student.STD_NAME;
                    _update.STD_SURNAME         = tb_application_student.STD_SURNAME;
                    _update.STD_LEVEL_ID        = tb_application_student.STD_LEVEL_ID;
                    _update.STD_SCHOOL_ID       = tb_application_student.STD_SCHOOL_ID;
                    _update.STD_PICTURE_PATH    = tb_application_student.STD_PICTURE_PATH;
                    _update.STD_PHONE           = tb_application_student.STD_PHONE;
                    _update.STD_EMAIL           = tb_application_student.STD_EMAIL;
                    _update.STD_ID_CARD         = tb_application_student.STD_ID_CARD;
                    _update.STD_PASSPORT_ID     = tb_application_student.STD_PASSPORT_ID;
                    _update.STD_GRADE           = tb_application_student.STD_GRADE;
                    _update.STD_PHONE_PROVIDER  = tb_application_student.STD_PHONE_PROVIDER;
                    _update.STD_APPROVED_STATUS = tb_application_student.STD_APPROVED_STATUS;
                    _update.STD_BIRTH_DAY       = tb_application_student.STD_BIRTH_DAY;
                    _update.STD_IS_CONCERN      = tb_application_student.STD_IS_CONCERN;
                }

                db.SaveChanges();
                return(RedirectToAction("Index/" + schoolId));
            }
            ViewBag.STD_LEVEL_ID = new SelectList(db.TB_M_LEVEL, "LEVEL_ID", "LEVEL_NAME_TH", tb_application_student.STD_LEVEL_ID);
            ViewBag.STD_TITLE_ID = new SelectList(db.TB_M_TITLE, "TITLE_ID", "TITLE_NAME_TH", tb_application_student.STD_TITLE_ID);
            return(View(tb_application_student));
        }
        public JsonResult deleteStudent(String id)
        {
            int deleteId = Convert.ToInt16(id);
            TB_APPLICATION_STUDENT student = db.TB_APPLICATION_STUDENT.Where(s => s.STD_ID == deleteId).FirstOrDefault();

            db.TB_APPLICATION_STUDENT.Remove(student);
            int result = db.SaveChanges();

            return(Json(true));
        }
Ejemplo n.º 4
0
        //
        // GET: /Student/Edit/5

        public ActionResult Edit(int id = 0)
        {
            TB_APPLICATION_STUDENT tb_application_student = db.TB_APPLICATION_STUDENT.Single(t => t.STD_ID == id);

            if (tb_application_student == null)
            {
                return(HttpNotFound());
            }
            ViewBag.STD_LEVEL_ID        = new SelectList(db.TB_M_LEVEL, "LEVEL_ID", "LEVEL_NAME_TH", tb_application_student.STD_LEVEL_ID);
            ViewBag.STD_TITLE_ID        = new SelectList(db.TB_M_TITLE, "TITLE_ID", "TITLE_NAME_TH", tb_application_student.STD_TITLE_ID);
            ViewBag.STD_APPROVED_STATUS = new SelectList(db.TB_M_STATUS, "STATUS_ID", "STATUS_NAME_TH", tb_application_student.STD_APPROVED_STATUS);
            return(View(tb_application_student));
        }
Ejemplo n.º 5
0
        /* CUSTOM EVENT*/
        public JsonResult DeleteStudent(int ID)
        {
            TB_APPLICATION_STUDENT tb_application_student = db.TB_APPLICATION_STUDENT.Single(t => t.STD_ID == ID);

            if (tb_application_student != null)
            {
                db.TB_APPLICATION_STUDENT.Remove(tb_application_student);
                db.SaveChanges();
            }

            // delete the record from ID and return true else false
            return(Json(true, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 6
0
        public ActionResult Create(TB_APPLICATION_STUDENT tb_application_student)
        {
            if (ModelState.IsValid)
            {
                int schoolId = (int)Session["Phet10ManagementSchoolId"];
                tb_application_student.STD_SCHOOL_ID = schoolId;
                db.TB_APPLICATION_STUDENT.Add(tb_application_student);
                db.SaveChanges();
                return(RedirectToAction("Index/" + schoolId));
            }

            ViewBag.STD_LEVEL_ID = new SelectList(db.TB_M_LEVEL, "LEVEL_ID", "LEVEL_NAME_TH", tb_application_student.STD_LEVEL_ID);
            ViewBag.STD_TITLE_ID = new SelectList(db.TB_M_TITLE, "TITLE_ID", "TITLE_NAME_TH", tb_application_student.STD_TITLE_ID);

            return(View(tb_application_student));
        }
Ejemplo n.º 7
0
 public String getStudentFullName(TB_APPLICATION_STUDENT student)
 {
     return(student.TB_M_TITLE.TITLE_NAME_TH + "" + student.STD_NAME + "  " + student.STD_SURNAME);
 }