Пример #1
0
        public void deleteSC(int scId)
        {
            StudentCategory scQuery = (from x in dbcontext.StudentCategories where x.Id == scId select x).FirstOrDefault();

            scQuery.IsDeleted = true;
            dbcontext.SaveChanges();
        }
Пример #2
0
 public BaseSearchViewModel()
 {
     State           = new State();
     TeacherType     = new TeacherType();
     Qualification   = new QualificationCategory();
     StudentCategory = new StudentCategory();
 }
        public async Task PopuplateData()
        {
            Student student = new Student();

            Students = new List <Student>();
            for (int i = 1; i < 10; i++)
            {
                student.StudentId = i;
                student.FirstName = "Jack";
                student.SurName   = "Jones";
                StudentCategory studentCategory = new StudentCategory();
                studentCategory.StudentCategoryId          = 1;
                studentCategory.StudentCategoryDescription = "A";
                ParentalDetails parentalDetails = new ParentalDetails();
                parentalDetails.FatherName    = "Jackie";
                parentalDetails.MotherName    = "Joniela";
                parentalDetails.ContactNumber = "4546578595955";
                parentalDetails.AnnualIncome  = 30000;
                parentalDetails.EmailAddress  = "*****@*****.**";
                Address address = new Address();
                address.AddressId       = 1;
                address.AddressLine1    = "Muthayaa";
                address.AddressLine2    = "Teststst";
                address.AddressLine3    = "eeeeee";
                address.PostCode        = "534234";
                student.Address         = address;
                student.ParentalDetails = parentalDetails;
                student.StudentCategory = studentCategory;
                Students.Add(student);
            }
        }
        public bool InsertStudentCategory(StudentCategory studentCategory)
        {
            _logger.LogInfo($"Inserting student category {studentCategory.Description}");

            var rowsAffected = _dbConnection.Execute(@"INSERT INTO [StudentCategories]([Description], [Priority]) 
                                        VALUES(@StudentCategoryDescription, @StudentCategoryPriority)", new { StudentCategoryDescription = studentCategory.Description, StudentCategoryPriority = studentCategory.Priority });

            return(rowsAffected > 0);
        }
 public StudentCategory GetStudentCategoryData(int id)
 {
     try
     {
         StudentCategory studentCategory = _appContext.studentCategories.Find(id);
         return(studentCategory);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 public int AddStudentCategory(StudentCategory studentCategory)
 {
     try
     {
         _appContext.studentCategories.Add(studentCategory);
         _appContext.SaveChanges();
         return(1);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 public int UpdateStudentCategory(StudentCategory studentCategory)
 {
     try
     {
         _appContext.Entry(studentCategory).State = EntityState.Modified;
         _appContext.SaveChanges();
         return(1);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Пример #8
0
        public override string ToString()
        {
            string outputStr = "Ticket Details" +
                               "\n" + "Student Id: " + StudentId +
                               "\n" + "Student Category: "
                               + StudentCategory.ToString() +
                               "\n" + CategoryName +
                               "\n" + "Speed Limit: " + SpeedLimit +
                               "\n" + "Speed Reported: " + SpeedReported +
                               "\n" + "Fine: " + Fine.ToString("C");

            return(outputStr);
        }
 public bool InsertStudentCategory([FromBody] StudentCategory studentCategory)
 {
     _logger.LogInfo("API HttpPost api/studentCategories");
     try
     {
         return(_studentCategoryService.InsertStudentCategory(studentCategory));
     }
     catch (System.Exception e)
     {
         _logger.LogError("API HttpPost api/studentCategories  " + e.Message);
         throw e;
     }
 }
Пример #10
0
 public int DeleteStudentCategory(int id)
 {
     try
     {
         StudentCategory studentCategory = _appContext.studentCategories.Find(id);
         _appContext.studentCategories.Remove(studentCategory);
         _appContext.SaveChanges();
         return(1);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Пример #11
0
        public void SetUp()
        {
            var studentCategory = new StudentCategory("Sub19", 19);

            _team = new Team("Time 1", studentCategory, "Time de Sub19");

            _name    = new Name("a", "b", "99999999", "99999999999");
            _payment = new Payment(1, 5);

            _birthDate = DateTime.Now.AddYears(-19);

            _student = new Student(_name, _name, _payment,
                                   _name, string.Empty, _birthDate,
                                   EGender.Male, string.Empty);
        }
        public bool UpdateStudentCategory(StudentCategory studentCategory)
        {
            _logger.LogInfo($"Updating student category {studentCategory.Id}");

            int rowsAffected = _dbConnection.Execute(@"UPDATE [StudentCategories] 
                                                       SET [Description] = @StudentCategoryDescription, [Priority] = @StudentCategoryPriority 
                                                       WHERE Id = @StudentCategoryId", new
            {
                StudentCategoryId          = studentCategory.Id,
                StudentCategoryDescription = studentCategory.Description,
                StudentCategoryPriority    = studentCategory.Priority
            });

            return(rowsAffected > 0);
        }
Пример #13
0
        public void SetUp()
        {
            int studentCategoryMaxAge = 20;

            _studentCategory = new StudentCategory("a", studentCategoryMaxAge);
            _team            = new Team("a", _studentCategory, "b");
            _match           = new Match(_team, "c", DateTime.Now.AddDays(1), "d");

            int matchTime    = 5;
            int playerNumber = 10;

            _goal  = new Goal(matchTime, playerNumber);
            _card  = new Card(matchTime, playerNumber, ECardType.Yellow);
            _fault = new Fault(matchTime, playerNumber);
        }
Пример #14
0
        public StudentCategoryCL viewSCById(int scId)
        {
            StudentCategory   querySCDB = (from x in dbcontext.StudentCategories where x.Id == scId && x.IsDeleted == false select x).FirstOrDefault();
            StudentCategoryCL scCL      = new StudentCategoryCL()
            {
                id            = querySCDB.Id,
                name          = querySCDB.Name,
                dateCreated   = querySCDB.DateCreated,
                dateModified  = querySCDB.DateModified,
                isDeleted     = querySCDB.IsDeleted,
                totalStrength = querySCDB.Students.Count(),
            };

            return(scCL);
        }
Пример #15
0
        public List <Teacher> GetBy(StudentCategory childCategory)
        {
            try
            {
                List <TEACHER> entities = (from teacher in _da.DbContext.Set <TEACHER>()
                                           where 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;
            }
        }
Пример #16
0
        public int addSC(StudentCategoryCL scInput)
        {
            StudentCategory scQuery = dbcontext.StudentCategories.Add(new StudentCategory
            {
                Id           = scInput.id,
                Name         = scInput.name,
                DateCreated  = scInput.dateCreated,
                DateModified = scInput.dateModified,
                IsDeleted    = scInput.isDeleted,
            });

            dbcontext.SaveChanges();
            int SCId = scQuery.Id;

            return(SCId);
        }
Пример #17
0
        public StudentCategoryCL updateSC(StudentCategoryCL scInput)
        {
            StudentCategoryCL scReturn = new StudentCategoryCL();
            StudentCategory   scQuery  = (from x in dbcontext.StudentCategories where x.Id == scInput.id select x).FirstOrDefault();

            scQuery.Id           = scInput.id;
            scQuery.Name         = scInput.name;
            scQuery.IsDeleted    = scInput.isDeleted;
            scQuery.DateCreated  = scInput.dateCreated;
            scQuery.DateModified = scInput.dateModified;
            dbcontext.SaveChanges();
            scReturn.id           = scQuery.Id;
            scReturn.name         = scQuery.Name;
            scReturn.dateCreated  = scQuery.DateCreated;
            scReturn.dateModified = scQuery.DateModified;
            scReturn.isDeleted    = scQuery.IsDeleted;
            return(scReturn);
        }
Пример #18
0
        public List <Teacher> GetBy(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_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;
            }
        }
Пример #19
0
        public ActionResult Choose(FormCollection formCollection)
        {
            if (!Init(User))
            {
                return(RedirectToAction("Index", "Home"));
            }

            if (!_isStudent)
            {
                return(RedirectToAction("Menu", "Home"));
            }

            Student studentDb = _studentRepository.GetById(_student.Id);

            _studentRepository.RemoveCategory(studentDb);
            studentDb.Categories = new List <StudentCategory>();

            List <string> allCategory = _categoryRepository.GetAll().Select(c => c.Name).ToList();

            foreach (string category in allCategory)
            {
                string c = formCollection[category];
                if (c.StartsWith("true"))
                {
                    StudentCategory studentCategoryDb = new StudentCategory()
                    {
                        CategoryId = _categoryRepository.GetByName(category).Id,
                        StudentId  = _student.Id
                    };
                    studentDb.Categories.Add(studentCategoryDb);
                }
            }
            _studentRepository.AddCategory(studentDb);

            return(RedirectToAction("Menu", "Home"));
        }
        public HttpResponseMessage GetListData(string cancelledStatus = "")
        {
            DataTable dt = StudentCategory.GetListData(cancelledStatus).Tables[0];

            return(Request.CreateResponse(HttpStatusCode.OK, iUtil.APIResponse.GetData(dt)));
        }
Пример #21
0
 public int Edit([FromBody] StudentCategory studentCategory)
 {
     return(_unitOfWork.Student.UpdateStudentCategory(studentCategory));
 }
Пример #22
0
 public int Create([FromBody] StudentCategory studentCategory)
 {
     return(_unitOfWork.Student.AddStudentCategory(studentCategory));
 }
Пример #23
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;
            }
        }