Ejemplo n.º 1
0
 public BaseSearchViewModel()
 {
     State           = new State();
     TeacherType     = new TeacherType();
     Qualification   = new QualificationCategory();
     StudentCategory = new StudentCategory();
 }
Ejemplo n.º 2
0
 public Teacher Create_Teacher(TeacherType type)
 {
     if (type == Kindergarten)
     {
         return(new Kindergarten());
     }
 }
Ejemplo n.º 3
0
        public ActionResult DeleteConfirmed(int id)
        {
            TeacherType teacherType = db.TeacherTypes.Find(id);
            String      sql         = "Delete From TeacherTypes where TeacherTypeID = " + teacherType.TeacherTypeID;

            db.Delete(sql);
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 4
0
 public TeacherQueryDto(long teacherId, TeacherType teacherType, long personId)
 {
     TeacherId   = teacherId;
     TeacherType = teacherType;
     Person      = new PersonQueryDto {
         PersonId = personId
     };
 }
        public IHttpActionResult GetTeacherType(int id)
        {
            TeacherType result = BusinessLayer.GetRow <TeacherType>(id);

            if (result == null)
            {
                return(NotFound());
            }
            return(Ok(result));
        }
Ejemplo n.º 6
0
        // GET: TeacherTypes
        public ActionResult Index()
        {
            String sql = "SELECT * FROM TeacherTypes";

            db.List(sql);
            var dt    = db.List(sql);
            var model = new TeacherType().List(dt);

            return(View(model));
        }
        public IHttpActionResult PostTeacherType(TeacherType item)
        {
            int newID = BusinessLayer.AddModel(item);

            if (newID == 0)
            {
                return(Conflict());
            }
            return(Ok());
        }
Ejemplo n.º 8
0
 public ActionResult Edit(TeacherType teacherType)
 {
     if (ModelState.IsValid)
     {
         String sql = "Update TeacherTypes set TypeName = '" + teacherType.TypeName + "' where TeacherTypeID = " + teacherType.TeacherTypeID;
         db.Edit(sql);
         return(RedirectToAction("Index"));
     }
     return(View(teacherType));
 }
Ejemplo n.º 9
0
        public ActionResult Create(TeacherType teacherType)
        {
            if (ModelState.IsValid)
            {
                String sql = "Insert into TeacherTypes (TypeName) values ('" + teacherType.TypeName + "')";
                db.Create(sql);
                return(RedirectToAction("Index"));
            }

            return(View(teacherType));
        }
Ejemplo n.º 10
0
 public List <Teacher> GetBy(TeacherType teacherType)
 {
     try
     {
         List <Teacher> teachers = _da.GetModelsBy <Teacher, TEACHER>(t => t.Teacher_Type_Id == teacherType.Id);
         return(GetByHelper(teachers));
     }
     catch (Exception)
     {
         throw;
     }
 }
Ejemplo n.º 11
0
        // GET: TeacherTypes/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TeacherType teacherType = db.TeacherTypes.Find(id);

            if (teacherType == null)
            {
                return(HttpNotFound());
            }
            return(View(teacherType));
        }
        private void InitControlValuesForEdit(int id)
        {
            train_course_view info = context.train_course_view.Single(i => i.Id == id);

            Name.Text           = info.Name;
            Name.Enabled        = false;
            Number.Text         = info.Number;
            Number.Enabled      = false;
            Time.Text           = info.Time.ToString();
            Time.Enabled        = false;
            Description.Text    = info.Description;
            Description.Enabled = false;

            Type.Value = info.Type;

            Type.DataBind();
            Type.Enabled = false;
            lessonType.DataBind();

            ContentType.Value = info.ContentTypeId;
            ContentType.DataBind();
            ContentType.Enabled = false;
            LinqContentType.DataBind();

            Place.Text    = info.Place;
            Place.Enabled = false;

            Class_time.Text    = info.Class_time;
            Class_time.Enabled = false;

            start_date.Date    = info.Start_date;
            start_date.Enabled = false;

            end_date.Date    = info.End_date;
            end_date.Enabled = false;

            EndChooseDate.Date    = info.End_choose_date;
            EndChooseDate.Enabled = false;

            Teacher.Value = info.Teacher;
            TeacherType.DataBind();
            //TeacherType.Enabled = false;

            Status.Value = info.Status;
            Status.DataBind();
            Status.Enabled = false;
            CourseStatus.DataBind();
            Create_time.Text    = info.Create_time.ToString();
            Create_time.Enabled = false;
        }
