예제 #1
0
        //
        // GET: /Batch/
        public ActionResult Entry()
        {
            BatchEntryVm batchEntryVm = new BatchEntryVm();

            batchEntryVm.OrganizationSelectListItems = GetOrganizationsSelectListItem();
            batchEntryVm.CourseSelectListItems       = GetCourseListItem();
            return(View(batchEntryVm));
        }
예제 #2
0
        // GET: Entry Batch
        public ActionResult Entry()
        {
            var model = new BatchEntryVm();

            model.OrganizationList = GetOrganizationList();

            return(View(model));
        }
예제 #3
0
        public ActionResult UpdateBatch(BatchEntryVm batchEntryVm)
        {
            var  batch     = Mapper.Map <Batch>(batchEntryVm);
            bool isUpdated = batchManager.UpdateBatch(batch);

            batchEntryVm.OrganizationSelectListItems = GetOrganizationsSelectListItem();
            batchEntryVm.CourseSelectListItems       = GetCourseListItem();
            batchEntryVm.TrainerSelectListItems      = GetTrainerListItem();
            batchEntryVm.StudentsSelectListItems     = GetStudentsSelectListItem();
            return(View(batchEntryVm));
        }
예제 #4
0
        public ActionResult UpdateBatch()
        {
            Batch        batch        = batchManager.GetLastAddedBatch();
            BatchEntryVm batchEntryVm = Mapper.Map <BatchEntryVm>(batch);

            batchEntryVm.OrganizationSelectListItems = GetOrganizationsSelectListItem();
            batchEntryVm.CourseSelectListItems       = GetCourseListItem();
            batchEntryVm.TrainerSelectListItems      = GetTrainerListItem();
            batchEntryVm.StudentsSelectListItems     = GetStudentsSelectListItem();
            return(View(batchEntryVm));
        }
예제 #5
0
        public ActionResult Entry(BatchEntryVm model)
        {
            var  batch   = Mapper.Map <Batch>(model);
            bool isAdded = _batchManager.Add(batch);

            if (isAdded)
            {
                return(RedirectToAction("Entry"));
            }

            return(View());
        }
예제 #6
0
        public ActionResult Entry(BatchEntryVm batchEntryVm)
        {
            var batch = Mapper.Map <Batch>(batchEntryVm);

            batch.StartDate = Convert.ToDateTime(batchEntryVm.StartDate);
            batch.EndDate   = Convert.ToDateTime(batchEntryVm.EndDate.Date);
            bool isSave = batchManager.SaveBatch(batch);

            batchEntryVm.OrganizationSelectListItems = GetOrganizationsSelectListItem();
            batchEntryVm.CourseSelectListItems       = GetCourseListItem();
            return(RedirectToAction("UpdateBatch"));
        }
예제 #7
0
        public ActionResult Edit(BatchEntryVm model)
        {
            if (ModelState.IsValid)
            {
                var  batch    = Mapper.Map <Batch>(model);
                bool isUpdate = _batchManager.Update(batch);
                if (isUpdate)
                {
                    return(RedirectToAction("Index"));
                }
            }

            return(View());
        }
예제 #8
0
        public ActionResult StudentAdded(BatchEntryVm batchEntryVm)
        {
            Batch batch = batchManager.GetBatchById(batchEntryVm.Id);

            batch.Students = new List <Student>();
            foreach (var student in batchEntryVm.Students)
            {
                batch.Students.Add(batchManager.GetStudentById(student.Id));
            }
            // Batch batch = Mapper.Map<Batch>(batchEntryVm);
            bool isUpdated = batchManager.UpdateBatch(batch);

            return(View("UpdateBatch", batchEntryVm));
        }
예제 #9
0
        public ActionResult BatchExamAssign()
        {
            BatchEntryVm batchEntryVm = new BatchEntryVm();

            batchEntryVm                     = Mapper.Map <BatchEntryVm>(batchManager.GetLastAddedBatch());
            batchEntryVm.Examses             = batchManager.GetExamsByCourseId(batchEntryVm.CourseId);
            batchEntryVm.ExamSelectListItems = new List <SelectListItem>();
            foreach (var exams in batchEntryVm.Examses)
            {
                var osli = new SelectListItem();
                osli.Text  = exams.ExamCode;
                osli.Value = exams.Id.ToString();
                batchEntryVm.ExamSelectListItems.Add(osli);
            }
            return(PartialView("~\\Views\\Shared\\ExamAssignBatch.cshtml", batchEntryVm));
        }
예제 #10
0
        public ActionResult ExamAssign(BatchEntryVm batchEntryVm)
        {
            var batch = batchManager.GetLastAddedBatch();

            batch.ExamDate = batchEntryVm.ExamDate;

            bool isUpdated = batchManager.UpdateBatch(batch);

            if (isUpdated)
            {
                batch.Examses = batchManager.GetExamById(batchEntryVm.Id);

                return(Json(new { batch.ExamDate, Exam = batch.Examses.Select(e => new { e.ExamType, e.Topic, e.ExamCode, e.Duration, e.FullMarks }) }));
            }

            return(null);
        }
예제 #11
0
        public ActionResult TrainerAdded(BatchEntryVm batchEntryVm)
        {
            bool isSaved = false;
            var  batch   = Mapper.Map <Batch>(batchEntryVm);

            batch = batchManager.GetLastAddedBatch();
            foreach (var trainer in batchEntryVm.Trainers)
            {
                //var trainerAdd = batchManager.GetTrainerByName(trainer);
                //if (batchEntryVm.TrainerType)
                //{
                //    batch.LeadTrainer = trainerAdd[0].Id;
                //}
                //batch.Trainers = trainerAdd;
                //isSaved = batchManager.UpdateBatchInfo(batch);
                //if (!isSaved)
                //{

                //}
            }

            return(View("UpdateBatch"));
        }