public ActionResult CustomerAssessment(QuestionOnePost question)
        {
            // Get Report
            string companyName = string.Empty, address = string.Empty, contactName = string.Empty;
            var    userInfo = new Repository <Organization>();
            var    user     = userInfo.Filter(q => q.Id == this.UserId).FirstOrDefault();

            if (user != null)
            {
                companyName = user.Name;
                address     = user.Address;
                contactName = user.ContactName;
            }

            if (question.hdnaction != string.Empty && (question.hdnaction.Contains("PDF") || question.hdnaction.Contains("CSV")))
            {
                var level = question.hdnaction.Split('-')[1];
                if (question.hdnaction.Contains("PDF"))
                {
                    return(PdfExport(companyName, address, contactName, level));
                }
                else
                {
                    return(CsvExport(companyName, address, contactName, level));
                }
            }
            else
            {
                GroupQuiz groupQuiz = null;
                int       groupId   = int.Parse(question.QInfo);
                if (question.hdnaction == "Previous")
                {
                    groupId = groupId - 1;
                    if (groupId <= 0)
                    {
                        groupId = 1;
                    }
                }
                else
                {
                    groupId = groupId + 1;
                }
                this.groupQuizManager = new GroupQuizManager(this.UserId);
                this.groupQuizManager.AllQuestions = (List <GroupQuiz>)Session["AllGroupQuestions"];
                if (this.groupQuizManager.MoveToNextGroup(groupId))
                {
                    groupQuiz = this.groupQuizManager.LoadQuiz(groupId);
                }
                else
                {
                    groupQuiz = this.groupQuizManager.LoadQuiz(--groupId);
                }

                return(PartialView("QuizGroupPartial", groupQuiz));
            }
        }
Ejemplo n.º 2
0
        public ActionResult CustomerAssessmentReport(QuestionOnePost question)
        {
            //PDF-1-Level 1

            if (question.hdnaction != string.Empty && (question.hdnaction.Contains("PDF") || question.hdnaction.Contains("CSV")))
            {
                var values = question.hdnaction.Split('-');
                if (question.hdnaction.Contains("PDF"))
                {
                    return(PdfExport(int.Parse(values[1]), values[2]));
                }
                else
                {
                    return(CsvExport(int.Parse(values[1]), values[2]));
                }
            }
            else
            {
                var groupQuizManager = new GroupQuizManager(question.UserId);
                var listOfGroup      = groupQuizManager.GetAllQuestions(question.Level);
                groupQuizManager.AllQuestions = listOfGroup;

                GroupQuiz groupQuiz = new GroupQuiz();
                int       groupId   = int.Parse(question.QInfo);
                if (question.hdnaction == "Previous")
                {
                    groupId = groupId - 1;
                    if (groupId <= 0)
                    {
                        groupId = 1;
                    }
                }
                else
                {
                    if (listOfGroup.Count > groupId)
                    {
                        groupId = groupId + 1;
                    }
                }

                if (groupQuizManager.MoveToNextGroup(groupId))
                {
                    groupQuiz = groupQuizManager.LoadQuiz(groupId);
                }
                groupQuiz.UserId = question.UserId;
                return(PartialView("~/Views/ManageUser/QuizGroupPartial.cshtml", groupQuiz));
            }
        }