Ejemplo n.º 13
0
        public List <Teacher> GetBy(TeacherType teacherType, QualificationCategory qualification)
        {
            try
            {
                List <TEACHER> entities = (from teacher in _da.DbContext.Set <TEACHER>()
                                           where teacher.Teacher_Type_Id == teacherType.Id &&
                                           teacher.TEACHER_EDUCATIONAL_QUALIFICATION.Any(x => x.QUALIFICATION.Qualification_Category_Id == qualification.Id)
                                           select teacher).ToList();

                List <Teacher> teachers = Translate(entities);
                return(GetByHelper(teachers));
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 14
0
        public List <Teacher> GetBy(TeacherType teacherType, State state)
        {
            try
            {
                List <TEACHER> entities = (from teacher in _da.DbContext.Set <TEACHER>()
                                           where teacher.PERSON.State_Id == state.Id &&
                                           teacher.Teacher_Type_Id == teacherType.Id
                                           select teacher).ToList();

                List <Teacher> teachers = Translate(entities);
                return(GetByHelper(teachers));
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 15
0
        public List <Teacher> GetBy(TeacherType teacherType, StudentCategory childCategory)
        {
            try
            {
                List <TEACHER> entities = (from teacher in _da.DbContext.Set <TEACHER>()
                                           where teacher.Teacher_Type_Id == teacherType.Id &&
                                           teacher.TEACHER_STUDENT_CATEGORY.Any(x => x.Student_Category_Id == childCategory.Id)
                                           select teacher).ToList();

                List <Teacher> teachers = Translate(entities);
                return(GetByHelper(teachers));
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 16
0
        public List <Teacher> GetBy(TeacherType teacherType, StudentCategory childCategory, QualificationCategory qualification, State state)
        {
            try
            {
                List <TEACHER> entities = (from teacher in _da.DbContext.Set <TEACHER>()
                                           where teacher.PERSON.State_Id == state.Id &&
                                           teacher.Teacher_Type_Id == teacherType.Id &&
                                           teacher.TEACHER_STUDENT_CATEGORY.Any(x => x.Student_Category_Id == childCategory.Id) &&
                                           teacher.TEACHER_EDUCATIONAL_QUALIFICATION.Any(x => x.QUALIFICATION.Qualification_Category_Id == qualification.Id)
                                           select teacher).ToList();

                List <Teacher> teachers = Translate(entities);
                return(GetByHelper(teachers));
            }
            catch (Exception)
            {
                throw;
            }
        }
        private List <Teacher> CheckTeaher(string name, int age, QualificationsResult result, int hour, TeacherType type)
        {
            _stubTeacher.SelectTeachers().Returns(new List <Teacher>
            {
                new Teacher {
                    Name = name, Age = age, CheckResult = result, Hour = hour, Type = type
                }
            });

            return(_teacher.CheckTeacherQualifications());
        }
Ejemplo n.º 18
0
        protected List <Teacher> FindTeacherByHelper(TeacherType teacherType, StudentCategory studentCategory, QualificationCategory qualification, State location)
        {
            List <Teacher> teachers = null;

            try
            {
                if ((teacherType != null && teacherType.Id > 0) && (studentCategory == null || studentCategory.Id <= 0) && (qualification == null || qualification.Id <= 0) && (location == null || string.IsNullOrWhiteSpace(location.Id)))
                {
                    teachers = _teacherFinder.GetBy(teacherType);
                }
                else if ((teacherType == null || teacherType.Id <= 0) && (studentCategory != null && studentCategory.Id > 0) && (qualification == null || qualification.Id <= 0) && (location == null || string.IsNullOrWhiteSpace(location.Id)))
                {
                    teachers = _teacherFinder.GetBy(studentCategory);
                }
                else if ((teacherType == null || teacherType.Id <= 0) && (studentCategory == null || studentCategory.Id <= 0) && (qualification != null && qualification.Id > 0) && (location == null || string.IsNullOrWhiteSpace(location.Id)))
                {
                    teachers = _teacherFinder.GetBy(qualification);
                }
                else if ((teacherType == null || teacherType.Id <= 0) && (studentCategory == null || studentCategory.Id <= 0) && (qualification == null || qualification.Id <= 0) && (location != null && !string.IsNullOrWhiteSpace(location.Id)))
                {
                    teachers = _teacherFinder.GetBy(location);
                }



                else if ((teacherType != null && teacherType.Id > 0) && (studentCategory != null && studentCategory.Id > 0) && (qualification == null || qualification.Id <= 0) && (location == null || string.IsNullOrWhiteSpace(location.Id)))
                {
                    teachers = _teacherFinder.GetBy(teacherType, studentCategory);
                }
                else if ((teacherType != null && teacherType.Id > 0) && (studentCategory == null || studentCategory.Id <= 0) && (qualification != null && qualification.Id > 0) && (location == null || string.IsNullOrWhiteSpace(location.Id)))
                {
                    teachers = _teacherFinder.GetBy(teacherType, qualification);
                }
                else if ((teacherType != null && teacherType.Id > 0) && (studentCategory == null || studentCategory.Id <= 0) && (qualification == null || qualification.Id <= 0) && (location != null && !string.IsNullOrWhiteSpace(location.Id)))
                {
                    teachers = _teacherFinder.GetBy(teacherType, location);
                }
                else if ((teacherType == null || teacherType.Id <= 0) && (studentCategory != null && studentCategory.Id > 0) && (qualification != null && qualification.Id > 0) && (location == null || string.IsNullOrWhiteSpace(location.Id)))
                {
                    teachers = _teacherFinder.GetBy(studentCategory, qualification);
                }
                else if ((teacherType == null || teacherType.Id <= 0) && (studentCategory != null && studentCategory.Id > 0) && (qualification == null || qualification.Id <= 0) && (location != null && !string.IsNullOrWhiteSpace(location.Id)))
                {
                    teachers = _teacherFinder.GetBy(studentCategory, location);
                }
                else if ((teacherType == null || teacherType.Id <= 0) && (studentCategory == null || studentCategory.Id <= 0) && (qualification != null && qualification.Id > 0) && (location != null && !string.IsNullOrWhiteSpace(location.Id)))
                {
                    teachers = _teacherFinder.GetBy(qualification, location);
                }



                else if ((teacherType != null && teacherType.Id > 0) && (studentCategory != null && studentCategory.Id > 0) && (qualification != null && qualification.Id > 0) && (location == null || string.IsNullOrWhiteSpace(location.Id)))
                {
                    teachers = _teacherFinder.GetBy(teacherType, studentCategory, qualification);
                }
                else if ((teacherType != null && teacherType.Id > 0) && (studentCategory != null && studentCategory.Id > 0) && (qualification == null || qualification.Id <= 0) && (location != null && !string.IsNullOrWhiteSpace(location.Id)))
                {
                    teachers = _teacherFinder.GetBy(teacherType, studentCategory, location);
                }
                else if ((teacherType != null && teacherType.Id > 0) && (studentCategory == null || studentCategory.Id <= 0) && (qualification != null && qualification.Id > 0) && (location != null && !string.IsNullOrWhiteSpace(location.Id)))
                {
                    teachers = _teacherFinder.GetBy(teacherType, qualification, location);
                }
                else if ((teacherType == null || teacherType.Id <= 0) && (studentCategory != null && studentCategory.Id > 0) && (qualification != null && qualification.Id > 0) && (location != null && !string.IsNullOrWhiteSpace(location.Id)))
                {
                    teachers = _teacherFinder.GetBy(studentCategory, qualification, location);
                }


                else if ((teacherType != null && teacherType.Id > 0) && (studentCategory != null && studentCategory.Id > 0) && (qualification != null && qualification.Id > 0) && (location != null && !string.IsNullOrWhiteSpace(location.Id)))
                {
                    teachers = _teacherFinder.GetBy(teacherType, studentCategory, qualification, location);
                }

                return(teachers);
            }
            catch (Exception)
            {
                throw;
            }
        }