Example #1
0
        public ActionResult Edit(SET_TEACHER_INFO teacher)
        {
            if (ModelState.IsValid)
            {
                /*
                 * db.SET_TEACHER_INFO.Attach(set_teacher_info);
                 * db.ObjectStateManager.ChangeObjectState(set_teacher_info, EntityState.Modified);
                 * db.SaveChanges();
                 */
                decimal?USER_NO  = Session["sess_USER_NO"] as decimal?;
                decimal?LOGON_NO = Session["sess_LOGON_NO"] as decimal?;

                db.SET_TEACHER_INFO_UPDATE(teacher.TEACHER_NO, USER_NO, LOGON_NO, teacher.TEACHER_NAME,
                                           teacher.TEACHER_NAME_BNG, teacher.TEACHER_NICK_NAME, teacher.TEACHER_DOB, teacher.TEACHER_MARRIAGE_DATE,
                                           teacher.TEACHER_ADDR, teacher.TEACHER_COMENTS, teacher.TEACHER_MOBILE, teacher.INSTITUTE_NO, teacher.TEACH_DESIG_NO,
                                           teacher.IS_ACTIVE, teacher.ACTIVE_FROM, teacher.ACTIVE_TO, teacher.SL_NUM);

                foreach (Teacher_Subject subject in teacher.TeacherSubjects)
                {
                    decimal?subject_no = decimal.Parse(subject.SUBJECT_NO);
                    decimal?active     = subject.IS_ACTIVE ? 1 : 0;

                    db.SET_TEACHER_SUB_STATUS_UPDATE(teacher.TEACHER_NO, subject_no, USER_NO, LOGON_NO, active);
                }

                return(RedirectToAction("Index"));
            }
            //ViewBag.INSTITUTE_NO = new SelectList(db.SET_INSTITUTE, "INSTITUTE_NO", "LAST_ACTION", set_teacher_info.INSTITUTE_NO);
            ViewBag.TEACH_DESIG_NO = new SelectList(db.SET_TEACHER_DESIG, "TEACH_DESIG_NO", "TEACHER_DESIG_NAME",
                                                    teacher.TEACH_DESIG_NO);
            ViewBag.SUBJECT = db.SET_SUBJECT.ToList();

            return(View(teacher));
        }
Example #2
0
        //
        // GET: /TeacherEntry/Delete/5

        public ActionResult Delete(decimal id = 0)
        {
            SET_TEACHER_INFO set_teacher_info = db.SET_TEACHER_INFO.Single(s => s.TEACHER_NO == id);

            if (set_teacher_info == null)
            {
                return(HttpNotFound());
            }
            return(View(set_teacher_info));
        }
Example #3
0
        //
        // GET: /TeacherEntry/Edit/5

        public ActionResult Edit(decimal id = 0)
        {
            SET_TEACHER_INFO set_teacher_info = db.SET_TEACHER_INFO.Single(s => s.TEACHER_NO == id);

            if (set_teacher_info == null)
            {
                return(HttpNotFound());
            }
            //ViewBag.INSTITUTE_NO = new SelectList(db.SET_INSTITUTE, "INSTITUTE_NO", "LAST_ACTION", set_teacher_info.INSTITUTE_NO);
            ViewBag.TEACH_DESIG_NO = new SelectList(db.SET_TEACHER_DESIG, "TEACH_DESIG_NO", "TEACHER_DESIG_NAME",
                                                    set_teacher_info.TEACH_DESIG_NO);
            ViewBag.SUBJECT = db.SET_SUBJECT.ToList();

            return(View(set_teacher_info));
        }
Example #4
0
        public ActionResult Create(SET_TEACHER_INFO teacher)
        {
            if (ModelState.IsValid)
            {
                //db.SET_TEACHER_INFO.AddObject(set_teacher_info);
                //db.SaveChanges();
                decimal?USER_NO  = Session["sess_USER_NO"] as decimal?;
                decimal?LOGON_NO = Session["sess_LOGON_NO"] as decimal?;

                ObjectResult <decimal?> Teacher_No =

                    db.SET_TEACHER_INFO_INSERT(USER_NO, LOGON_NO, teacher.TEACHER_NAME, teacher.TEACHER_NAME_BNG,
                                               teacher.TEACHER_NICK_NAME, teacher.TEACHER_DOB, teacher.TEACHER_MARRIAGE_DATE, teacher.TEACHER_ADDR,
                                               teacher.TEACHER_COMENTS, teacher.TEACHER_MOBILE, teacher.INSTITUTE_NO, teacher.TEACH_DESIG_NO, teacher.IS_OFFLINE_ENTRY,
                                               teacher.OFFLINE_ENTRY_TIME, teacher.OFFLINE_ENTRY_SYNC, teacher.IS_ACTIVE, teacher.ACTIVE_FROM,
                                               teacher.ACTIVE_TO, teacher.SL_NUM);

                decimal?teacher_no = Teacher_No.ElementAt(0);

                foreach (Teacher_Subject subject in teacher.TeacherSubjects)
                {
                    decimal?subject_no = decimal.Parse(subject.SUBJECT_NO);
                    decimal?active     = subject.IS_ACTIVE ? 1 : 0;

                    db.SET_TEACHER_SUBJECT_INSERT(USER_NO, LOGON_NO, teacher_no, subject_no, null,
                                                  1, null, null, null, active, null, null, null);
                }

                return(RedirectToAction("Index"));
            }

            //ViewBag.INSTITUTE_NO = new SelectList(db.SET_INSTITUTE, "INSTITUTE_NO", "LAST_ACTION", set_teacher_info.INSTITUTE_NO);
            ViewBag.TEACH_DESIG_NO = new SelectList(db.SET_TEACHER_DESIG, "TEACH_DESIG_NO", "TEACHER_DESIG_NAME",
                                                    teacher.TEACH_DESIG_NO);
            ViewBag.SUBJECT = ViewBag.SUBJECT = db.SET_SUBJECT.OrderBy(s => s.SUBJECT_NAME).ToList();
            return(View(teacher));
        }