Exemplo n.º 1
0
        public ActionResult AddNewSection_Post(TaxCourse taxcourse)
        {
            CourseSection        objcoursesection        = new CourseSection();
            CourseSectionContent objcourcesectioncontent = new CourseSectionContent();

            objcoursesection.CourseSectionName = taxcourse.SectionTitle;
            objcoursesection.CourseId          = taxcourse.Id;
            objcoursesection.IsDeleted         = false;

            this._coursesection.Add(objcoursesection);

            objcourcesectioncontent.CourseSectionID     = objcoursesection.CourseSectionId;
            objcourcesectioncontent.CourseContentTypeId = taxcourse.SectionType;
            objcourcesectioncontent.IsDeleted           = false;

            switch (taxcourse.SectionType)
            {
            case (int)Core.SectionType.Content:
                objcourcesectioncontent.CourseSectionContent1 = taxcourse.Text;
                break;

            case (int)Core.SectionType.Video:
                objcourcesectioncontent.CourseSectionContent1 = taxcourse.File;
                break;
            }


            this._coursesectioncontent.Add(objcourcesectioncontent);
            taxcourse.Text      = string.Empty;
            taxcourse.SectionID = objcoursesection.CourseSectionId;
            taxcourse.Type      = Convert.ToInt32(taxcourse.SectionType);

            return(RedirectToAction("GetContent", taxcourse));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Gets the Next Section Id to the Current Section
        /// </summary>
        /// <param name="objCourse"></param>
        /// <param name="obj"></param>
        private void GetNextSectionId(TaxCourse objCourse, TaxCourse obj)
        {
            if (objCourse.Id != 0)
            {
                var objReturned = TrainingSteps(objCourse);

                foreach (var item in objReturned)
                {
                    if (item.SectionID > objCourse.SectionID)
                    {
                        obj.SectionID = item.SectionID;
                        obj.Id = item.Id;
                        obj.SectionType = item.SectionType;
                        obj.SectionTitle = item.SectionTitle;

                        break;
                    }
                    else
                    {
                        obj.SectionID = item.SectionID;
                        obj.Id = item.Id;
                        obj.SectionType = item.SectionType;
                        obj.SectionTitle = item.SectionTitle;
                    }
                }
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// Gets the Multiple Choice Questions for the Current Section
 /// </summary>
 /// <param name="objCourse"></param>
 /// <returns></returns>
 private IEnumerable<Questions> GetTestQustions(TaxCourse objCourse)
 {
     var data = this._sectionQuestions.FindAll()
             .Where(x => x.SectionId == objCourse.SectionID)
             .Select(x =>
             {
                 var Qus = new Questions
                 {
                     Question = x.Question,
                     QuestionId = x.QuestionId,
                     SectionID = x.SectionId.Value,
                     Description = x.Description,
                     Answers = x.SectionAnswers.Where(y => y.QuestionId == x.QuestionId).Select(y =>
                     {
                         var Ans = new Answers
                         {
                             Answer = y.Answer,
                             AnswerId = y.AnswerId
                         };
                         return Ans;
                     })
                 };
                 return Qus;
             });
     return data;
 }
Exemplo n.º 4
0
        public ActionResult AddSectionTest(TaxCourse objSectionData)
        {
            if (objSectionData.Id != 0)
            {
                CourseSteps(objSectionData);
            }
            var Model     = new Core.QuestionsModel();
            var questions = this._sectionQuestions.FindAll()
                            .Where(x => x.SectionId == objSectionData.SectionID)
                            .Select(x =>
            {
                var Qus = new Questions
                {
                    QuestionId = x.QuestionId,
                    Question   = x.Question,
                    Answers    = x.SectionAnswers.Select(y =>
                    {
                        var Ans = new Answers()
                        {
                            AnswerId  = y.AnswerId,
                            Answer    = y.Answer,
                            IsCorrect = y.IsCorrect.HasValue ? y.IsCorrect.Value : false
                        };
                        return(Ans);
                    })
                };
                return(Qus);
            });

            Model.Questions = questions.OrderByDescending(x => x.QuestionId).ToList();
            Model.SectionID = objSectionData.SectionID;
            Model.Id        = objSectionData.Id;
            return(View(Model));
        }
Exemplo n.º 5
0
        public ActionResult AddSectionTest_Post(QuestionsModel objQuestionData)
        {
            if (objQuestionData.Id != 0)
            {
                CourseSteps(objQuestionData);
            }

            switch (objQuestionData.Text)
            {
            case "Add Question":
                AddNewQuestion(objQuestionData);
                break;

            case "Update Question":
                UpdateQuestion(objQuestionData);
                break;
            }

            TaxCourse objSectionData = new TaxCourse();

            objSectionData.Id        = objQuestionData.Id;
            objSectionData.SectionID = objQuestionData.SectionID;

            return(RedirectToAction("AddSectionTest", objSectionData));
        }
Exemplo n.º 6
0
        public ActionResult AddNewSection(TaxCourse objCourse)
        {
            if (objCourse.Id != 0)
            {
                //TempData["courseid"] = objCourse.Id;
                CourseSteps(objCourse);
            }

            return(View());
        }
Exemplo n.º 7
0
        ///// <summary>
        ///// Gets the Description of the Course
        ///// </summary>
        ///// <returns></returns>
        //public ActionResult Description(TaxCourse objCourse)
        //{
        //    if (objCourse.Id != 0)
        //    {
        //        TempData["courseid"] = objCourse.Id;
        //        CourseSteps(objCourse);
        //        var data = this._coursesectioncontent.FindOne(x => x.CourseSectionID == objCourse.SectionID);
        //        TaxCourse objTaxCourse = GetSectionContent(data);
        //        return View(objTaxCourse);
        //    }
        //    return View();
        //}


        ///// <summary>
        ///// Gets the Videos of the Course
        ///// </summary>
        ///// <returns></returns>
        //public ActionResult Videos(TaxCourse objCourse)
        //{
        //    if (objCourse.Id != 0)
        //    {
        //        TempData["courseid"] = objCourse.Id;
        //        CourseSteps(objCourse);
        //        var data = this._coursesectioncontent.FindOne(x => x.CourseSectionID == objCourse.SectionID);
        //        TaxCourse objTaxCourse = GetSectionContent(data);
        //        return View(objTaxCourse);
        //    }
        //    return View();
        //}
        #endregion

        /// <summary>
        /// Gets the Content of the Section both video or Text
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        private TaxCourse GetSectionContent(CourseSectionContent data)
        {
            TaxCourse objTaxCourse = new TaxCourse();

            objTaxCourse.Id           = data.CourseSection.CourseId.Value;
            objTaxCourse.SectionID    = data.CourseSectionID.Value;
            objTaxCourse.SectionTitle = this._coursesection.FindOne(x => x.CourseSectionId == objTaxCourse.SectionID).CourseSectionName;
            objTaxCourse.Type         = Convert.ToInt32(data.CourseContentTypeId.Value);
            objTaxCourse.Text         = data.CourseSectionContent1;
            return(objTaxCourse);
        }
Exemplo n.º 8
0
        public ActionResult GetContent(TaxCourse objTaxCourse)
        {
            TrainingSteps(objTaxCourse);
            var data = this._coursesectioncontent.FindOne(x => x.CourseSectionID == objTaxCourse.SectionID);
            TaxCourse objCourse = GetSectionContent(data);

            switch (Convert.ToInt32(objTaxCourse.SectionType))
            {
                case (int)SectionType.Content:
                    return View("Description", objCourse);
                case (int)SectionType.Video:
                    return View("Videos", objCourse);
                default:
                    return View("Description", objCourse);
            }
        }
Exemplo n.º 9
0
        /// <summary>
        /// Gets the Content of the Section both video or Text
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        private TaxCourse GetSectionContent(CourseSectionContent data)
        {
            TaxCourse objTaxCourse = new TaxCourse();
            objTaxCourse.Id = data.CourseSection.CourseId.Value;
            objTaxCourse.SectionID = data.CourseSectionID.Value;
            objTaxCourse.SectionTitle = this._coursesection.FindOne(x => x.CourseSectionId == objTaxCourse.SectionID).CourseSectionName;
            objTaxCourse.Type = Convert.ToInt32(data.CourseContentTypeId.Value);
            objTaxCourse.Text = data.CourseSectionContent1;
            if (objTaxCourse.Type == ((int)Core.SectionType.Video))
            {
                objTaxCourse.Text = Convert.ToString(objTaxCourse.Text==null?string.Empty:objTaxCourse.Text)
                    .Contains(".com") ? objTaxCourse.Text : "../../Images/no-video-available.jpg";
            }

            return objTaxCourse;
        }
Exemplo n.º 10
0
 public ActionResult AddTaxCourse_Post(CourseInsurance objAddCourseMetaData)
 {
     if (ModelState.IsValid)
     {
         Course objCourse = new Course();
         objCourse.CourseName = objAddCourseMetaData.CourseName;
         objCourse.CatalogId  = (int)Core.CourseCatalog.Tax;
         objCourse.IsDeleted  = false;
         this._courseRepository.Add(objCourse);
         //TempData["courseid"] = objCourse.CourseId;
         Core.TaxCourse objTaxCourse = new TaxCourse();
         objTaxCourse.Id        = objCourse.CourseId;
         objTaxCourse.CatalogId = (int)Core.CourseCatalog.Tax;
         return(RedirectToAction("AddNewSection", objTaxCourse));
     }
     return(View("AddNewSection"));
 }
Exemplo n.º 11
0
        /// <summary>
        /// Gets the View of Training Steps
        /// </summary>
        /// <param name="courseid"></param>
        /// <returns></returns>
        //[EncryptedActionParameter]
        public List<TaxCourse> TrainingSteps(TaxCourse objCourse)
        {
            var CourseSections = this._coursesection.FindAll()
              .Where(w => w.CourseId == objCourse.Id && w.IsDeleted == false)
              .Select(x =>
              {
                  var taxcourse = new TaxCourse
                  {
                      Id = x.CourseId.Value,
                      SectionTitle = x.CourseSectionName,
                      SectionID = x.CourseSectionId,
                      CourseName = x.Course.CourseName,
                      CatalogId = x.Course.CatalogId.Value,
                      IsCompleted = x.CourseStatus.Where(y => y.CourseSectionId == x.CourseSectionId && y.UserId == UserId).Any(),
                      SectionType = x.CourseSectionContents.Where(y => y.CourseSectionID == x.CourseSectionId).Select(y => y.CourseContentTypeId).FirstOrDefault().Value
                  };
                  return taxcourse;
              });

            List<TaxCourse> objtaxcourse = new List<TaxCourse>();
            if (CourseSections.ToList().Count == 0)
            {
                TaxCourse taxcourse = new TaxCourse();
                taxcourse.Id = objCourse.Id;
                objtaxcourse.Add(taxcourse);
            }
            ViewBag.CourseSections = CourseSections.ToList().Count != 0 ? CourseSections.ToList() : objtaxcourse;

            GetRecentImages();// TO get the Latest Images Opened

            var CatalogId = CourseSections.ToList().Count != 0 ? CourseSections.FirstOrDefault().CatalogId : objtaxcourse[0].CatalogId;
            switch (CatalogId)
            {
                case (int)Core.CourseCatalog.Insurance:
                    ViewBag.Active = "liInsurance";
                    break;
                case (int)Core.CourseCatalog.Tax:
                    ViewBag.Active = "liTaxCourse";
                    break;
            }

            return CourseSections.ToList().Count != 0 ? CourseSections.ToList() : objtaxcourse;
        }
Exemplo n.º 12
0
        public ActionResult AddNewTest_Post(TaxCourse taxcourse)
        {
            var CourseTest = this._CourseTest.Find(x => x.CourseId == taxcourse.Id).FirstOrDefault();


            if (CourseTest != null)
            {
                CourseTest.FormId = taxcourse.FormId;
                this._CourseTest.Update(CourseTest);
            }
            else
            {
                CourseTest newTest = new CourseTest();
                newTest.FormId   = taxcourse.FormId;
                newTest.CourseId = taxcourse.Id;
                this._CourseTest.Add(newTest);
            }
            return(RedirectToAction("AddNewTest", taxcourse));
        }
Exemplo n.º 13
0
        public ActionResult SectionTest(TaxCourse objCourse)
        {
            //To Get the Next Section Data And to Transfer to the Next section If no test Available.
            var obj = new TaxCourse();
            GetNextSectionId(objCourse, obj);

            //Gets the Questions of each Section
            var data = GetTestQustions(objCourse);

            // Gets the View of the Section Test if the test or Section Questions Available
            if(data.Select(x=>x.Question).Count() != 0)
                return View(data.ToList());

            //Other wise redirects to the view of Next Section
            //Add the Section as Completed if no Section Test is available
            AddCourseStatus(objCourse.SectionID);
            //Return to the Next Section
            return RedirectToAction("GetContent",obj);
        }
Exemplo n.º 14
0
        /// <summary>
        /// Gets the View of Course Steps
        /// </summary>
        /// <param name="courseid"></param>
        /// <returns></returns>
        public void CourseSteps(TaxCourse objCourse)
        {
            var CourseSections = this._coursesection.FindAll()
                                 .Where(w => w.CourseId == objCourse.Id && w.IsDeleted == false)
                                 .Select(x =>
            {
                var taxcourse = new TaxCourse
                {
                    Id           = x.CourseId.Value,
                    SectionTitle = x.CourseSectionName,
                    SectionID    = x.CourseSectionId,
                    CourseName   = x.Course.CourseName,
                    CatalogId    = x.Course.CatalogId.Value,
                    SectionType  = x.CourseSectionContents.Where(y => y.CourseSectionID == x.CourseSectionId).Select(y => y.CourseContentTypeId).FirstOrDefault().Value
                };
                return(taxcourse);
            });

            List <TaxCourse> objtaxcourse = new List <TaxCourse>();

            if (CourseSections.ToList().Count == 0)
            {
                TaxCourse taxcourse = new TaxCourse();
                taxcourse.Id         = objCourse.Id;
                taxcourse.CourseName = objCourse.CourseName;
                taxcourse.CatalogId  = objCourse.CatalogId;
                objtaxcourse.Add(taxcourse);
            }
            ViewBag.CourseSections = CourseSections.ToList().Count != 0 ? CourseSections.ToList() : objtaxcourse;

            var CatalogId = CourseSections.ToList().Count != 0 ? CourseSections.FirstOrDefault().CatalogId : objtaxcourse[0].CatalogId;

            switch (CatalogId)
            {
            case (int)Core.CourseCatalog.Insurance:
                ViewBag.Active = "liInsurance";
                break;

            case (int)Core.CourseCatalog.Tax:
                ViewBag.Active = "liTaxCourse";
                break;
            }
        }
Exemplo n.º 15
0
        public ActionResult Description_Post(TaxCourse objCourse, string Command)
        {
            var objContentData = this._coursesectioncontent.FindOne(x => x.CourseSectionID == objCourse.SectionID);

            switch (Command)
            {
            case "Update":
                objContentData.CourseSectionContent1 = objCourse.Text;
                this._coursesectioncontent.Update(objContentData);
                break;

            case "Delete":

                objContentData.IsDeleted = true;
                this._coursesectioncontent.Update(objContentData);
                var objSection = this._coursesection.FindOne(x => x.CourseSectionId == objContentData.CourseSectionID);
                objSection.IsDeleted = true;
                this._coursesection.Update(objSection);
                break;
            }
            objCourse.Text = string.Empty;
            return(RedirectToAction("AddNewSection", objCourse));
        }
Exemplo n.º 16
0
        public ActionResult AddNewTest(TaxCourse objCourse)
        {
            if (objCourse.Id != 0)
            {
                CourseSteps(objCourse);
            }

            var FormList = this._formRepository.FindAll().Select(x =>
            {
                var data = new SelectListItem()
                {
                    Value = x.FormId.ToString(),
                    Text  = x.Name,
                };
                return(data);
            }).ToList();

            var obj = new TaxCourse();

            obj.Forms  = FormList;
            obj.FormId = this._CourseTest.Find(x => x.CourseId == objCourse.Id).Count != 0 ?
                         this._CourseTest.FindOne(x => x.CourseId == objCourse.Id).FormId.Value : 0;
            return(View(obj));
        }
Exemplo n.º 17
0
 public ActionResult CourseSteps_Post(TaxCourse courseid)
 {
     return(View("AddNewSection"));
 }